Пример #1
0
 /**
  * @return Array['array'] = actionPackets not matched and Array['actions'] = actionPackets that matched
  * @param $array array of ActionPackets 
  * @param $object Action Packet
  * @desc splits the actions packets into those that match the action and those that dont
  */
 function getAllMatchingActions($actionPacketarray, $object)
 {
     $actions = array();
     //Get the Node
     $currentNode = $object->getAction();
     //Get the data from the node
     $currentNodeData = $currentNode->getData();
     $index = 0;
     while ($index < sizeof($actionPacketarray)) {
         //Get the Node
         $compareNode = $actionPacketarray[$index]->getAction();
         //Get the data from the node
         $compareNodeData = $compareNode->getData();
         //If we have a match we want to remove that item from the array
         if (planComparison::compare($compareNodeData[0], $currentNodeData[0])) {
             //Add the actionPacket to the result list
             array_push($actions, $actionPacketarray[$index]);
             $actionPacketarray = arrays::array_chop($actionPacketarray, $index);
         } else {
             // No match!
             $index++;
         }
     }
     //actionPackets not matched
     $result['array'] = $actionPacketarray;
     //actionPackets that matched
     $result['actions'] = $actions;
     return $result;
 }