diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 32eb7e5..31adbf0 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -299,18 +299,23 @@ class BpNode extends Node */ public function reCalculateState() { + $bp = $this->bp; + $sort_states = array(); $lastStateChange = 0; + if (!$this->hasChildren()) { + // TODO: delegate this to operators, should mostly fail $this->state = 0; + $this->setMissing(); return $this; } foreach ($this->getChildren() as $child) { - $this->beginLoopDetection(); + $bp->beginLoopDetection($this->name); $sort_states[] = $child->getSortingState(); $lastStateChange = max($lastStateChange, $child->getLastStateChange()); - $this->endLoopDetection(); + $bp->endLoopDetection($this->name); } $this->setLastStateChange($lastStateChange); diff --git a/library/Businessprocess/BusinessProcess.php b/library/Businessprocess/BusinessProcess.php index 995ba96..555d48f 100644 --- a/library/Businessprocess/BusinessProcess.php +++ b/library/Businessprocess/BusinessProcess.php @@ -112,6 +112,7 @@ class BusinessProcess protected $simulationCount = 0; + /** @var ProcessChanges */ protected $appliedChanges; public function __construct()