Package jasima.core.util
Interface ValueStore
-
- All Known Subinterfaces:
SimComponent,SimComponentContainer
- All Known Implementing Classes:
AbstractMultiConfExperiment,AbstractMultiExperiment,Batch,DynamicJobSource,DynamicShopExperiment,Experiment,FullFactorialExperiment,Job,JobSource,MimacExperiment,MultipleConfigurationExperiment,MultipleReplicationExperiment,OCBAExperiment,PrioRuleTarget,RandomFractionalExperiment,Shop,ShopExperiment,SimComponentBase,SimComponentContainerBase,SimComponentRoot,SimEntity,Simulation,SimulationExperiment,StaticJobSource,StaticShopExperiment,ValueStoreImpl,WorkStation
public interface ValueStoreThis interface provides a simple get/put-mechanism to store a value associated with a key object, similar to a @linkMap.- Author:
- Torsten Hildebrandt
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static booleancopy(ValueStore from, ValueStore to, String valueName)Copies a value (shallow copy) from one value store to another using the same name.default booleanvalueStoreContains(Object key)Check for the existence of a certain key.default ObjectvalueStoreGet(Object key)Retrieves a value from the value store.default ObjectvalueStoreGet(Object key, Object defaultValue)Retrieves a value from the value store.default Set<Object>valueStoreGetAllKeys()Returns a list of all keys contained in this value store.default intvalueStoreGetNumKeys()Returns the number of keys in this value store.ValueStorevalueStoreImpl()Returns the implementation to use for adding ValueStore functionality.default <T> TvalueStorePut(Object key, T value)Puts a value in the value store, potentially overwriting an existing value associated with the same key.default ObjectvalueStoreRemove(Object key)Removes an entry from this value store.default ObjectvalueStoreUpdate(Object key, Function<Object,Object> func)Applies the given function to the old value associated withkey(null if not existing), and stores the new, computed value in the value store.
-
-
-
Method Detail
-
valueStorePut
default <T> T valueStorePut(Object key, T value)
Puts a value in the value store, potentially overwriting an existing value associated with the same key.- Parameters:
key- The key name.value- value to assign tokey.- Returns:
- returns
valueto allow chaining calls. - See Also:
valueStoreGet(Object)
-
valueStoreGet
default Object valueStoreGet(Object key)
Retrieves a value from the value store.- Parameters:
key- The entry to return, e.g., identified by a name.- Returns:
- The value associated with
key. - See Also:
valueStorePut(Object, Object)
-
valueStoreGet
default Object valueStoreGet(Object key, Object defaultValue)
Retrieves a value from the value store. If no such value is contained in the valueStore or the value null is associated withkey, the default value is returned.- Parameters:
key- The entry to return, e.g., identified by a name.defaultValue- The default value to use.- Returns:
- The value associated with
keyordefaultValueif no value was associated. - See Also:
valueStorePut(Object, Object)
-
valueStoreUpdate
default Object valueStoreUpdate(Object key, Function<Object,Object> func)
Applies the given function to the old value associated withkey(null if not existing), and stores the new, computed value in the value store.- Parameters:
key- The key to access.func- The function to apply to the old value, calculating the new one.- Returns:
- The new value as produced by
func.
-
valueStoreContains
default boolean valueStoreContains(Object key)
Check for the existence of a certain key.- Parameters:
key- The key, usually identified by a name.- Returns:
- Returns true, if a non-null value is associated with
key.
-
valueStoreGetNumKeys
default int valueStoreGetNumKeys()
Returns the number of keys in this value store.
-
valueStoreGetAllKeys
default Set<Object> valueStoreGetAllKeys()
Returns a list of all keys contained in this value store.
-
valueStoreRemove
default Object valueStoreRemove(Object key)
Removes an entry from this value store.- Returns:
- The value previously associated with "key", or null, if no such key was found.
-
valueStoreImpl
ValueStore valueStoreImpl()
Returns the implementation to use for adding ValueStore functionality.
-
copy
static boolean copy(ValueStore from, ValueStore to, String valueName)
Copies a value (shallow copy) from one value store to another using the same name.
-
-