Package org.ojalgo.type.function
Class TwoStepMapper.SimpleCache<K,V>
java.lang.Object
org.ojalgo.type.function.TwoStepMapper.SimpleCache<K,V>
- All Implemented Interfaces:
TwoStepMapper<K,
,Map<K, V>> TwoStepMapper.Combineable<K,
,Map<K, V>, TwoStepMapper.SimpleCache<K, V>> TwoStepMapper.Mergeable<K,
Map<K, V>>
- Enclosing interface:
TwoStepMapper<T,
R>
public static final class TwoStepMapper.SimpleCache<K,V>
extends Object
implements TwoStepMapper.Combineable<K,Map<K,V>,TwoStepMapper.SimpleCache<K,V>>, TwoStepMapper.Mergeable<K,Map<K,V>>
Will calculate the function value for each input item, and cache the result. The cache is used to avoid
re-calculating the same value multiple times. The final result is a complete map of all input output
pairs.
-
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
combine
(TwoStepMapper.SimpleCache<K, V> other) This method can be used to combine the state of multiple instances.void
Input/consume the items that should be mappedgetCache()
Output the mapped resultsvoid
This method can be used to merge the results from multiple instances.void
reset()
Reset, so it can be re-used
-
Field Details
-
myCache
-
myFunction
-
-
Constructor Details
-
SimpleCache
-
-
Method Details
-
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<K,
Map<K, V>, TwoStepMapper.SimpleCache<K, V>>
-
consume
Description copied from interface:TwoStepMapper
Input/consume the items that should be mapped- Specified by:
consume
in interfaceTwoStepMapper<K,
V>
-
getResults
Description copied from interface:TwoStepMapper
Output the mapped results- Specified by:
getResults
in interfaceTwoStepMapper<K,
V>
-
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<K,
V>
-
reset
public void reset()Description copied from interface:TwoStepMapper
Reset, so it can be re-used- Specified by:
reset
in interfaceTwoStepMapper<K,
V>
-
getCache
-