Class
caplin.trading.statemachine

Transition

A Transition represents a path that a StateMachine can take from one State to another (the target state). It is caused by an Event.

Constructor Summary

Attributes Name and Description
caplin.trading.statemachine.Transition(caplin.trading.statemachine.State oTarget, String sEvent, String sSource)

Constructs a caplin.trading.statemachine.Transition

Method Summary

Attributes Name and Description
void addValidator(caplin.trading.validation.Validator oValidator)

Adds a validator that must pass for this transition to be allowed.

String getEvent()

Gets the name of the event that triggers this transition.

String getSource()

Returns the source of the event.

caplin.trading.statemachine.State getTarget()

Gets the target State.

caplin.trading.validation.ValidationResult validate(Object oContext)

Tests to see if all of the validators for this Transition pass.

Constructor Detail

caplin.trading.statemachine.Transition(caplin.trading.statemachine.State oTarget, String sEvent, String sSource)

Constructs a caplin.trading.statemachine.Transition

Parameters
caplin.trading.statemachine.State oTarget The state that this transition goes to. This may not be null.
String sEvent The name of the event that triggers this transition. May not be null.
String sSource The source of the event, either server or client.
Throws
caplin.core.Error
if the target does not implement caplin.trading.statemachine.State or if the event name is not a String.

Method Detail

void addValidator(caplin.trading.validation.Validator oValidator)

Adds a validator that must pass for this transition to be allowed.

Parameters
caplin.trading.validation.Validator oValidator A validator that must pass to allow this transition.
Throws
caplin.core.Error
if the validator has already been added or is not a validator.

String getEvent()

Gets the name of the event that triggers this transition.

Returns
The Event that triggers this transition. Will not be null.

String getSource()

Returns the source of the event.

Returns
The source of the event, either client or server.

caplin.trading.statemachine.State getTarget()

Gets the target State.

Returns
The target state. Will not be null.

caplin.trading.validation.ValidationResult validate(Object oContext)

Tests to see if all of the validators for this Transition pass. A caplin.trading.statemachine.StateMachine should not change state if this method does not return a successful caplin.trading.validation.ValidationResult.

Parameters
Object oContext The data for the validators to check. It is not optional and may not be null.
Throws
caplin.core.Error
if the passed context is null or left out.
Returns
a caplin.trading.validation.ValidationResult that represents the result of all the validators. Will not be null.