0.11.4
ca.uqac.lif.cep.functions.Constant Class Reference

Detailed Description

Representation of a unary constant.

Author
Sylvain Hallé
Since
0.3

Definition at line 30 of file Constant.java.

Public Member Functions

 Constant (Object value)
 Creates a new constant.
void evaluate (Object[] inputs, Object[] outputs, Context context, EventTracker tracker)
 Evaluates the outputs of the function, given some inputs.
void evaluate (Object[] inputs, Object[] outputs)
 Evaluates the outputs of the function, given some inputs.
boolean evaluatePartial (Object[] inputs, Object[] outputs, Context context)
 Evaluates the outputs of the function, given some inputs.
int getInputArity ()
 Gets the function's input arity, i.e.
int getOutputArity ()
 Gets the function's output arity, i.e.
void reset ()
 Resets the function to its initial state.
Constant duplicate (boolean with_state)
 Duplicates an object.
void getInputTypesFor (Set< Class<?> > classes, int index)
 Populates the set of classes accepted by the function for its i-th input.
Class<?> getOutputTypeFor (int index)
 Returns the type of the events produced by the function for its i-th output.
String toString ()
Object getValue ()
 Gets the actual object that this constant processor returns.
Object printState ()
Constant readState (Object o)
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.
boolean evaluateLazy (Object[] inputs, Object[] outputs)
 Attempts a lazy evaluation of the function, given some inputs.
final Function duplicate ()
 Duplicates an object and sets it to its initial state.
Object print (ObjectPrinter<?> printer)
final Function read (ObjectReader<?> reader, Object o) throws FunctionException
 Reads the content of a function from a serialized object.

Static Public Attributes

static final transient Constant ZERO = new Constant(0)
 A constant representing the number zero.
static final transient Constant ONE = new Constant(1)
 A constant representing the number one.
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.

Constructor & Destructor Documentation

◆ Constant()

ca.uqac.lif.cep.functions.Constant.Constant ( Object value)

Creates a new constant.

Parameters
valueThe value associated to this constant

Definition at line 53 of file Constant.java.

Member Function Documentation

◆ duplicate()

Constant ca.uqac.lif.cep.functions.Constant.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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 101 of file Constant.java.

◆ evaluate() [1/2]

void ca.uqac.lif.cep.functions.Constant.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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 70 of file Constant.java.

◆ evaluate() [2/2]

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

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.

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 60 of file Constant.java.

◆ evaluatePartial()

boolean ca.uqac.lif.cep.functions.Constant.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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 76 of file Constant.java.

◆ getInputArity()

int ca.uqac.lif.cep.functions.Constant.getInputArity ( )

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

the number of arguments it takes.

Returns
The input arity

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 83 of file Constant.java.

◆ getInputTypesFor()

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

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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 107 of file Constant.java.

◆ getOutputArity()

int ca.uqac.lif.cep.functions.Constant.getOutputArity ( )

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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 89 of file Constant.java.

◆ getOutputTypeFor()

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

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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 114 of file Constant.java.

◆ getValue()

Object ca.uqac.lif.cep.functions.Constant.getValue ( )

Gets the actual object that this constant processor returns.

Returns
The value

Definition at line 134 of file Constant.java.

◆ printState()

Object ca.uqac.lif.cep.functions.Constant.printState ( )
Since
0.10.2

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 143 of file Constant.java.

◆ readState()

Constant ca.uqac.lif.cep.functions.Constant.readState ( Object o)
Since
0.10.2

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 152 of file Constant.java.

◆ reset()

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

Resets the function to its initial state.

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

Reimplemented from ca.uqac.lif.cep.functions.Function.

Definition at line 95 of file Constant.java.

◆ toString()

String ca.uqac.lif.cep.functions.Constant.toString ( )

Definition at line 120 of file Constant.java.

Member Data Documentation

◆ ONE

final transient Constant ca.uqac.lif.cep.functions.Constant.ONE = new Constant(1)
static

A constant representing the number one.

Definition at line 40 of file Constant.java.

◆ ZERO

final transient Constant ca.uqac.lif.cep.functions.Constant.ZERO = new Constant(0)
static

A constant representing the number zero.

Definition at line 35 of file Constant.java.


The documentation for this class was generated from the following file:
  • /home/sylvain/Workspaces/beepbeep/core/src/ca/uqac/lif/cep/functions/Constant.java