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 TwoStepMapper
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 TypeMethodDescriptionvoidcombine(TwoStepMapper.SimpleCache<K, V> other) This method can be used to combine the state of multiple instances.voidInput/consume the items that should be mappedgetCache()Output the mapped resultsvoidThis method can be used to merge the results from multiple instances.voidreset()Reset, so it can be re-used
-
Field Details
-
myCache
-
myFunction
-
-
Constructor Details
-
SimpleCache
-
-
Method Details
-
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<K, Map<K,V>, TwoStepMapper.SimpleCache<K, V>>
-
consume
Description copied from interface:TwoStepMapperInput/consume the items that should be mapped- Specified by:
consumein interfaceTwoStepMapper<K,V>
-
getResults
Description copied from interface:TwoStepMapperOutput the mapped results- Specified by:
getResultsin interfaceTwoStepMapper<K,V>
-
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<K,V>
-
reset
public void reset()Description copied from interface:TwoStepMapperReset, so it can be re-used- Specified by:
resetin interfaceTwoStepMapper<K,V>
-
getCache
-