Class FunctionCollection
- java.lang.Object
-
- org.pipservices3.expressions.calculator.functions.FunctionCollection
-
- All Implemented Interfaces:
IFunctionCollection
- Direct Known Subclasses:
DefaultFunctionCollection
public class FunctionCollection extends Object implements IFunctionCollection
Implements a functions list.
-
-
Constructor Summary
Constructors Constructor Description FunctionCollection()
-
Method Summary
Modifier and Type Method Description voidadd(IFunction func)Adds a new function to the collection.voidclear()Clears the collection.IFunctionfindByName(String name)Finds function in the list by it's name.intfindIndexByName(String name)Finds function index in the list by it's name.IFunctionget(int index)Get a function by its index.List<IFunction>getAll()Get all functions stores in the collectionintlength()Gets a number of functions stored in the collection.voidremove(int index)Removes a function by its index.voidremoveByName(String name)Removes function by it's name.
-
-
-
Method Detail
-
add
public void add(IFunction func)
Adds a new function to the collection.- Specified by:
addin interfaceIFunctionCollection- Parameters:
func- a function to be added.
-
length
public int length()
Gets a number of functions stored in the collection.- Specified by:
lengthin interfaceIFunctionCollection- Returns:
- a number of stored functions.
-
get
public IFunction get(int index)
Get a function by its index.- Specified by:
getin interfaceIFunctionCollection- Parameters:
index- a function index.- Returns:
- a retrieved function.
-
getAll
public List<IFunction> getAll()
Get all functions stores in the collection- Specified by:
getAllin interfaceIFunctionCollection- Returns:
- a list with functions.
-
findIndexByName
public int findIndexByName(String name)
Finds function index in the list by it's name.- Specified by:
findIndexByNamein interfaceIFunctionCollection- Parameters:
name- The function name to be found.- Returns:
- Function index in the list or
-1if function was not found.
-
findByName
public IFunction findByName(String name)
Finds function in the list by it's name.- Specified by:
findByNamein interfaceIFunctionCollection- Parameters:
name- The function name to be found.- Returns:
- A function or
nullif function was not found.
-
remove
public void remove(int index)
Removes a function by its index.- Specified by:
removein interfaceIFunctionCollection- Parameters:
index- a index of the function to be removed.
-
removeByName
public void removeByName(String name)
Removes function by it's name.- Specified by:
removeByNamein interfaceIFunctionCollection- Parameters:
name- The function name to be removed.
-
clear
public void clear()
Clears the collection.- Specified by:
clearin interfaceIFunctionCollection
-
-