jsynoptic.data
Class VariableAssociation

java.lang.Object
  extended by jsynoptic.data.VariableAssociation
All Implemented Interfaces:
VariableDefinition

public class VariableAssociation
extends java.lang.Object
implements VariableDefinition


Field Summary
 DataSource ds
           
protected  long usedIndex
          Set this field to a particular value to force using this data source index Setting to -1 returns to the default of using the data source last index This may be a good idea to synchronize on this object to ensure the specified value is not changed by another thread before the call(s) to getValue()
 java.lang.String var
           
 
Constructor Summary
VariableAssociation(DataSource ds, java.lang.String var)
           
 
Method Summary
 java.lang.String getName()
           
 java.lang.Number getValue()
           
 void lockIndex(long index)
          Locks the index used by this variable data source to some specific value.
 void releaseIndex()
          Release the lock this thread previously put on the index.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ds

public DataSource ds

var

public java.lang.String var

usedIndex

protected long usedIndex
Set this field to a particular value to force using this data source index Setting to -1 returns to the default of using the data source last index This may be a good idea to synchronize on this object to ensure the specified value is not changed by another thread before the call(s) to getValue()

Constructor Detail

VariableAssociation

public VariableAssociation(DataSource ds,
                           java.lang.String var)
Method Detail

lockIndex

public void lockIndex(long index)
Locks the index used by this variable data source to some specific value.
Only one thread can lock the index at a given time.
This method blocks until the thread can get the index lock.
Other threads may of course use the variable, but the index must be released first before it may be set again.
Typical use : lock index on all variables, node.evaluate(), release index on all variables

See Also:
releaseIndex

releaseIndex

public void releaseIndex()
Release the lock this thread previously put on the index.
It is the responsibility of the caller to ensure:


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Specified by:
getName in interface VariableDefinition
Returns:
this variable name. Used at parse time

getValue

public java.lang.Number getValue()
Specified by:
getValue in interface VariableDefinition
Returns:
this variable value. Used at evaluation time