new module:ct-trading /statemachine /Transition(oTarget, sEvent, sSource)
Constructs a 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.
Parameters:
Name | Type | Description |
---|---|---|
oTarget |
module:ct-trading |
The state that this transition goes to. This may not be null. |
sEvent |
String | The name of the event that triggers this transition. May not be null. |
sSource |
String | The source of the event, either server or client. |
Throws:
-
if the target does not implement
State
or if the event name is not aString
. - Type
-
module:ct-core
/Error
Methods
add Validator(oValidator)
Adds a validator that must pass for this transition to be allowed.
Parameters:
Name | Type | Description |
---|---|---|
oValidator |
module:ct-trading |
A validator that must pass to allow this transition. |
Throws:
-
if the validator has already been added or is not a validator.
- Type
-
module:ct-core
/Error
clear Validators()
Clears all transition validators.
get Event()
Gets the name of the event that triggers this transition.
Returns:
The Event that triggers this transition. Will not be null.
get Source()
Returns the source of the event.
Returns:
The source of the event, either client or server.
get Target()
Gets the target State
.
Returns:
The target state. Will not be null.
get Trade Fields() → {pArray}
Returns the list of fields that the transition should use for communication with a trade service
Returns:
- Type
- pArray
set Trade Fields(pFields)
Sets the list of fields that the transition should use for communication with a trade service
Parameters:
Name | Type | Description |
---|---|---|
pFields |
Array | The list of fields that the transition should use for communication with a trade service |
validate(oContext) → {module:ct-trading /validation /Validation Result}
Tests to see if all of the validators for this Transition pass. A module:ct-trading/statemachine/StateMachine
should
not change state if this method does not return a successful module:ct-trading/validation/ValidationResult
.
Parameters:
Name | Type | Description |
---|---|---|
oContext |
Object | The data for the validators to check. It is not optional and may not be null. |
Throws:
-
if the passed context is null or left out.
- Type
-
module:ct-core
/Error
Returns:
a validation result that represents the result of all the validators. Will not be null.