Class VariableCollection
java.lang.Object
org.pipservices3.expressions.calculator.variables.VariableCollection
- All Implemented Interfaces:
IVariableCollection
Implements a variables list.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new variable to the collection.voidclear()Clears the collection.voidClears all stored variables (assigns null values).findByName(String name) Finds variable in the list by it's name.intfindIndexByName(String name) Finds variable index in the list by it's name.get(int index) Get a variable by its index.getAll()Get all variables stores in the collectionintlength()Gets a number of variables stored in the collection.Finds variable in the list or create a new one if variable was not found.voidremove(int index) Removes a variable by its index.voidremoveByName(String name) Removes variable by it's name.
-
Constructor Details
-
VariableCollection
public VariableCollection()
-
-
Method Details
-
add
Adds a new variable to the collection.- Specified by:
addin interfaceIVariableCollection- Parameters:
variable- a variable to be added.
-
length
public int length()Gets a number of variables stored in the collection.- Specified by:
lengthin interfaceIVariableCollection- Returns:
- a number of stored variables.
-
get
Get a variable by its index.- Specified by:
getin interfaceIVariableCollection- Parameters:
index- a variable index.- Returns:
- a retrieved variable.
-
getAll
Get all variables stores in the collection- Specified by:
getAllin interfaceIVariableCollection- Returns:
- a list with variables.
-
findIndexByName
Finds variable index in the list by it's name.- Specified by:
findIndexByNamein interfaceIVariableCollection- Parameters:
name- The variable name to be found.- Returns:
- Variable index in the list or
-1if variable was not found.
-
findByName
Finds variable in the list by it's name.- Specified by:
findByNamein interfaceIVariableCollection- Parameters:
name- The variable name to be found.- Returns:
- A variable or
nullif function was not found.
-
locate
Finds variable in the list or create a new one if variable was not found.- Specified by:
locatein interfaceIVariableCollection- Parameters:
name- The variable name to be found.- Returns:
- Found or created variable.
-
remove
public void remove(int index) Removes a variable by its index.- Specified by:
removein interfaceIVariableCollection- Parameters:
index- a index of the variable to be removed.
-
removeByName
Removes variable by it's name.- Specified by:
removeByNamein interfaceIVariableCollection- Parameters:
name- The variable name to be removed.
-
clear
public void clear()Clears the collection.- Specified by:
clearin interfaceIVariableCollection
-
clearValues
public void clearValues()Clears all stored variables (assigns null values).- Specified by:
clearValuesin interfaceIVariableCollection
-