com.yobotics.simulationconstructionset
Class YoVariableRegistry

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariableRegistry
All Implemented Interfaces:
YoVariableHolder, java.io.Serializable

public final class YoVariableRegistry
extends java.lang.Object
implements YoVariableHolder, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
YoVariableRegistry(java.lang.String name)
           
YoVariableRegistry(java.lang.String name, boolean isLogged, boolean isSent)
           
 
Method Summary
 void addChild(YoVariableRegistry child)
           
 boolean areEqual(YoVariableRegistry registry)
           
 void attachYoVariableRegistryChangedListener(YoVariableRegistryChangedListener listener)
           
 void clear()
           
 VarList createVarList()
           
 java.util.ArrayList<VarList> createVarListsIncludingChildren()
           
 java.util.ArrayList<YoVariableRegistry> getAllRegistriesIncludingChildren()
           
 java.util.ArrayList<SimulationRewoundListener> getAllSimulationRewoundListeners()
           
 java.util.ArrayList<YoVariable> getAllVariables()
          Returns all the YoVariables in this YoVariableHolder
 YoVariable[] getAllVariablesArray()
          Returns all the YoVariables in this YoVariableHolder
 java.util.ArrayList<YoVariable> getAllVariablesIncludingDescendants()
           
 java.util.ArrayList<YoVariable> getAllVariablesInThisListOnly()
           
 java.util.ArrayList<YoVariableRegistry> getChildren()
           
 java.util.ArrayList<YoVariable> getMatchingVariables(java.lang.String[] names, java.lang.String[] regularExpressions)
           
 java.lang.String getName()
           
 NameSpace getNameSpace()
           
 int getNumberOfYoVariables()
           
 YoVariableRegistry getOrCreateAndAddRegistry(NameSpace fullNameSpace)
           
 YoVariableRegistry getParent()
           
 YoVariableRegistry getRegistry(NameSpace fullNameSpace)
           
 YoVariable getVariable(java.lang.String name)
          Gets a YoVariable with the given name if it is in this YoVariableHolder, otherwise returns null.
 YoVariable getVariable(java.lang.String nameSpace, java.lang.String name)
          Gets a YoVariable with the given nameSpace and name if it is in this YoVariableHolder, otherwise returns null.
 void getVariables(java.util.ArrayList<YoVariable> listToPack, java.lang.String name)
           
 java.util.ArrayList<YoVariable> getVariables(NameSpace nameSpace)
          Returns all the YoVariables with the given nameSpace that are in this YoVariableHolder, empty if there are none.
 java.util.ArrayList<YoVariable> getVariables(java.lang.String name)
          Returns all the YoVariables with the given name that are in this YoVariableHolder, empty if there are none.
 java.util.ArrayList<YoVariable> getVariables(java.lang.String nameSpace, java.lang.String name)
          Returns all the YoVariables with the given nameSpace and name that are in this YoVariableHolder, empty if there are none.
 YoVariable getYoVariable(int index)
           
 boolean hasUniqueVariable(java.lang.String name)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given name.
 boolean hasUniqueVariable(java.lang.String nameSpace, java.lang.String name)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given nameSpace and name.
 boolean isDisallowSendingSet()
           
 boolean isLogged()
           
 boolean isSent()
           
 void printAllVariablesIncludingDescendants(java.io.PrintStream out)
           
 void registerSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)
           
 void registerVariable(YoVariable variable)
           
 void setDisallowSending()
           
 void setLogging(boolean log)
           
 void setLoggingIncludingDescendants(boolean log)
           
 void setSending(boolean send)
           
 void setSendingIncludingDescendants(boolean send)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

YoVariableRegistry

public YoVariableRegistry(java.lang.String name)

YoVariableRegistry

public YoVariableRegistry(java.lang.String name,
                          boolean isLogged,
                          boolean isSent)
Method Detail

getName

public java.lang.String getName()

getNameSpace

public NameSpace getNameSpace()

attachYoVariableRegistryChangedListener

public void attachYoVariableRegistryChangedListener(YoVariableRegistryChangedListener listener)

registerSimulationRewoundListener

public void registerSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)

getAllSimulationRewoundListeners

public java.util.ArrayList<SimulationRewoundListener> getAllSimulationRewoundListeners()

registerVariable

public void registerVariable(YoVariable variable)

getAllVariablesInThisListOnly

public java.util.ArrayList<YoVariable> getAllVariablesInThisListOnly()

getAllVariablesIncludingDescendants

public java.util.ArrayList<YoVariable> getAllVariablesIncludingDescendants()

getAllVariablesArray

public YoVariable[] getAllVariablesArray()
Description copied from interface: YoVariableHolder
Returns all the YoVariables in this YoVariableHolder

Specified by:
getAllVariablesArray in interface YoVariableHolder
Returns:
YoVariable[]

createVarList

public VarList createVarList()

getVariable

public YoVariable getVariable(java.lang.String nameSpace,
                              java.lang.String name)
Description copied from interface: YoVariableHolder
Gets a YoVariable with the given nameSpace and name if it is in this YoVariableHolder, otherwise returns null. If name contains a ".", then throws a RuntimeException. If there is more than one YoVariable that matches, then throws a RuntimeException.

Specified by:
getVariable in interface YoVariableHolder
Parameters:
nameSpace - String nameSpaceEnding ending of YoVariable to get. The YoVariable's nameSpace ending must match that of nameSpace.
name - String Name of YoVariable to get. If contains a ".", then throws a RuntimeException.
Returns:
YoVariable matching the given nameSpace and name.

getVariable

public YoVariable getVariable(java.lang.String name)
Description copied from interface: YoVariableHolder
Gets a YoVariable with the given name if it is in this YoVariableHolder, otherwise returns null. If name contains a ".", then the YoVariable's nameSpace ending must match that of name. If there is more than one YoVariable that matches, then throws a RuntimeException.

Specified by:
getVariable in interface YoVariableHolder
Parameters:
name - String Name of YoVariable to get. If contains a ".", then YoVariable's nameSpace ending must match that of name.
Returns:
YoVariable matching the given name.

getVariables

public java.util.ArrayList<YoVariable> getVariables(java.lang.String nameSpace,
                                                    java.lang.String name)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given nameSpace and name that are in this YoVariableHolder, empty if there are none. If name contains a ".", then throws a RuntimeException.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
nameSpace - String NameSpace ending of YoVariables to get. The YoVariable's nameSpace ending must match that of nameSpace.
name - String Name of YoVariable to get. If contains a ".", then throws a RuntimeException.
Returns:
ArrayList matching the given nameSpace and name.

getVariables

public java.util.ArrayList<YoVariable> getVariables(java.lang.String name)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given name that are in this YoVariableHolder, empty if there are none. If name contains a ".", then the YoVariable's nameSpace ending must match that of name.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
name - String Name of YoVariable to get. If name contains a ".", then the YoVariable's nameSpace ending must match that of name.
Returns:
ArrayList matching the given name.

getVariables

public void getVariables(java.util.ArrayList<YoVariable> listToPack,
                         java.lang.String name)

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String nameSpace,
                                 java.lang.String name)
Description copied from interface: YoVariableHolder
Checks if this YoVariableHolder holds exactly one YoVariable with the given nameSpace and name. If so, returns true, otherwise returns false. If name contains a ".", then throws a RuntimeException. If there is more than one YoVariable that matches, returns false.

Specified by:
hasUniqueVariable in interface YoVariableHolder
Parameters:
nameSpace - String NameSpace ending of YoVariable to check for. The YoVariable's nameSpace ending must match that of nameSpace.
name - String Name of YoVariable to check for. If contains a ".", then throws a RuntimeException.
Returns:
boolean Whether or not this YoVariableHolder holds exactly one Variable that matches the given nameSpace and name.

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String name)
Description copied from interface: YoVariableHolder
Checks if this YoVariableHolder holds exactly one YoVariable with the given name. If so, returns true, otherwise returns false. If name contains a ".", then the YoVariable's nameSpace ending must match that of name. If there is more than one YoVariable that matches, returns false.

Specified by:
hasUniqueVariable in interface YoVariableHolder
Parameters:
name - String Name of YoVariable to check for. If contains a ".", then YoVariable's nameSpace ending must match that of name.
Returns:
boolean Whether or not this YoVariableHolder holds exactly one Variable of the given name.

addChild

public void addChild(YoVariableRegistry child)

getChildren

public java.util.ArrayList<YoVariableRegistry> getChildren()

getParent

public YoVariableRegistry getParent()

createVarListsIncludingChildren

public java.util.ArrayList<VarList> createVarListsIncludingChildren()

getAllRegistriesIncludingChildren

public java.util.ArrayList<YoVariableRegistry> getAllRegistriesIncludingChildren()

clear

public void clear()

toString

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

getOrCreateAndAddRegistry

public YoVariableRegistry getOrCreateAndAddRegistry(NameSpace fullNameSpace)

getRegistry

public YoVariableRegistry getRegistry(NameSpace fullNameSpace)

setLogging

public void setLogging(boolean log)

setLoggingIncludingDescendants

public void setLoggingIncludingDescendants(boolean log)

isLogged

public boolean isLogged()

setDisallowSending

public void setDisallowSending()

setSending

public void setSending(boolean send)

setSendingIncludingDescendants

public void setSendingIncludingDescendants(boolean send)

isDisallowSendingSet

public boolean isDisallowSendingSet()

isSent

public boolean isSent()

getNumberOfYoVariables

public int getNumberOfYoVariables()

getYoVariable

public YoVariable getYoVariable(int index)

printAllVariablesIncludingDescendants

public void printAllVariablesIncludingDescendants(java.io.PrintStream out)

getAllVariables

public java.util.ArrayList<YoVariable> getAllVariables()
Description copied from interface: YoVariableHolder
Returns all the YoVariables in this YoVariableHolder

Specified by:
getAllVariables in interface YoVariableHolder
Returns:
ArrayList

getVariables

public java.util.ArrayList<YoVariable> getVariables(NameSpace nameSpace)
Description copied from interface: YoVariableHolder
Returns all the YoVariables with the given nameSpace that are in this YoVariableHolder, empty if there are none.

Specified by:
getVariables in interface YoVariableHolder
Parameters:
nameSpace - NameSpace to match.
Returns:
ArrayList matching YoVariables.

getMatchingVariables

public java.util.ArrayList<YoVariable> getMatchingVariables(java.lang.String[] names,
                                                            java.lang.String[] regularExpressions)

areEqual

public boolean areEqual(YoVariableRegistry registry)