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 JepListandElefunctions 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 intcompareResult(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.ObjectfromCollection(java.util.Collection<java.lang.Object> tree)Convert a general collection into a type used the the Jep environment.java.lang.ObjectfromList(java.util.List<java.lang.Object> list)Convert a list produced byListProcessor.getList()to the type used by Jep environment.JepComponentgetLightWeightInstance()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.voidinit(Jep jep)Initialize the component.
-
-
-
Field Detail
-
sortFun
protected Sort sortFun
-
-
Method Detail
-
init
public void init(Jep jep)
Description copied from interface:JepComponentInitialize 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:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- either an new instance, null or 'this'.
-
fromArgs
public java.lang.Iterable<java.lang.Object> fromArgs(java.lang.Object arg) throws EvaluationExceptionDescription copied from interface:ListProcessorReturns an iterator view of the input arguments.- Specified by:
fromArgsin 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:ListProcessorGet an empty list which elements can be added.- Specified by:
getListin interfaceListProcessor- Returns:
- an empty list
-
fromList
public java.lang.Object fromList(java.util.List<java.lang.Object> list) throws EvaluationExceptionDescription copied from interface:ListProcessorConvert a list produced byListProcessor.getList()to the type used by Jep environment. Some implementations just return the input.- Specified by:
fromListin 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 EvaluationExceptionDescription copied from interface:ListProcessorConvert a general collection into a type used the the Jep environment.- Specified by:
fromCollectionin 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 EvaluationExceptionConverts results from Jep evaluation to an integer -1, 0 or 1 used in comparison.- Specified by:
compareResultin 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)
-
-