Class OOCSILong

java.lang.Object

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 setting
    void 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 well
    void disconnect​(OOCSIVariable<java.lang.Long> forward)
    disconnect the given variable from this variable; no more events will be sent
    protected java.lang.Long extractValue​(OOCSIEvent event, java.lang.String key)
    safely extract the message value in the right type
    protected 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 invocation
    OOCSILong max​(java.lang.Long max)
    set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocation
    OOCSILong min​(java.lang.Long min)
    set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocation
    OOCSILong reference​(java.lang.Long reference)
    set the reference value (also possible during operation); supports chained invocation
    OOCSILong 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 invocation
    OOCSILong 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 invocation

    Methods 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

      public OOCSILong​(OOCSIClient client, java.lang.String channelName, java.lang.String key)
    • 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 class OOCSIVariable<java.lang.Long>
      Returns:
    • extractValue

      protected java.lang.Long extractValue​(OOCSIEvent event, java.lang.String key)
      Description copied from class: OOCSIVariable
      safely extract the message value in the right type
      Overrides:
      extractValue in class OOCSIVariable<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 class OOCSIVariable<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 class OOCSIVariable<java.lang.Long>
      Returns:
    • reference

      public OOCSILong reference​(java.lang.Long reference)
      set the reference value (also possible during operation); supports chained invocation
      Overrides:
      reference in class OOCSIVariable<java.lang.Long>
      Parameters:
      reference -
      Returns:
    • timeout

      public OOCSILong timeout​(int timeoutMS)
      set the timeout in milliseconds (also possible during operation); supports chained invocation
      Overrides:
      timeout in class OOCSIVariable<java.lang.Long>
      Parameters:
      timeoutMS -
      Returns:
    • limit

      public OOCSILong limit​(int rate, int seconds)
      set the limiting of incoming events in terms of "rate" and "seconds" timeframe; supports chained invocation
      Overrides:
      limit in class OOCSIVariable<java.lang.Long>
      Parameters:
      rate -
      seconds -
      Returns:
    • min

      public OOCSILong min​(java.lang.Long min)
      set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocation
      Overrides:
      min in class OOCSIVariable<java.lang.Long>
      Parameters:
      min -
      Returns:
    • max

      public OOCSILong max​(java.lang.Long max)
      set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocation
      Overrides:
      max in class OOCSIVariable<java.lang.Long>
      Parameters:
      max -
      Returns:
    • smooth

      public OOCSILong 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 invocation
      Overrides:
      smooth in class OOCSIVariable<java.lang.Long>
      Parameters:
      windowLength -
      Returns:
    • smooth

      public OOCSILong 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. the parameter sigma sets the upper bound for the standard deviation protected variable
      Overrides:
      smooth in class OOCSIVariable<java.lang.Long>
      Parameters:
      windowLength -
      sigma -
      Returns:
    • generator

      public OOCSILong generator​(long periodMS)
      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 class OOCSIVariable<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 class OOCSIVariable<java.lang.Long>
      Parameters:
      periodMS -
      outputChannel -
      outputKey -
      Returns:
    • connect

      public void connect​(OOCSIVariable<java.lang.Long> forward)
      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 class OOCSIVariable<java.lang.Long>
    • disconnect

      public void disconnect​(OOCSIVariable<java.lang.Long> forward)
      Description copied from class: OOCSIVariable
      disconnect the given variable from this variable; no more events will be sent
      Overrides:
      disconnect in class OOCSIVariable<java.lang.Long>