Class FunctionCollection
java.lang.Object
org.pipservices3.expressions.calculator.functions.FunctionCollection
- All Implemented Interfaces:
IFunctionCollection
- Direct Known Subclasses:
DefaultFunctionCollection
Implements a functions list.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new function to the collection.void
clear()
Clears the collection.findByName
(String name) Finds function in the list by it's name.int
findIndexByName
(String name) Finds function index in the list by it's name.get
(int index) Get a function by its index.getAll()
Get all functions stores in the collectionint
length()
Gets a number of functions stored in the collection.void
remove
(int index) Removes a function by its index.void
removeByName
(String name) Removes function by it's name.
-
Constructor Details
-
FunctionCollection
public FunctionCollection()
-
-
Method Details
-
add
Adds a new function to the collection.- Specified by:
add
in interfaceIFunctionCollection
- Parameters:
func
- a function to be added.
-
length
public int length()Gets a number of functions stored in the collection.- Specified by:
length
in interfaceIFunctionCollection
- Returns:
- a number of stored functions.
-
get
Get a function by its index.- Specified by:
get
in interfaceIFunctionCollection
- Parameters:
index
- a function index.- Returns:
- a retrieved function.
-
getAll
Get all functions stores in the collection- Specified by:
getAll
in interfaceIFunctionCollection
- Returns:
- a list with functions.
-
findIndexByName
Finds function index in the list by it's name.- Specified by:
findIndexByName
in interfaceIFunctionCollection
- Parameters:
name
- The function name to be found.- Returns:
- Function index in the list or
-1
if function was not found.
-
findByName
Finds function in the list by it's name.- Specified by:
findByName
in interfaceIFunctionCollection
- Parameters:
name
- The function name to be found.- Returns:
- A function or
null
if function was not found.
-
remove
public void remove(int index) Removes a function by its index.- Specified by:
remove
in interfaceIFunctionCollection
- Parameters:
index
- a index of the function to be removed.
-
removeByName
Removes function by it's name.- Specified by:
removeByName
in interfaceIFunctionCollection
- Parameters:
name
- The function name to be removed.
-
clear
public void clear()Clears the collection.- Specified by:
clear
in interfaceIFunctionCollection
-