getState() public method

public getState ( string $name ) : Finite\State\StateInterface
$name string
return Finite\State\StateInterface
コード例 #1
0
 private function addTransitions(Digraph $graph, StateMachine $stateMachine)
 {
     foreach ($stateMachine->getStates() as $stateName) {
         $state = $stateMachine->getState($stateName);
         foreach ($state->getTransitions() as $transitionName) {
             $transition = $stateMachine->getTransition($transitionName);
             $graph->beginEdge(array($stateName, $transition->getState()), array('label' => $transitionName))->end();
         }
     }
 }
コード例 #2
0
ファイル: Graphviz.php プロジェクト: ddvzwzjm/finite-graphviz
 /**
  * Adds all transitions as edges.
  *
  * @param \Finite\StateMachine\StateMachineInterface $stateMachine
  */
 private function addEdges(StateMachineInterface $stateMachine)
 {
     $states = $stateMachine->getStates();
     foreach ($states as $sName) {
         $state = $stateMachine->getState($sName);
         $transitions = $state->getTransitions();
         foreach ($transitions as $tName) {
             $trans = $stateMachine->getTransition($tName);
             $attributes = $this->getEdgeDefaultAttributes($trans);
             if ($this->visitors) {
                 try {
                     foreach ($this->visitors as $visitor) {
                         $attributes = $visitor->getEdgeAttributes($attributes, $trans, $state, $stateMachine);
                     }
                 } catch (SkipElementException $ex) {
                     continue;
                 }
             }
             $this->graph->beginEdge([$state->getName(), $trans->getState()], $attributes)->end();
         }
     }
 }
コード例 #3
0
ファイル: Graphviz.php プロジェクト: marltu/finite-graphviz
 /**
  * Adds all transitions as edges.
  *
  * @param \Finite\StateMachine\StateMachineInterface $stateMachine
  */
 private function addEdges(StateMachineInterface $stateMachine)
 {
     $states = $stateMachine->getStates();
     foreach ($states as $name) {
         $state = $stateMachine->getState($name);
         /* @var $state \Finite\State\StateInterface */
         $transitions = $state->getTransitions();
         foreach ($transitions as $name) {
             $trans = $stateMachine->getTransition($name);
             /* @var $trans Finite\Transition\TransitionInterface */
             $this->graph->beginEdge(array($state->getName(), $trans->getState()), array('label' => $trans->getName()))->end();
         }
     }
 }