diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 67f3c31..c0424a8 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -19,20 +19,6 @@ class BpNode extends Node protected $counters; protected $missing = null; - protected static $sortStateToStateMap = array( - 4 => 2, - 3 => 3, - 2 => 1, - 1 => 99, - 0 => 0 - ); - - protected static $stateToSortStateMap = array( - 99 => 1, - 3 => 3, - 2 => 4, - 1 => 2, - 0 => 0, ); public function __construct( @@ -207,26 +193,6 @@ class BpNode extends Node $this->state = $this->sortStateTostate($sort_state); } - protected function stateToSortState($state) - { - if (array_key_exists(self::$stateToSortStateMap, $state)) { - return self::$stateToSortStateMap[$state]; - } - - throw new ProgrammingError('Got invalid state %s', $sort_state); - } - - protected function sortStateTostate($sortState) - { - $sortState = $sortState >> self::SHIFT_FLAGS; - - if (array_key_exists(self::$sortStateToState, $sortState)) { - return self::$sortStateToSortState[$sortState]; - } - - throw new ProgrammingError('Got invalid sorting state %s', $sort_state); - } - public function countChildren() { return count($this->getChildren()); diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index c8b92f2..44ca343 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -23,6 +23,22 @@ abstract class Node const ICINGA_UNREACHABLE = 2; const ICINGA_PENDING = 99; + protected static $sortStateToStateMap = array( + 4 => 2, + 3 => 3, + 2 => 1, + 1 => 99, + 0 => 0 + ); + + protected static $stateToSortStateMap = array( + 99 => 1, + 3 => 3, + 2 => 4, + 1 => 2, + 0 => 0, + ); + /** * Main business process object * @@ -273,6 +289,26 @@ abstract class Node return count($this->parents) > 0; } + protected function stateToSortState($state) + { + if (array_key_exists($state, self::$stateToSortStateMap)) { + return self::$stateToSortStateMap[$state]; + } + + throw new ProgrammingError('Got invalid state %s', $sort_state); + } + + protected function sortStateTostate($sortState) + { + $sortState = $sortState >> self::SHIFT_FLAGS; + + if (array_key_exists($sortState, self::$sortStateToStateMap)) { + return self::$sortStateToStateMap[$sortState]; + } + + throw new ProgrammingError('Got invalid sorting state %s', $sort_state); + } + protected function renderHtmlForChildren($view) { $html = '';