Class StandardListProcessor
- java.lang.Object
-
- com.singularsys.extensions.lambda.StandardListProcessor
-
- All Implemented Interfaces:
ListProcessor
,JepComponent
,java.io.Serializable
- Direct Known Subclasses:
FieldListProcessor
public class StandardListProcessor extends java.lang.Object implements ListProcessor
Default implementation of a ListProcessor. Works with the standard JepList
andEle
functions which useVector<Object>
for lists.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StandardListProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareResult(java.lang.Object val)
Converts results from Jep evaluation to an integer -1, 0 or 1 used in comparison.java.lang.Iterable<java.lang.Object>
fromArgs(java.lang.Object arg)
Returns an iterator view of the input arguments.java.lang.Object
fromCollection(java.util.Collection<java.lang.Object> tree)
Convert a general collection into a type used the the Jep environment.java.lang.Object
fromList(java.util.List<java.lang.Object> list)
Convert a list produced byListProcessor.getList()
to the type used by Jep environment.JepComponent
getLightWeightInstance()
Gets a light-weight instance suitable for using in multiple threads.java.util.List<java.lang.Object>
getList()
Get an empty list which elements can be added.void
init(Jep jep)
Initialize the component.
-
-
-
Field Detail
-
sortFun
protected Sort sortFun
-
-
Method Detail
-
init
public void init(Jep jep)
Description copied from interface:JepComponent
Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.- Specified by:
init
in interfaceJepComponent
- Parameters:
jep
- the current Jep instance
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Description copied from interface:JepComponent
Gets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Returns:
- either an new instance, null or 'this'.
-
fromArgs
public java.lang.Iterable<java.lang.Object> fromArgs(java.lang.Object arg) throws EvaluationException
Description copied from interface:ListProcessor
Returns an iterator view of the input arguments.- Specified by:
fromArgs
in interfaceListProcessor
- Parameters:
arg
- an input to the function- Returns:
- an Iterable view of the argument
- Throws:
EvaluationException
- on error
-
getList
public java.util.List<java.lang.Object> getList()
Description copied from interface:ListProcessor
Get an empty list which elements can be added.- Specified by:
getList
in interfaceListProcessor
- Returns:
- an empty list
-
fromList
public java.lang.Object fromList(java.util.List<java.lang.Object> list) throws EvaluationException
Description copied from interface:ListProcessor
Convert a list produced byListProcessor.getList()
to the type used by Jep environment. Some implementations just return the input.- Specified by:
fromList
in interfaceListProcessor
- Parameters:
list
- a list- Returns:
- a type suitable for use by Jep.
- Throws:
EvaluationException
- on error
-
fromCollection
public java.lang.Object fromCollection(java.util.Collection<java.lang.Object> tree) throws EvaluationException
Description copied from interface:ListProcessor
Convert a general collection into a type used the the Jep environment.- Specified by:
fromCollection
in interfaceListProcessor
- Parameters:
tree
- input collection- Returns:
- a type suitable for use by Jep
- Throws:
EvaluationException
- on error
-
compareResult
public int compareResult(java.lang.Object val) throws EvaluationException
Converts results from Jep evaluation to an integer -1, 0 or 1 used in comparison.- Specified by:
compareResult
in interfaceListProcessor
- Parameters:
val
- input value from Jep environment, expected to be a type which can be converted to an Number.- Returns:
- -1, 0 or 1
- Throws:
EvaluationException
- on error- See Also:
Comparator.compare(Object, Object)
-
-