0.10.8-alpha
ca.uqac.lif.cep.functions.Function Class Referenceabstract

Represents a stateless m-to-n function. More...

Public Member Functions

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...
 

Static Public Attributes

static final int s_maxInputArity = 10
 The maximum input arity that a function can have. More...
 

Protected Member Functions

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...
 

Detailed Description

Represents a stateless m-to-n function.

Author
Sylvain Hallé
Since
0.2.1

Definition at line 41 of file Function.java.

Member Function Documentation

◆ duplicate() [1/2]

final Function ca.uqac.lif.cep.functions.Function.duplicate ( )

Duplicates an object and sets it to its initial state.

This should be the same thing as calling duplicate(false).

Returns
Another object

Implements ca.uqac.lif.cep.functions.DuplicableFunction.

Definition at line 227 of file Function.java.

◆ duplicate() [2/2]

abstract Function ca.uqac.lif.cep.functions.Function.duplicate ( boolean  with_state)
abstract

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.

◆ evaluate() [1/3]

void ca.uqac.lif.cep.functions.Function.evaluate ( Object []  inputs,
Object []  outputs,
Context  context 
)

Evaluates the outputs of the function, given some inputs.

Parameters
inputsThe arguments of the function. The size of the array should be equal to the function's declared input arity.
outputsThe outputs of the function. The size of the array should be equal to the function's declared output arity.
contextThe context in which the evaluation is done. If the function's arguments contains placeholders, they will be replaced by the corresponding object fetched from this map before evaluating the function

Definition at line 63 of file Function.java.

◆ evaluate() [2/3]

abstract void ca.uqac.lif.cep.functions.Function.evaluate ( Object []  inputs,
Object []  outputs,
Context  context,
EventTracker  tracker 
)
abstract

Evaluates the outputs of the function, given some inputs.

Parameters
inputsThe arguments of the function. The size of the array should be equal to the function's declared input arity.
outputsThe outputs of the function. The size of the array should be equal to the function's declared output arity.
contextThe context in which the evaluation is done. If the function's arguments contains placeholders, they will be replaced by the corresponding object fetched from this map before evaluating the function
trackerAn event tracker to record associations between inputs and outputs. This argument is optional and may be null.

◆ evaluate() [3/3]

void ca.uqac.lif.cep.functions.Function.evaluate ( Object []  inputs,
Object []  outputs 
)

Evaluates the outputs of the function, given some inputs.

Parameters
inputsThe arguments of the function. The size of the array should be equal to the function's declared input arity.
outputsThe outputs of the function. The size of the array should be equal to the function's declared output arity. @ Any exception that may occur during the evaluation of a function

Definition at line 102 of file Function.java.

◆ evaluateFast()

Future<Object[]> ca.uqac.lif.cep.functions.Function.evaluateFast ( Object []  inputs,
Object []  outputs,
Context  context,
ExecutorService  service 
)

Utility method that delegates the call to evaluate()

Parameters
inputsInput arguments
outputsOutput values
contextContext object
serviceThe service responsible for assigning threads
Returns
A Future object for this function call

Definition at line 219 of file Function.java.

◆ evaluateLazy()

boolean ca.uqac.lif.cep.functions.Function.evaluateLazy ( Object []  inputs,
Object []  outputs 
)

Attempts a lazy evaluation of the function, given some inputs.

Parameters
inputsThe arguments of the function. The size of the array should be equal to the function's declared input arity.
outputsThe outputs of the function. The size of the array should be equal to the function's declared output arity. @ Any exception that may occur during the evaluation of a function
Returns
true if the function succeeded in producing an output value, false otherwise

Definition at line 153 of file Function.java.

◆ evaluatePartial()

boolean ca.uqac.lif.cep.functions.Function.evaluatePartial ( Object []  inputs,
Object []  outputs,
Context  context 
)

Evaluates the outputs of the function, given some inputs.

Parameters
inputsThe arguments of the function. The size of the array should be equal to the function's declared input arity.
outputsThe outputs of the function. The size of the array should be equal to the function's declared output arity.
contextThe context in which the evaluation is done. If the function's arguments contains placeholders, they will be replaced by the corresponding object fetched from this map before evaluating the function
Returns
true if the function succeeded in producing an output value, false otherwise

Definition at line 125 of file Function.java.

◆ getInputArity()

abstract int ca.uqac.lif.cep.functions.Function.getInputArity ( )
abstract

Gets the function's input arity, i.e.

the number of arguments it takes.

Returns
The input arity

◆ getInputTypesFor()

abstract void ca.uqac.lif.cep.functions.Function.getInputTypesFor ( Set< Class<?>>  classes,
int  index 
)
abstract

Populates the set of classes accepted by the function for its i-th input.

Parameters
classesThe set of to fill with classes
indexThe index of the input to query

◆ getOutputArity()

abstract int ca.uqac.lif.cep.functions.Function.getOutputArity ( )
abstract

Gets the function's output arity, i.e.

the number of elements it outputs. (We expect that most functions will have an output arity of 1.)

Returns
The output arity

◆ getOutputTypeFor()

abstract Class<?> ca.uqac.lif.cep.functions.Function.getOutputTypeFor ( int  index)
abstract

Returns the type of the events produced by the function for its i-th output.

Parameters
indexThe index of the output to query
Returns
The type of the output

◆ print()

Object ca.uqac.lif.cep.functions.Function.print ( ObjectPrinter<?>  printer)
Since
0.10.2

Definition at line 239 of file Function.java.

◆ printState()

Object ca.uqac.lif.cep.functions.Function.printState ( )
protected

Produces an object that represents the state of the current function.

A concrete function should override this method to add whatever state information that needs to be preserved in the serialization process.

Returns
Any object representing the function's state (including null)
Since
0.10.2

Definition at line 261 of file Function.java.

◆ read()

final Function ca.uqac.lif.cep.functions.Function.read ( ObjectReader<?>  reader,
Object  o 
) throws FunctionException

Reads the content of a function from a serialized object.

Parameters
readerAn object reader
oThe object to read from
Returns
The deserialized function
Exceptions
FunctionExceptionIf the read operation failed for some reason

Definition at line 275 of file Function.java.

◆ readState()

Function ca.uqac.lif.cep.functions.Function.readState ( Object  o)
protected

Reads the state of a function and uses it to create a new instance.

Parameters
oThe object containing the function's state
Returns
A new function instance
Since
0.10.2

Definition at line 312 of file Function.java.

◆ reset()

void ca.uqac.lif.cep.functions.Function.reset ( )

Resets the function to its initial state.

In the case of a stateless function, nothing requires to be done.

Definition at line 180 of file Function.java.

Member Data Documentation

◆ s_maxInputArity

final int ca.uqac.lif.cep.functions.Function.s_maxInputArity = 10
static

The maximum input arity that a function can have.

Definition at line 46 of file Function.java.


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