Package ca.uqac.lif.cep.fsm
Class ProcessorTransition
- java.lang.Object
-
- ca.uqac.lif.cep.fsm.MooreMachine.Transition
-
- ca.uqac.lif.cep.fsm.ProcessorTransition
-
- All Implemented Interfaces:
ca.uqac.lif.cep.Duplicable
public class ProcessorTransition extends MooreMachine.Transition
Represents a transition in the Moore machine. Using this transition actually creates a generalized Moore machine, as the labels on each transition are themselves processors: not only can they express complex conditions on the input event, but they can also have a state. This was done mainly because it was handy to just use the classProcessor
to evaluate conditions (send the event to the processor and just collect its output), rather than come up with special objects to do that.A "classical" Moore machine is a particular case where all processors for expressing the conditions are unary and stateless.
- Author:
- Sylvain Hallé
-
-
Constructor Summary
Constructors Constructor Description ProcessorTransition(int destination, ca.uqac.lif.cep.Processor condition)
Instantiates a new transitionProcessorTransition(ProcessorTransition pt)
Creates a new processor transition from another transition.ProcessorTransition(ProcessorTransition pt, boolean with_state)
Creates a new processor transition, by copying state from another transition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessorTransition
duplicate(boolean with_state)
int
getDestination()
Gets the destination (i.e.boolean
isFired(java.lang.Object[] inputs, ca.uqac.lif.cep.Context context)
Determines if the transition fires for the given inputvoid
reset()
Resets the state of the transitionjava.lang.String
toString()
-
Methods inherited from class ca.uqac.lif.cep.fsm.MooreMachine.Transition
duplicate, modifyContext
-
-
-
-
Constructor Detail
-
ProcessorTransition
public ProcessorTransition(ProcessorTransition pt)
Creates a new processor transition from another transition.- Parameters:
pt
- The transition to copy from
-
ProcessorTransition
public ProcessorTransition(ProcessorTransition pt, boolean with_state)
Creates a new processor transition, by copying state from another transition.- Parameters:
pt
- The transition to copy fromwith_state
- The
-
ProcessorTransition
public ProcessorTransition(int destination, ca.uqac.lif.cep.Processor condition)
Instantiates a new transition- Parameters:
condition
- The condition for taking that transitiondestination
- The state one will be in if the condition evaluates to true
-
-
Method Detail
-
isFired
public boolean isFired(java.lang.Object[] inputs, ca.uqac.lif.cep.Context context)
Description copied from class:MooreMachine.Transition
Determines if the transition fires for the given input- Overrides:
isFired
in classMooreMachine.Transition
- Parameters:
inputs
- The input eventscontext
- The context for the evaluation- Returns:
true
if the transition fires,false
otherwise
-
getDestination
public int getDestination()
Description copied from class:MooreMachine.Transition
Gets the destination (i.e. target state) of that transition- Overrides:
getDestination
in classMooreMachine.Transition
- Returns:
- The destination state
-
reset
public void reset()
Description copied from class:MooreMachine.Transition
Resets the state of the transition- Overrides:
reset
in classMooreMachine.Transition
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
duplicate
public ProcessorTransition duplicate(boolean with_state)
- Specified by:
duplicate
in interfaceca.uqac.lif.cep.Duplicable
- Overrides:
duplicate
in classMooreMachine.Transition
-
-