![]() |
0.10.8-alpha
|
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... | |
| 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).
Implements ca.uqac.lif.cep.functions.DuplicableFunction.
Definition at line 227 of file Function.java.
|
abstract |
Duplicates an object.
Optionally, set the object into the same state as the source object.
| with_state | Set to true to replicate the object's state, false to create a new copy in the initial state. |
Implements ca.uqac.lif.cep.Duplicable.
| void ca.uqac.lif.cep.functions.Function.evaluate | ( | Object [] | inputs, |
| Object [] | outputs, | ||
| Context | context | ||
| ) |
Evaluates the outputs of the function, given some inputs.
| inputs | The arguments of the function. The size of the array should be equal to the function's declared input arity. |
| outputs | The outputs of the function. The size of the array should be equal to the function's declared output arity. |
| context | The 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.
|
abstract |
Evaluates the outputs of the function, given some inputs.
| inputs | The arguments of the function. The size of the array should be equal to the function's declared input arity. |
| outputs | The outputs of the function. The size of the array should be equal to the function's declared output arity. |
| context | The 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 |
| tracker | An event tracker to record associations between inputs and outputs. This argument is optional and may be null. |
| void ca.uqac.lif.cep.functions.Function.evaluate | ( | Object [] | inputs, |
| Object [] | outputs | ||
| ) |
Evaluates the outputs of the function, given some inputs.
| inputs | The arguments of the function. The size of the array should be equal to the function's declared input arity. |
| outputs | The 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.
| 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()
| inputs | Input arguments |
| outputs | Output values |
| context | Context object |
| service | The service responsible for assigning threads |
Definition at line 219 of file Function.java.
| boolean ca.uqac.lif.cep.functions.Function.evaluateLazy | ( | Object [] | inputs, |
| Object [] | outputs | ||
| ) |
Attempts a lazy evaluation of the function, given some inputs.
| inputs | The arguments of the function. The size of the array should be equal to the function's declared input arity. |
| outputs | The 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 |
true if the function succeeded in producing an output value, false otherwise Definition at line 153 of file Function.java.
| boolean ca.uqac.lif.cep.functions.Function.evaluatePartial | ( | Object [] | inputs, |
| Object [] | outputs, | ||
| Context | context | ||
| ) |
Evaluates the outputs of the function, given some inputs.
| inputs | The arguments of the function. The size of the array should be equal to the function's declared input arity. |
| outputs | The outputs of the function. The size of the array should be equal to the function's declared output arity. |
| context | The 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 |
true if the function succeeded in producing an output value, false otherwise Definition at line 125 of file Function.java.
|
abstract |
Gets the function's input arity, i.e.
the number of arguments it takes.
|
abstract |
Populates the set of classes accepted by the function for its i-th input.
| classes | The set of to fill with classes |
| index | The index of the input to query |
|
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.)
|
abstract |
Returns the type of the events produced by the function for its i-th output.
| index | The index of the output to query |
| Object ca.uqac.lif.cep.functions.Function.print | ( | ObjectPrinter<?> | printer | ) |
Definition at line 239 of file Function.java.
|
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.
null) Definition at line 261 of file Function.java.
| 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.
| reader | An object reader |
| o | The object to read from |
| FunctionException | If the read operation failed for some reason |
Definition at line 275 of file Function.java.
|
protected |
Reads the state of a function and uses it to create a new instance.
| o | The object containing the function's state |
Definition at line 312 of file Function.java.
| 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.
|
static |
The maximum input arity that a function can have.
Definition at line 46 of file Function.java.