Package nl.tue.id.oocsi
Class OOCSILong
java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<T>
nl.tue.id.oocsi.client.data.OOCSIVariable<java.lang.Long>
nl.tue.id.oocsi.OOCSILong
public class OOCSILong extends OOCSIVariable<java.lang.Long>
OOCSILong 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 OOCSILong(long referenceValue, int timeout)
OOCSILong(OOCSIClient client, java.lang.String channelName, java.lang.String key)
OOCSILong(OOCSIClient client, java.lang.String channelName, java.lang.String key, long referenceValue)
OOCSILong(OOCSIClient client, java.lang.String channelName, java.lang.String key, long referenceValue, int timeout)
-
Method Summary
Modifier and Type Method Description protected java.lang.Long
adapt(java.lang.Long var)
adaptation of the variable based on the recent history (values) and the newly entered variable settingvoid
connect(OOCSIVariable<java.lang.Long> 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.Long> forward)
disconnect the given variable from this variable; no more events will be sentprotected java.lang.Long
extractValue(OOCSIEvent event, java.lang.String key)
safely extract the message value in the right typeprotected java.lang.Long
filter(java.lang.Long 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)OOCSILong
generator(long periodMS)
creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally).OOCSILong
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.Long
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)OOCSILong
limit(int rate, int seconds)
set the limiting of incoming events in terms of "rate" and "seconds" timeframe; supports chained invocationOOCSILong
max(java.lang.Long max)
set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocationOOCSILong
min(java.lang.Long min)
set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocationOOCSILong
reference(java.lang.Long reference)
set the reference value (also possible during operation); supports chained invocationOOCSILong
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 invocationOOCSILong
smooth(int windowLength, java.lang.Long 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.OOCSILong
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
-
OOCSILong
-
OOCSILong
public OOCSILong(OOCSIClient client, java.lang.String channelName, java.lang.String key, long referenceValue) -
OOCSILong
public OOCSILong(OOCSIClient client, java.lang.String channelName, java.lang.String key, long referenceValue, int timeout) -
OOCSILong
public OOCSILong(long referenceValue, int timeout)
-
-
Method Details
-
get
public java.lang.Long 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.Long>
- Returns:
-
extractValue
Description copied from class:OOCSIVariable
safely extract the message value in the right type- Overrides:
extractValue
in classOOCSIVariable<java.lang.Long>
- Returns:
-
filter
protected java.lang.Long filter(java.lang.Long 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.Long>
- Returns:
-
adapt
protected java.lang.Long adapt(java.lang.Long 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.Long>
- Returns:
-
reference
set the reference value (also possible during operation); supports chained invocation- Overrides:
reference
in classOOCSIVariable<java.lang.Long>
- Parameters:
reference
-- Returns:
-
timeout
set the timeout in milliseconds (also possible during operation); supports chained invocation- Overrides:
timeout
in classOOCSIVariable<java.lang.Long>
- 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.Long>
- 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.Long>
- 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.Long>
- 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.Long>
- 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.Long>
- 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.Long>
- Parameters:
periodMS
-- Returns:
-
generator
public OOCSILong 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.Long>
- 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.Long>
-
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.Long>
-