-
- All Known Subinterfaces:
TwoStepMapper.Combineable<T,R,A>,TwoStepMapper.Mergeable<T,R>
- All Known Implementing Classes:
BatchNode.TwoStepWrapper,SampleSet.CombineableSet,TwoStepMapper.KeyCounter,TwoStepMapper.SimpleCache
public interface TwoStepMapper<T,R>ATwoStepMapperis a mapper/reducer that is used in 2 steps –consume(Object)andgetResults(). First you consume some (many) elements, then you get the results. The results is one instance of some aggregate type – most likely a collection or map containing derived information.Resettable (to enable reuse).
There are 2 optional extensions to this interface:
TwoStepMapper.CombineableandTwoStepMapper.Mergeable. The first enables combining the state of multiple instances. The second enables merging the results from multiple instances. The difference is that combining is done before the final results are calculated, while merging is done after the final results are calculated. IfgetResults()simply returns the internal state of the instance, unaltered, then combining and merging are identical.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTwoStepMapper.Combineable<T,R,A extends TwoStepMapper.Combineable<T,R,A>>Enables combining the state of multiple instances.static classTwoStepMapper.KeyCounter<T,G>A frequency counter that optionally filters some elements when merging subresults.static interfaceTwoStepMapper.Mergeable<T,R>Enables merging the results from multiple instances.static classTwoStepMapper.SimpleCache<K,V>Will calculate the function value for each input item, and cache the result.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidconsume(T item)Input/consume the items that should be mappedRgetResults()Output the mapped resultsvoidreset()Reset, so it can be re-used
-