Package org.ojalgo.type.function
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 org.ojalgo.type.function.TwoStepMapper
TwoStepMapper.Combineable<T,
R, A extends 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 TypeMethodDescriptionvoid
combine
(TwoStepMapper.KeyCounter<T, G> other) This method can be used to combine the state of multiple instances.void
Input/consume the items that should be mapped(package private) FrequencyMap
<G> Output the mapped resultsvoid
merge
(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) void
reset()
Reset, so it can be re-used
-
Field Details
-
myCounter
-
myExtractor
-
myPredicate
-
-
Constructor Details
-
KeyCounter
- Parameters:
extractor
- The key extractor
-
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.Combineable
This method can be used to combine the state of multiple instances. The intermediate/internal state from one instance is combined into another.- Specified by:
combine
in interfaceTwoStepMapper.Combineable<T,
FrequencyMap<G>, TwoStepMapper.KeyCounter<T, G>>
-
consume
Description copied from interface:TwoStepMapper
Input/consume the items that should be mapped- Specified by:
consume
in interfaceTwoStepMapper<T,
G>
-
getResults
Description copied from interface:TwoStepMapper
Output the mapped results- Specified by:
getResults
in interfaceTwoStepMapper<T,
G>
-
merge
Description copied from interface:TwoStepMapper.Mergeable
This method can be used to merge the results from multiple instances. The final results from one instance is merged into another.- Specified by:
merge
in interfaceTwoStepMapper.Mergeable<T,
G>
-
reset
public void reset()Description copied from interface:TwoStepMapper
Reset, so it can be re-used- Specified by:
reset
in interfaceTwoStepMapper<T,
G>
-
getCounter
FrequencyMap<G> getCounter()
-