Class TwoStepMapper.KeyCounter<T,G>
java.lang.Object
org.ojalgo.type.function.TwoStepMapper.KeyCounter<T,G>
- All Implemented Interfaces:
TwoStepMapper<T, FrequencyMap<G>>, TwoStepMapper.Combineable<T, FrequencyMap<G>, TwoStepMapper.KeyCounter<T,G>>, TwoStepMapper.Mergeable<T, FrequencyMap<G>>
- Enclosing interface:
TwoStepMapper<T,R>
public static final class TwoStepMapper.KeyCounter<T,G>
extends Object
implements TwoStepMapper.Combineable<T, FrequencyMap<G>, TwoStepMapper.KeyCounter<T,G>>, TwoStepMapper.Mergeable<T, FrequencyMap<G>>
A frequency counter that optionally filters some elements when merging subresults.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TwoStepMapper
TwoStepMapper.Combineable<T,R, A>, TwoStepMapper.KeyCounter<T, G>, TwoStepMapper.Mergeable<T, R>, TwoStepMapper.SimpleCache<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FrequencyMap<G> private final FrequencyMap.FrequencyPredicate<G> -
Constructor Summary
ConstructorsConstructorDescriptionKeyCounter(Function<T, G> extractor) KeyCounter(Function<T, G> extractor, FrequencyMap.FrequencyPredicate<G> predicate) -
Method Summary
Modifier and TypeMethodDescriptionvoidcombine(TwoStepMapper.KeyCounter<T, G> other) This method can be used to combine the state of multiple instances.voidInput/consume the items that should be mapped(package private) FrequencyMap<G> Output the mapped resultsvoidmerge(FrequencyMap<G> other) This method can be used to merge the results from multiple instances.static <T> TwoStepMapper.KeyCounter<T, T> static <T> TwoStepMapper.KeyCounter<T, T> newInstance(FrequencyMap.FrequencyPredicate<T> predicate) voidreset()Reset, so it can be re-used
-
Field Details
-
myCounter
-
myExtractor
-
myPredicate
-
-
Constructor Details
-
KeyCounter
-
KeyCounter
- Parameters:
extractor- The key extractorpredicate- Filter used when merging/combining results
-
-
Method Details
-
newInstance
-
newInstance
public static <T> TwoStepMapper.KeyCounter<T,T> newInstance(FrequencyMap.FrequencyPredicate<T> predicate) -
combine
Description copied from interface:TwoStepMapper.CombineableThis method can be used to combine the state of multiple instances. The intermediate/internal state from one instance is combined into another.- Specified by:
combinein interfaceTwoStepMapper.Combineable<T, FrequencyMap<G>, TwoStepMapper.KeyCounter<T,G>>
-
consume
Description copied from interface:TwoStepMapperInput/consume the items that should be mapped- Specified by:
consumein interfaceTwoStepMapper<T,G>
-
getResults
Description copied from interface:TwoStepMapperOutput the mapped results- Specified by:
getResultsin interfaceTwoStepMapper<T,G>
-
merge
Description copied from interface:TwoStepMapper.MergeableThis method can be used to merge the results from multiple instances. The final results from one instance is merged into another.- Specified by:
mergein interfaceTwoStepMapper.Mergeable<T,G>
-
reset
public void reset()Description copied from interface:TwoStepMapperReset, so it can be re-used- Specified by:
resetin interfaceTwoStepMapper<T,G>
-
getCounter
FrequencyMap<G> getCounter()
-