Class StreamMatrixListProcessor
java.lang.Object
com.singularsys.extensions.stream.StreamListProcessor
com.singularsys.extensions.stream.StreamMatrixListProcessor
- All Implemented Interfaces:
ListProcessor,JepComponent,Serializable
A ListProcessor implementation that can convert
MatrixI, VectorI to and from streams.
It is used by the stream functions to convert their arguments to streams.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionargAsStream(Object arg) Converts the argument to a stream if possible.List<?> Converts the argument to a list.argToListOrElement(Object arg) Converts the argument to a list or single value.Returns an iterable view of the input arguments.fromCollection(Collection<Object> tree) Convert a general collection into a type used the Jep environment.Convert a list produced byListProcessor.makeList()to the type used by Jep environment.Gets a light-weight instance suitable for using in multiple threads.voidInitialize the component.makeList()Get an empty list which elements can be added.Methods inherited from class com.singularsys.extensions.stream.StreamListProcessor
car, cdr, clearClones, cloneStream
-
Constructor Details
-
StreamMatrixListProcessor
-
-
Method Details
-
init
Description copied from interface:JepComponentInitialize the component. This method 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- Overrides:
initin classStreamListProcessor- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classStreamListProcessor- Returns:
- either a new instance, null or 'this'.
-
fromArgs
Description copied from interface:ListProcessorReturns an iterable view of the input arguments.- Specified by:
fromArgsin interfaceListProcessor- Overrides:
fromArgsin classStreamListProcessor- Parameters:
arg- typically a list, but can be any type. If the type is not a list, an iterator with a single element is returned.- Returns:
- an Iterable view of the argument
- Throws:
EvaluationException- on error
-
argAsStream
Converts the argument to a stream if possible. If the argument is already a stream it is returned as is, if it is a list or aVectorIit is converted to a stream. Otherwise an stream consisting of a single element is created.- Overrides:
argAsStreamin classStreamListProcessor- Throws:
EvaluationException
-
argToList
Converts the argument to a list. If the argument is aList,Streamor aVectorIit is converted to a list individual elements of these sequence are recursively converted to lists as well. If the argument is not a list, stream orVectorIa list consisting of a single element is created.- Overrides:
argToListin classStreamListProcessor- Parameters:
arg- the argument to convert- Returns:
- a list
- Throws:
EvaluationException
-
argToListOrElement
Converts the argument to a list or single value. If the argument is aList,Streamor aVectorIit is converted to a list individual elements of these sequence are recursively converted to lists as well. If the argument is not a list, stream orVectorIit is returned as is.- Overrides:
argToListOrElementin classStreamListProcessor- Parameters:
arg- the argument to convert- Returns:
- a list or single value
- Throws:
EvaluationException
-
makeList
Description copied from interface:ListProcessorGet an empty list which elements can be added.- Specified by:
makeListin interfaceListProcessor- Overrides:
makeListin classStreamListProcessor- Returns:
- an empty list
-
fromList
Description copied from interface:ListProcessorConvert a list produced byListProcessor.makeList()to the type used by Jep environment. Some implementations just return the input.- Specified by:
fromListin interfaceListProcessor- Overrides:
fromListin classStreamListProcessor- Parameters:
list- a list- Returns:
- a type suitable for use by Jep.
- Throws:
EvaluationException- on error
-
fromCollection
Description copied from interface:ListProcessorConvert a general collection into a type used the Jep environment.- Specified by:
fromCollectionin interfaceListProcessor- Overrides:
fromCollectionin classStreamListProcessor- Parameters:
tree- input collection- Returns:
- a type suitable for use by Jep
- Throws:
EvaluationException- on error
-