Enhanced C#
Language of your choice: library documentation
Public fields | Public Member Functions | Protected Member Functions | Protected fields | List of all members
Loyc.Collections.AListStatisticTrackerBase< K, T, TSummary > Class Template Referenceabstract

Base class that helps efficiently keep track of statistics about the contents of one or more AListBase<K, T> objects (including derived classes such as AList, BList, BDictionary and BMultiMap). Usually you'll use one of the derived classes instead, e.g. AListSumTracker<K,T>. More...


Source file:
Inheritance diagram for Loyc.Collections.AListStatisticTrackerBase< K, T, TSummary >:
Loyc.Collections.Impl.IAListTreeObserver< K, T > Loyc.Collections.AListStatisticTracker< T >

Remarks

Base class that helps efficiently keep track of statistics about the contents of one or more AListBase<K, T> objects (including derived classes such as AList, BList, BDictionary and BMultiMap). Usually you'll use one of the derived classes instead, e.g. AListSumTracker<K,T>.

Template Parameters
KKey type of the AListBase
TValue type of the AListBase
TSummaryType of value that will be derived from the contents of the list(s)

This class keeps track of a "summary" of each node in each attached AList. It is assumed that there is some way to combine ("aggregate") summaries. For example, one common "summary" is the sum of a list of items, and multiple summaries can be combined simply by adding them.

This class can observe multiple lists at once and combine their results.

Public fields

IEnumerable< AListBase< K, T > > AttachedLists => _roots.Keys
 
int TotalCountInAttachedLists => _roots.Sum(pair => pair.Key.Count)
 
TSummary Summary => GetSummary()
 

Public Member Functions

TSummary GetSummary ()
 

Protected Member Functions

abstract TSummary Summarize (AListLeafBase< K, T > data)
 
abstract TSummary Aggregate (TSummary[] data)
 
TSummary GetSummary (AListNode< K, T > node)
 

Protected fields

virtual TSummary EmptyResult => Aggregate(EmptyArray<TSummary>.Value)