- java.lang.Object
-
- org.ojalgo.type.function.TwoStepMapper.SimpleCache<K,V>
-
- All Implemented Interfaces:
TwoStepMapper<K,java.util.Map<K,V>>,TwoStepMapper.Combineable<K,java.util.Map<K,V>,TwoStepMapper.SimpleCache<K,V>>,TwoStepMapper.Mergeable<K,java.util.Map<K,V>>
- Enclosing interface:
- TwoStepMapper<T,R>
public static final class TwoStepMapper.SimpleCache<K,V> extends java.lang.Object implements TwoStepMapper.Combineable<K,java.util.Map<K,V>,TwoStepMapper.SimpleCache<K,V>>, TwoStepMapper.Mergeable<K,java.util.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>
-
-
Constructor Summary
Constructors Constructor Description SimpleCache(java.util.function.Function<K,V> function)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcombine(TwoStepMapper.SimpleCache<K,V> other)This method can be used to combine the state of multiple instances.voidconsume(K item)Input/consume the items that should be mapped(package private) java.util.Map<K,V>getCache()java.util.Map<K,V>getResults()Output the mapped resultsvoidmerge(java.util.Map<K,V> other)This method can be used to merge the results from multiple instances.voidreset()Reset, so it can be re-used
-
-
-
Method Detail
-
combine
public void combine(TwoStepMapper.SimpleCache<K,V> other)
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,java.util.Map<K,V>,TwoStepMapper.SimpleCache<K,V>>
-
consume
public void consume(K item)
Description copied from interface:TwoStepMapperInput/consume the items that should be mapped- Specified by:
consumein interfaceTwoStepMapper<K,V>
-
getResults
public java.util.Map<K,V> getResults()
Description copied from interface:TwoStepMapperOutput the mapped results- Specified by:
getResultsin interfaceTwoStepMapper<K,V>
-
merge
public void merge(java.util.Map<K,V> other)
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>
-
-