Class OOCSIInt

java.lang.Object

public class OOCSIInt
extends OOCSIVariable<java.lang.Integer>
OOCSIInt 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
    OOCSIInt​(int referenceValue, int timeout)  
    OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key)  
    OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key, int referenceValue)  
    OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key, int referenceValue, int timeout)  
  • Method Summary

    Modifier and Type Method Description
    protected java.lang.Integer adapt​(java.lang.Integer var)
    adaptation of the variable based on the recent history (values) and the newly entered variable setting
    void connect​(OOCSIVariable<java.lang.Integer> 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.Integer> forward)
    disconnect the given variable from this variable; no more events will be sent
    protected java.lang.Integer extractValue​(OOCSIEvent event, java.lang.String key)
    safely extract the message value in the right type
    protected java.lang.Integer filter​(java.lang.Integer 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)
    OOCSIInt generator​(long periodMS)
    creates a periodic feedback loop that feed either the last input value or the reference value into the variable (locally).
    OOCSIInt 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.Integer 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)
    OOCSIInt limit​(int rate, int seconds)
    set the limiting of incoming events in terms of "rate" and "seconds" timeframe; supports chained invocation
    OOCSIInt max​(java.lang.Integer max)
    set the maximum value for (upper-)bounded variable (also possible during operation); supports chained invocation
    OOCSIInt min​(java.lang.Integer min)
    set the minimum value for (lower-)bounded variable (also possible during operation); supports chained invocation
    OOCSIInt reference​(java.lang.Integer reference)
    set the reference value (also possible during operation); supports chained invocation
    OOCSIInt 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
    OOCSIInt smooth​(int windowLength, java.lang.Integer 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.
    OOCSIInt 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

    • OOCSIInt

      public OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key)
    • OOCSIInt

      public OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key, int referenceValue)
    • OOCSIInt

      public OOCSIInt​(OOCSIClient client, java.lang.String channelName, java.lang.String key, int referenceValue, int timeout)
    • OOCSIInt

      public OOCSIInt​(int referenceValue, int timeout)
      Parameters:
      referenceValue -
      timeout -
  • Method Details

    • get

      public java.lang.Integer 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.Integer>
      Returns:
    • extractValue

      protected java.lang.Integer 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.Integer>
      Returns:
    • filter

      protected java.lang.Integer filter​(java.lang.Integer 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.Integer>
      Returns:
    • adapt

      protected java.lang.Integer adapt​(java.lang.Integer 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.Integer>
      Returns:
    • reference

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

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

      public OOCSIInt 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.Integer>
      Parameters:
      rate -
      seconds -
      Returns:
    • min

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

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

      public OOCSIInt 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.Integer>
      Parameters:
      windowLength -
      Returns:
    • smooth

      public OOCSIInt smooth​(int windowLength, java.lang.Integer 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.Integer>
      Parameters:
      windowLength -
      sigma -
      Returns:
    • generator

      public OOCSIInt 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.Integer>
      Parameters:
      periodMS -
      Returns:
    • generator

      public OOCSIInt 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.Integer>
      Parameters:
      periodMS -
      outputChannel -
      outputKey -
      Returns:
    • connect

      public void connect​(OOCSIVariable<java.lang.Integer> 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.Integer>
    • disconnect

      public void disconnect​(OOCSIVariable<java.lang.Integer> 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.Integer>