java.lang.Object
org.yamcs.parameter.LastValueCache
Cache for the last known value of each parameter.
Can also stored a number of n values for certain parameters (required by algorithms and match criterias)
it uses a readwrite lock to synchronize access from multiple threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ParameterValue pv) Adds a new value.voidaddAll(Collection<ParameterValue> newValues) Add all parameters to the cachevoidenableBuffering(Parameter param, int capacity) Configure the parameter cache to remember at least capacity values for the parameter.Returns the latest known value for p or null if there is none.return the n'th newest value or null if no such a value exist. n has to be smaller or equal with 0.returns all the values from the cacheintsize()
-
Constructor Details
-
LastValueCache
public LastValueCache() -
LastValueCache
-
-
Method Details
-
getValue
Returns the latest known value for p or null if there is none.- Parameters:
param-- Returns:
-
getValue
return the n'th newest value or null if no such a value exist. n has to be smaller or equal with 0.If n=0 it is equivalent with
getValue(Parameter)If n<0 but buffering is not enabled for the parameter or the buffer capacity is smaller than -n+1, an IllegalStateException will be thrown
- Throws:
IllegalArgumentException- if n>0 or if n<0 and the parameter is constantIllegalStateException- if buffering is not enabled or the buffer capacity is smaller than -n+1
-
enableBuffering
Configure the parameter cache to remember at least capacity values for the parameter.The size has to be at least 2 (because size 1 is by default)
- Throws:
IllegalArgumentException- if the capacity is smaller than 2 or the parameter is a constant.
-
add
Adds a new value. If buffering is enabled, the value is added to the buffer, otherwise it replaces the old value (if any)- Parameters:
pv-
-
addAll
Add all parameters to the cache- Parameters:
newValues-
-
size
public int size() -
getValues
returns all the values from the cache- Returns:
-