org-puremvc-php-multicore-utilities-statemachine
[ class tree: org-puremvc-php-multicore-utilities-statemachine ] [ index: org-puremvc-php-multicore-utilities-statemachine ] [ all elements ]

Class: StateMachine

Source Location: /org/puremvc/php/multicore/utilities/statemachine/StateMachine.php

Class Overview

Mediator
   |
   --StateMachine

A Finite State Machine implimentation.


Author(s):

Variables

Constants

Methods



Class Details

[line 34]
A Finite State Machine implimentation.

Handles regisistration and removal of state definitions, which include optional entry and exit commands for each state.




Tags:

see:  Mediator


[ Top ]


Class Variables

$canceled =

[line 69]

The transition has been canceled.



Tags:

access:  protected

Type:   bool


[ Top ]

$initial =

[line 63]

The initial state of the FSM.



Tags:

access:  protected

Type:   State


[ Top ]

$states = array()

[line 57]

Map of States objects by name.



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


constructor __construct [line 76]

StateMachine __construct( )

Constructor.



Tags:

access:  public


[ Top ]

method getCurrentState [line 224]

State getCurrentState( )

Get the current state.



Tags:

return:  A State defining the machine's current state
access:  protected


[ Top ]

method handleNotification [line 202]

void handleNotification( $notification)

Handle notifications the StateMachine is interested in.

StateMachine::ACTION: Triggers the transition to a new state.
StateMachine::CANCEL: Cancels the transition if sent in response to the exiting note for the current state.




Tags:

access:  public


Parameters:

INotification   $notification   The INotification to be handled.

[ Top ]

method listNotificationInterests [line 187]

void listNotificationInterests( )

Notification interests for the StateMachine.



Tags:

access:  public


[ Top ]

method onRegister [line 88]

void onRegister( )

onRegister event

Called by the View when the Mediator is registered.




Tags:

access:  public


[ Top ]

method registerState [line 103]

void registerState( State $state, [bool $initial = false])

Registers the entry and exit commands for a given state.



Tags:

access:  public


Parameters:

State   $state   the state to which to register the above commands
bool   $initial   boolean telling if this is the initial state of the system

[ Top ]

method removeState [line 119]

void removeState( string $stateName)

Remove a state mapping.

Removes the entry and exit commands for a given state as well as the state mapping itself.




Tags:

access:  public


Parameters:

string   $stateName   stateName

[ Top ]

method setCurrentState [line 234]

void setCurrentState( State $state)

Set the current state.



Tags:

access:  protected


Parameters:

State   $state   The current state to use

[ Top ]

method transitionTo [line 144]

void transitionTo( State $nextState, [object data $data = null])

Transitions to the given state from the current state.

Sends the exiting notification for the current state followed by the entering notification for the new state. Once finally transitioned to the new state, the changed notification for the new state is sent.

If a data parameter is provided, it is included as the body of all three state-specific transition notes.

Finally, when all the state-specific transition notes have been sent, a StateMachine.CHANGED note is sent, with the new State object as the body and the name of the new state in the type.




Tags:

access:  protected


Parameters:

State   $nextState   the next State to transition to.
object data   $data   is the optional Object that was sent in the StateMachine.ACTION notification body

[ Top ]


Class Constants

ACTION =  "StateMachine/notes/action"

[line 41]

Action Notification name.


[ Top ]

CANCEL =  "StateMachine/notes/cancel"

[line 51]

Cancel Notification name


[ Top ]

CHANGED =  "StateMachine/notes/changed"

[line 46]

Changed Notification name


[ Top ]

NAME =  "StateMachine"

[line 36]


[ Top ]



Documentation generated on Mon, 03 Aug 2009 05:20:50 +0000 by phpDocumentor 1.4.2