Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
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< K, T > Loyc.Collections.AListStatisticTracker< K, T, TSummary > Loyc.Collections.AListStatisticTracker< T > Loyc.Collections.AListSumTracker< K, T > Loyc.Collections.AListSumTracker< 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 ()
 
- Public Member Functions inherited from Loyc.Collections.Impl.IAListTreeObserver< K, T >
void Detach (AListBase< K, T > list, AListNode< K, T >?root)
 Called when the observer is being detached from an AList. Detach(), unlike Attach(), is not paired with a call to RootChanged. More...
 
void RootChanged (AListBase< K, T > list, AListNode< K, T >?root, bool clear)
 Called when the root of the tree changes, or when the list is cleared. Also called after Attach(), but not after Detach(). More...
 

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(Empty<TSummary>.Array)