Package org.yamcs.parameter
Class LastValueCache
- java.lang.Object
-
- org.yamcs.parameter.LastValueCache
-
public class LastValueCache extends Object
Cache for the last known value of each parameter. thread safe
-
-
Constructor Summary
Constructors Constructor Description LastValueCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterValue
getValue(Parameter p)
Returns the latest known value for p or null if there is none.Collection<ParameterValue>
getValues()
returns all the values from the cacheParameterValue
put(Parameter p, ParameterValue pv)
Puts a new value in the map.int
size()
void
update(Collection<ParameterValue> params)
Update the cache with all parameters.
-
-
-
Method Detail
-
getValue
public ParameterValue getValue(Parameter p)
Returns the latest known value for p or null if there is none.- Parameters:
p
-- Returns:
-
put
public ParameterValue put(Parameter p, ParameterValue pv)
Puts a new value in the map.- Parameters:
p
-pv
-- Returns:
- the previous value or null if there was none.
-
update
public void update(Collection<ParameterValue> params)
Update the cache with all parameters.Note: This is not an atomic operation!
- Parameters:
params
-
-
size
public int size()
-
getValues
public Collection<ParameterValue> getValues()
returns all the values from the cache- Returns:
-
-