java.lang.Object
java.util.AbstractMap<String,Variable>
java.util.TreeMap<String,Variable>
cern.nxcals.api.backport.domain.core.metadata.VariableSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Variable>, Map<String,Variable>, NavigableMap<String,Variable>, SequencedMap<String,Variable>, SortedMap<String,Variable>

public class VariableSet extends TreeMap<String,Variable> implements Iterable<Variable>
See Also:
  • Constructor Details

    • VariableSet

      public VariableSet(Variable variable)
      Creates a new variable set with a variable inside
      Parameters:
      variable - The Variable object to be added to the VariableSet.
    • VariableSet

      public VariableSet()
  • Method Details

    • from

      public static VariableSet from(Set<Variable> vars)
    • fromCalsVars

      public static VariableSet fromCalsVars(Set<Variable> vars)
    • collector

      public static Collector<Variable,VariableSet,VariableSet> collector()
    • getVariable

      public Variable getVariable(String name)
      Gets a Variable with the given name from the VariableSet if it exists.
      Parameters:
      name - - the name of the required Variable.
      Returns:
      the Variable with given name if it exists within the VariableSet. Returns null if does not exist.
    • getVariable

      @Deprecated public Variable getVariable(int idx)
      Deprecated.
      you should not try to obtain an n-th element of a set, even if it is an ordered set. Very inefficient.
      Gets a Variable from the given index in the VariableSet if it exists.
      Parameters:
      idx - - the index of the required Variable in the VariableSet.
      Returns:
      the Variable with given index if it exists within the VariableSet. Returns null if does not exist.
    • getVariableCount

      public int getVariableCount()
      Gets a count of the number of Variable objects within the VariableSet.
      Returns:
      a count of the number of Variable objects within the VariableSet.
    • getVariableNames

      public Set<String> getVariableNames()
      Get a set of the names of the Variable objects within the VariableSet.
      Returns:
      a set of the names of the Variable objects within the VariableSet.
    • getVariableDataTypes

      public Set<VariableDataType> getVariableDataTypes()
      Get a set of the distinct data types of the Variable objects within the VariableSet.
      Returns:
      a set of the distinct data types of the Variable objects within the VariableSet.
    • getVariables

      public Collection<Variable> getVariables()
      Gets a Collection of all the Variable objects within the VariableSet.
      Returns:
      - a Collection of all the Variable objects within the VariableSet.
    • addVariable

      public void addVariable(Variable variable)
      Adds the given Variable object to the VariableSet. If the variable already exists with a different datasource, the datasource is updated
      Parameters:
      variable - The Variable object to be added to the VariableSet.
    • containsVariable

      public boolean containsVariable(String name)
      Indicates whether of not this object contains a Variable with the given name.
      Parameters:
      name - - the name of the Variable object to search for.
      Returns:
      - true if this object is representing a Variable with the given name.
    • iterator

      public Iterator<Variable> iterator()
      Specified by:
      iterator in interface Iterable<Variable>
    • removeVariable

      public boolean removeVariable(String name)
      Removes the Variable with the given name from the VariableSet.
      Parameters:
      name - - the name of the Variable to be removed from the VariableSet.
      Returns:
      - true if the Variable with the given name was removed from the VariableSet.
    • removeAllVariables

      public void removeAllVariables()
      Removes all Variable objects from the VariableSet.
    • containsNumericVariables

      public boolean containsNumericVariables()
      Indicates whether of not this object contains one or more Variable objects of data type Numeric.
      Returns:
      - true if this object contains one or more Variable objects of data type Numeric.
    • containsVectorNumericVariables

      public boolean containsVectorNumericVariables()
      Indicates whether of not this object contains one or more Variable objects of data type VectorNumeric.
      Returns:
      - true if this object contains one or more Variable objects of data type VectorNumeric.
    • containsNumericStatusVariables

      public boolean containsNumericStatusVariables()
      Indicates whether of not this object contains one or more Variable objects of data type NumericStatus.
      Returns:
      - true if this object contains one or more Variable objects of data type NumericStatus.
    • containsStringVariables

      public boolean containsStringVariables()
      Indicates whether of not this object contains one or more Variable objects of data type String.
      Returns:
      - true if this object contains one or more Variable objects of data type String.
    • containsFundamentalVariables

      public boolean containsFundamentalVariables()
      Indicates whether of not this object contains one or more Variable objects of data type Fundamental.
      Returns:
      - true if this object contains one or more Variable objects of data type Fundamental.
    • getNumericVariables

      public Collection<Variable> getNumericVariables()
      Gets a Collection of all the NUMERIC Variable objects within the VariableSet.
      Returns:
      - a Collection of all the NUMERIC Variable objects within the VariableSet.
    • getNumericStatusVariables

      public Collection<Variable> getNumericStatusVariables()
      Gets a Collection of all the NUMERIC STATUS Variable objects within the VariableSet.
      Returns:
      - a Collection of all the NUMERIC STATUS Variable objects within the VariableSet.
    • getVectorNumericVariables

      public Collection<Variable> getVectorNumericVariables()
      Gets a Collection of all the VECTORNUMERIC Variable objects within the VariableSet.
      Returns:
      - a Collection of all the VECTORNUMERIC Variable objects within the VariableSet.
    • getStringVariables

      public Collection<Variable> getStringVariables()
      Gets a Collection of all the TEXT Variable objects within the VariableSet.
      Returns:
      - a Collection of all the TEXT Variable objects within the VariableSet.
    • getFundamentalVariables

      public Collection<Variable> getFundamentalVariables()
      Gets a Collection of all the FUNDAMENTAL Variable objects within the VariableSet.
      Returns:
      - a Collection of all the FUNDAMENTAL Variable objects within the VariableSet.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractMap<String,Variable>