0.10.8-alpha
ca.uqac.lif.cep.util.NthElement Class Reference

Function that returns the n-th element of an ordered collection (array or list). More...

Public Member Functions

 NthElement (int n)
 Creates a new instance of the function. More...
 
Object getValue (Object x)
 
NthElement duplicate (boolean with_state)
 Duplicates an object. More...
 
String toString ()
 
Integer printState ()
 
NthElement readState (Object o)
 
- Public Member Functions inherited from ca.uqac.lif.cep.functions.UnaryFunction< T, U >
 UnaryFunction (Class< T > t, Class< U > u)
 Creates a new instance of an unary function. More...
 
void evaluate (Object[] inputs, Object[] outputs, Context context, EventTracker tracker)
 
abstract U getValue (T x)
 Evaluates the function. More...
 
final int getInputArity ()
 
final int getOutputArity ()
 
void reset ()
 
UnaryFunction< T, U > duplicate (boolean with_state)
 Duplicates an object. More...
 
final void getInputTypesFor (Set< Class<?>> classes, int index)
 
Class<?> getOutputTypeFor (int index)
 
- Public Member Functions inherited from ca.uqac.lif.cep.functions.Function
void evaluate (Object[] inputs, Object[] outputs, Context context)
 Evaluates the outputs of the function, given some inputs. More...
 
abstract void evaluate (Object[] inputs, Object[] outputs, Context context, EventTracker tracker)
 Evaluates the outputs of the function, given some inputs. More...
 
void evaluate (Object[] inputs, Object[] outputs)
 Evaluates the outputs of the function, given some inputs. More...
 
boolean evaluatePartial (Object[] inputs, Object[] outputs, Context context)
 Evaluates the outputs of the function, given some inputs. More...
 
boolean evaluateLazy (Object[] inputs, Object[] outputs)
 Attempts a lazy evaluation of the function, given some inputs. More...
 
abstract int getInputArity ()
 Gets the function's input arity, i.e. More...
 
abstract int getOutputArity ()
 Gets the function's output arity, i.e. More...
 
void reset ()
 Resets the function to its initial state. More...
 
abstract void getInputTypesFor (Set< Class<?>> classes, int index)
 Populates the set of classes accepted by the function for its i-th input. More...
 
abstract Class<?> getOutputTypeFor (int index)
 Returns the type of the events produced by the function for its i-th output. More...
 
Future< Object[]> evaluateFast (Object[] inputs, Object[] outputs, Context context, ExecutorService service)
 Utility method that delegates the call to evaluate() More...
 
final Function duplicate ()
 Duplicates an object and sets it to its initial state. More...
 
abstract Function duplicate (boolean with_state)
 Duplicates an object. More...
 
Object print (ObjectPrinter<?> printer)
 
final Function read (ObjectReader<?> reader, Object o) throws FunctionException
 Reads the content of a function from a serialized object. More...
 

Protected Member Functions

 NthElement ()
 Empty constructor. More...
 
- Protected Member Functions inherited from ca.uqac.lif.cep.functions.Function
Object printState ()
 Produces an object that represents the state of the current function. More...
 
Function readState (Object o)
 Reads the state of a function and uses it to create a new instance. More...
 

Protected Attributes

int m_n
 The position of the element to get. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ca.uqac.lif.cep.functions.Function
static final int s_maxInputArity = 10
 The maximum input arity that a function can have. More...
 

Detailed Description

Function that returns the n-th element of an ordered collection (array or list).

Author
Sylvain Hallé
Since
0.7

Definition at line 32 of file NthElement.java.

Constructor & Destructor Documentation

◆ NthElement() [1/2]

ca.uqac.lif.cep.util.NthElement.NthElement ( int  n)

Creates a new instance of the function.

Parameters
nThe position of the element to get

Definition at line 45 of file NthElement.java.

◆ NthElement() [2/2]

ca.uqac.lif.cep.util.NthElement.NthElement ( )
protected

Empty constructor.

Used only for deserialization.

Definition at line 54 of file NthElement.java.

Member Function Documentation

◆ duplicate()

NthElement ca.uqac.lif.cep.util.NthElement.duplicate ( boolean  with_state)

Duplicates an object.

Optionally, set the object into the same state as the source object.

Parameters
with_stateSet to true to replicate the object's state, false to create a new copy in the initial state.
Returns
Another object

Implements ca.uqac.lif.cep.Duplicable.

Definition at line 90 of file NthElement.java.

◆ getValue()

Object ca.uqac.lif.cep.util.NthElement.getValue ( Object  x)

Definition at line 60 of file NthElement.java.

◆ printState()

Integer ca.uqac.lif.cep.util.NthElement.printState ( )
Since
0.10.2

Definition at line 105 of file NthElement.java.

◆ readState()

NthElement ca.uqac.lif.cep.util.NthElement.readState ( Object  o)
Since
0.10.2

Definition at line 114 of file NthElement.java.

◆ toString()

String ca.uqac.lif.cep.util.NthElement.toString ( )

Definition at line 96 of file NthElement.java.

Member Data Documentation

◆ m_n

int ca.uqac.lif.cep.util.NthElement.m_n
protected

The position of the element to get.

Definition at line 37 of file NthElement.java.


The documentation for this class was generated from the following file: