Package nl.tue.id.oocsi
Class OOCSIFloat
java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<T>
nl.tue.id.oocsi.client.data.OOCSIVariable<java.lang.Float>
nl.tue.id.oocsi.OOCSIFloat
public class OOCSIFloat extends OOCSIVariable<java.lang.Float>
OOCSIFloat is a system-level primitive that allows for automatic synchronizing of local variables (read and write)
with different OOCSI clients on the same channel. This realizes synchronization on a single data variable without
aggregation.
- Author:
- matsfunk
-
Nested Class Summary
Nested classes/interfaces inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
OOCSISystemCommunicator.SystemFilter<K>
-
Field Summary
Fields inherited from class nl.tue.id.oocsi.client.data.OOCSIVariable
forwarders, lastInput, max, mean, min, sigma, values, windowLength
Fields inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
channelName, client, HANDLE
-
Constructor Summary
Constructors Constructor Description OOCSIFloat(float referenceValue, int timeout)
OOCSIFloat(OOCSIClient client, java.lang.String channelName, java.lang.String key)
OOCSIFloat(OOCSIClient client, java.lang.String channelName, java.lang.String key, float referenceValue)
OOCSIFloat(OOCSIClient client, java.lang.String channelName, java.lang.String key, float referenceValue, int timeout)
-
Method Summary
Modifier and Type Method Description protected java.lang.Float
adapt(java.lang.Float var)
adaptation of the variable based on the recent history (values) and the newly entered variable settingvoid
connect(OOCSIVariable<java.lang.Float> forward)
connect the given variable to this variable, so whenever this variable is set, the connected given variable will be set as wellvoid
disconnect(OOCSIVariable<java.lang.Float> forward)
disconnect the given variable from this variable; no more events will be sentprotected java.lang.Float
extractValue(OOCSIEvent event, java.lang.String key)
safely extract the message value in the right typeprotected java.lang.Float
filter(java.lang.Float var)
filter the newly entered variable setting (if variable type is numerical, this could be a min/max filter and additional filtering based on the standard deviation, or a different filter)OOCSIFloat
generator(long periodMS)
creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally).OOCSIFloat
generator(long periodMS, java.lang.String outputChannel, java.lang.String outputKey)
creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally).java.lang.Float
get()
retrieve the current value of the variable (will check for expiration if a timeout is given; in this case the reference value is set)OOCSIFloat
limit(int rate, int seconds)
set the limiting of incoming events in terms of "rate" and "seconds" timeframe; supports chained invocationOOCSIFloat
max(java.lang.Float max)
set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocationOOCSIFloat
min(java.lang.Float min)
set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocationOOCSIFloat
reference(java.lang.Float reference)
set the reference value (also possible during operation); supports chained invocationOOCSIFloat
smooth(int windowLength)
set the length of the smoothing window, i.e., the buffer of historical values of this variable (also possible during operation, however, this will reset the buffer); supports chained invocationOOCSIFloat
smooth(int windowLength, java.lang.Float sigma)
set the length of the smoothing window, i.e., the buffer of historical values of this variable (also possible during operation, however, this will reset the buffer); supports chained invocation.OOCSIFloat
timeout(int timeoutMS)
set the timeout in milliseconds (also possible during operation); supports chained invocationMethods inherited from class nl.tue.id.oocsi.client.data.OOCSIVariable
fresh, last, localUpdate, reference, remoteUpdate, set, set, update
Methods inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
addFilter, getHandle, message, message, message, subscribe, triggerHandler, updateFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
OOCSIFloat
-
OOCSIFloat
public OOCSIFloat(OOCSIClient client, java.lang.String channelName, java.lang.String key, float referenceValue) -
OOCSIFloat
public OOCSIFloat(OOCSIClient client, java.lang.String channelName, java.lang.String key, float referenceValue, int timeout) -
OOCSIFloat
public OOCSIFloat(float referenceValue, int timeout)
-
-
Method Details
-
get
public java.lang.Float get()Description copied from class:OOCSIVariable
retrieve the current value of the variable (will check for expiration if a timeout is given; in this case the reference value is set)- Overrides:
get
in classOOCSIVariable<java.lang.Float>
- Returns:
-
extractValue
Description copied from class:OOCSIVariable
safely extract the message value in the right type- Overrides:
extractValue
in classOOCSIVariable<java.lang.Float>
- Returns:
-
filter
protected java.lang.Float filter(java.lang.Float var)Description copied from class:OOCSIVariable
filter the newly entered variable setting (if variable type is numerical, this could be a min/max filter and additional filtering based on the standard deviation, or a different filter)- Overrides:
filter
in classOOCSIVariable<java.lang.Float>
- Returns:
-
adapt
protected java.lang.Float adapt(java.lang.Float var)Description copied from class:OOCSIVariable
adaptation of the variable based on the recent history (values) and the newly entered variable setting- Overrides:
adapt
in classOOCSIVariable<java.lang.Float>
- Returns:
-
reference
set the reference value (also possible during operation); supports chained invocation- Overrides:
reference
in classOOCSIVariable<java.lang.Float>
- Parameters:
reference
-- Returns:
-
timeout
set the timeout in milliseconds (also possible during operation); supports chained invocation- Overrides:
timeout
in classOOCSIVariable<java.lang.Float>
- Parameters:
timeoutMS
-- Returns:
-
limit
set the limiting of incoming events in terms of "rate" and "seconds" timeframe; supports chained invocation- Overrides:
limit
in classOOCSIVariable<java.lang.Float>
- Parameters:
rate
-seconds
-- Returns:
-
min
set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocation- Overrides:
min
in classOOCSIVariable<java.lang.Float>
- Parameters:
min
-- Returns:
-
max
set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocation- Overrides:
max
in classOOCSIVariable<java.lang.Float>
- Parameters:
max
-- Returns:
-
smooth
set the length of the smoothing window, i.e., the buffer of historical values of this variable (also possible during operation, however, this will reset the buffer); supports chained invocation- Overrides:
smooth
in classOOCSIVariable<java.lang.Float>
- Parameters:
windowLength
-- Returns:
-
smooth
set the length of the smoothing window, i.e., the buffer of historical values of this variable (also possible during operation, however, this will reset the buffer); supports chained invocation. the parameter sigma sets the upper bound for the standard deviation protected variable- Overrides:
smooth
in classOOCSIVariable<java.lang.Float>
- Parameters:
windowLength
-sigma
-- Returns:
-
generator
creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally). If there is no reference value set, the former applies. The period is given in milliseconds.- Overrides:
generator
in classOOCSIVariable<java.lang.Float>
- Parameters:
periodMS
-- Returns:
-
generator
public OOCSIFloat generator(long periodMS, java.lang.String outputChannel, java.lang.String outputKey)creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally). If there is no reference value set, the former applies. The period is given in milliseconds. In addition, the new value of the variable is sent out to the channel "outputChannel" with the given key "outputKey"- Overrides:
generator
in classOOCSIVariable<java.lang.Float>
- Parameters:
periodMS
-outputChannel
-outputKey
-- Returns:
-
connect
Description copied from class:OOCSIVariable
connect the given variable to this variable, so whenever this variable is set, the connected given variable will be set as well- Overrides:
connect
in classOOCSIVariable<java.lang.Float>
-
disconnect
Description copied from class:OOCSIVariable
disconnect the given variable from this variable; no more events will be sent- Overrides:
disconnect
in classOOCSIVariable<java.lang.Float>
-