Esempio n. 1
0
 function fetchNextAction($planList)
 {
     //There is a bug in PHP
     //When trying to process very large objects it side effects the values!
     //To overcome this we must enforce a copy is made and then use this instead!
     $localPlanList = array();
     $planListSize = sizeof($planList);
     for ($index = 0; $index < $planListSize; $index++) {
         $localPlanList[$index] = new graphPlan();
         $localPlanList[$index] = $planList[$index];
     }
     $possibleActions = array();
     $actionCollection = array();
     //We have not reached the goal state
     if ($possibleActions = planComparison::compareActions($localPlanList, false)) {
         //We have not reached a decision point
         if (!planComparison::conditionalAction($possibleActions)) {
             //This is only one action
             $currentAction = $possibleActions[0]->getAction();
             $nodeData = $currentAction->getData();
             array_push($actionCollection, $nodeData[0]);
         } else {
             // Conditional action encountered
             systemMessages::message("Plan decision point encountered");
             //Only consider the first packet
             $currentAction = $possibleActions[0]->getAction();
             $nodeData = $currentAction->getData();
             array_push($actionCollection, $nodeData[0]);
         }
     } else {
         // Goal node reached
         systemMessages::message("GoalNode!");
     }
     return array($possibleActions, $actionCollection);
 }
Esempio n. 2
0
 function processLoop($planGraphList, $workflowID)
 {
     //Find the next Actions
     $possibleActions = planComparison::compareActions($planGraphList, false);
     $loopResult = actionPacket::checkActionPacketsForLoop($possibleActions);
     if ($loopResult['loop']) {
         //Check to see if we are looping
         systemMessages::message("Workflow is Looping!");
         $planGraphList = graphPlanDatabaseAccess::getPlanState($workflowID, $loopResult['formName']);
         graphPlanDatabaseAccess::updatePlanGraphList($workflowID, $planGraphList);
         $possibleActions = planComparison::compareActions($planGraphList, false);
     }
     return $possibleActions;
 }