com.yobotics.simulationconstructionset
Class YoVariableHolderImplementation

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariableHolderImplementation
All Implemented Interfaces:
YoVariableHolder
Direct Known Subclasses:
DataBuffer

public class YoVariableHolderImplementation
extends java.lang.Object
implements YoVariableHolder

Title: YoVariableHolderImplementation

Description: An implementation of a YoVariableHolder.

Copyright: Copyright (c) 2009

Company: Yobotics, Inc. and IHMC

Version:
1.0
Author:
not attributable

Constructor Summary
YoVariableHolderImplementation()
           
 
Method Summary
 void addVariablesToHolder(java.util.ArrayList<YoVariable> variables)
          Adds the given YoVariables to this YoVariableHolder.
 void addVariableToHolder(YoVariable variable)
          Adds the given YoVariable to this YoVariableHolder.
 java.util.ArrayList<YoVariable> getAllVariables()
          Returns all the YoVariables in this YoVariableHolder
 YoVariable[] getAllVariablesArray()
          Returns all the YoVariables in this YoVariableHolder
 YoVariable getVariable(java.lang.String fullname)
          Gets a YoVariable with the given name if it is in this YoVariableHolder, otherwise returns null.
 YoVariable getVariable(java.lang.String nameSpaceEnding, java.lang.String name)
          Gets a YoVariable with the given nameSpace and name if it is in this YoVariableHolder, otherwise returns null.
 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 fullname)
          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 nameSpaceEnding, 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 getVariableUsingFullNamespace(java.lang.String fullname)
           
 boolean hasUniqueVariable(java.lang.String fullname)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given name.
 boolean hasUniqueVariable(java.lang.String nameSpaceEnding, java.lang.String name)
          Checks if this YoVariableHolder holds exactly one YoVariable with the given nameSpace and name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YoVariableHolderImplementation

public YoVariableHolderImplementation()
Method Detail

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

getAllVariablesArray

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

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

addVariablesToHolder

public void addVariablesToHolder(java.util.ArrayList<YoVariable> variables)
Adds the given YoVariables to this YoVariableHolder. If any Variable is not unique, throws a RuntimeException.

Parameters:
variables - YoVariables to add to this YoVariableHolder

addVariableToHolder

public void addVariableToHolder(YoVariable variable)
Adds the given YoVariable to this YoVariableHolder. If this Variable is not unique, throws a RuntimeException.

Parameters:
variable - YoVariable to add to this YoVariableHolder

getVariableUsingFullNamespace

public YoVariable getVariableUsingFullNamespace(java.lang.String fullname)

getVariable

public YoVariable getVariable(java.lang.String fullname)
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:
fullname - 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.

getVariable

public YoVariable getVariable(java.lang.String nameSpaceEnding,
                              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:
nameSpaceEnding - 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.

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String fullname)
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:
fullname - 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.

hasUniqueVariable

public boolean hasUniqueVariable(java.lang.String nameSpaceEnding,
                                 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:
nameSpaceEnding - 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.

getVariables

public java.util.ArrayList<YoVariable> getVariables(java.lang.String nameSpaceEnding,
                                                    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:
nameSpaceEnding - 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 fullname)
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:
fullname - 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 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.