Class VariableSet
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.TreeMap<java.lang.String,Variable>
-
- cern.nxcals.api.backport.domain.core.metadata.VariableSet
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<Variable>
,java.util.Map<java.lang.String,Variable>
,java.util.NavigableMap<java.lang.String,Variable>
,java.util.SortedMap<java.lang.String,Variable>
public class VariableSet extends java.util.TreeMap<java.lang.String,Variable> implements java.lang.Iterable<Variable>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VariableSet()
VariableSet(Variable variable)
Creates a new variable set with a variable inside
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addVariable(Variable variable)
Adds the given Variable object to the VariableSet.static java.util.stream.Collector<Variable,VariableSet,VariableSet>
collector()
boolean
containsFundamentalVariables()
Indicates whether of not this object contains one or more Variable objects of data type Fundamental.boolean
containsNumericStatusVariables()
Indicates whether of not this object contains one or more Variable objects of data type NumericStatus.boolean
containsNumericVariables()
Indicates whether of not this object contains one or more Variable objects of data type Numeric.boolean
containsStringVariables()
Indicates whether of not this object contains one or more Variable objects of data type String.boolean
containsVariable(java.lang.String name)
Indicates whether of not this object contains a Variable with the given name.boolean
containsVectorNumericVariables()
Indicates whether of not this object contains one or more Variable objects of data type VectorNumeric.static VariableSet
from(java.util.Set<Variable> vars)
static VariableSet
fromCalsVars(java.util.Set<Variable> vars)
java.util.Collection<Variable>
getFundamentalVariables()
Gets a Collection of all the FUNDAMENTAL Variable objects within the VariableSet.java.util.Collection<Variable>
getNumericStatusVariables()
Gets a Collection of all the NUMERIC STATUS Variable objects within the VariableSet.java.util.Collection<Variable>
getNumericVariables()
Gets a Collection of all the NUMERIC Variable objects within the VariableSet.java.util.Collection<Variable>
getStringVariables()
Gets a Collection of all the TEXT Variable objects within the VariableSet.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.Variable
getVariable(java.lang.String name)
Gets a Variable with the given name from the VariableSet if it exists.int
getVariableCount()
Gets a count of the number of Variable objects within the VariableSet.java.util.Set<VariableDataType>
getVariableDataTypes()
Get a set of the distinct data types of the Variable objects within the VariableSet.java.util.Set<java.lang.String>
getVariableNames()
Get a set of the names of the Variable objects within the VariableSet.java.util.Collection<Variable>
getVariables()
Gets a Collection of all the Variable objects within the VariableSet.java.util.Collection<Variable>
getVectorNumericVariables()
Gets a Collection of all the VECTORNUMERIC Variable objects within the VariableSet.java.util.Iterator<Variable>
iterator()
void
removeAllVariables()
Removes all Variable objects from the VariableSet.boolean
removeVariable(java.lang.String name)
Removes the Variable with the given name from the VariableSet.java.lang.String
toString()
-
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
-
-
-
-
Constructor Detail
-
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 Detail
-
from
public static VariableSet from(java.util.Set<Variable> vars)
-
fromCalsVars
public static VariableSet fromCalsVars(java.util.Set<Variable> vars)
-
collector
public static java.util.stream.Collector<Variable,VariableSet,VariableSet> collector()
-
getVariable
public Variable getVariable(java.lang.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 java.util.Set<java.lang.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 java.util.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 java.util.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(java.lang.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 java.util.Iterator<Variable> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Variable>
-
removeVariable
public boolean removeVariable(java.lang.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 java.util.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 java.util.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 java.util.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 java.util.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 java.util.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 java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractMap<java.lang.String,Variable>
-
-