Package nl.tue.id.oocsi.client.behavior

# Class OOCSIVariable<T>

java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<T>
nl.tue.id.oocsi.client.behavior.OOCSIVariable<T>

Type Parameters:
  `T` -

    public class OOCSIVariable<T>
    extends OOCSISystemCommunicator<T>

OOCSIVariable 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. OOCSIVariable is a parametrized class, that means, once the data type is set it can reliably used in reading and writing.

Author:
  mathias

- ## 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.behavior.OOCSISystemCommunicator

  `channelName, client, HANDLE`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key)` | Constructor for a simple OOCSI variable to sync on a given channel and key
  `OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key, T referenceValue)` | Constructor for a simple OOCSI variable to sync on a given channel and key, in case no value can be retrieved from the channel a reference value is provided which will be set automatically after a timeout of 2000 ms (2 seconds)
  `OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key, T referenceValue, int timeout)` | Constructor for a simple OOCSI variable to sync on a given channel and key, in case no value can be retrieved from the channel a reference value is provided which will be set automatically after the given timeout

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `T` | `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)
  `void` | `set​(T var)` | set the variable and let the channel know

  ### 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

  - ### OOCSIVariable

    public OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key)
    Constructor for a simple OOCSI variable to sync on a given channel and key
    Parameters:
      `client` -
      `channelName` -
      `key` -

  - ### OOCSIVariable

    public OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key, T referenceValue)
    Constructor for a simple OOCSI variable to sync on a given channel and key, in case no value can be retrieved from the channel a reference value is provided which will be set automatically after a timeout of 2000 ms (2 seconds)
    Parameters:
      `client` -
      `channelName` -
      `key` -
      `referenceValue` -

  - ### OOCSIVariable

    public OOCSIVariable​(OOCSIClient client, java.lang.String channelName, java.lang.String key, T referenceValue, int timeout)
    Constructor for a simple OOCSI variable to sync on a given channel and key, in case no value can be retrieved from the channel a reference value is provided which will be set automatically after the given timeout
    Parameters:
      `client` -
      `channelName` -
      `key` -
      `referenceValue` -
      `timeout` -

- ## Method Details

  - ### get

    public T 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)
    Returns:

  - ### set

    public void set​(T var)
    set the variable and let the channel know
    Parameters:
      `var` -