Example #1
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('id')) {
         $this->policy->putEntry('id', __CLASS__);
     }
 }
Example #2
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('max_count')) {
         $this->policy->putEntry('max_count', 10);
     }
     $this->counter = 0;
 }
Example #3
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('interval')) {
         $this->policy->putEntry('interval', 1000);
         // 1 millisecond = 1/1000 of a second
     }
     $this->next_time = microtime(true) + Core\Convert::toInteger($this->policy->getValue('interval')) / 1000;
 }
Example #4
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('reverse')) {
         // direction
         $this->policy->putEntry('reverse', false);
     }
     if (!$this->policy->hasKey('steps')) {
         $this->policy->putEntry('steps', 1);
     }
 }
Example #5
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('delay')) {
         $this->policy->putEntry('delay', 0);
         // 1 millisecond = 1/1000 of a second
     }
     if (!$this->policy->hasKey('duration')) {
         $this->policy->putEntry('duration', 1000);
         // 1 millisecond = 1/1000 of a second
     }
     $this->start_time = microtime(true);
 }
Example #6
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('callable')) {
         $this->policy->putEntry('callable', 'rand');
         // ['rand', 'mt_rand']
     }
     if (!$this->policy->hasKey('odds')) {
         $this->policy->putEntry('odds', 0.01);
     }
     if (!$this->policy->hasKey('options')) {
         $this->policy->putEntry('options', 100);
     }
 }
Example #7
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if ($this->policy->hasKey('until')) {
         $until = $this->policy->getValue('until');
         if (is_string($until)) {
             $until = BT\Task\Status::valueOf($until);
         }
         if ($until !== BT\Task\Status::SUCCESS) {
             $until = BT\Task\Status::FAILED;
         }
         $this->policy->putEntry('until', $until);
     } else {
         $this->policy->putEntry('until', BT\Task\Status::SUCCESS);
     }
 }
Example #8
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     if (!$this->policy->hasKey('error')) {
         $this->policy->putEntry('error', false);
     }
     if (!$this->policy->hasKey('inactive')) {
         $this->policy->putEntry('inactive', false);
     }
     if (!$this->policy->hasKey('active')) {
         $this->policy->putEntry('acitve', false);
     }
     if (!$this->policy->hasKey('success')) {
         $this->policy->putEntry('success', true);
     }
 }
Example #9
0
 /**
  * This constructor initializes the class with the specified parameters.
  *
  * @access public
  * @param Common\Mutable\IMap $blackboard                   the blackboard to be used
  * @param Common\Mutable\IMap $policy                       the policy associated with the task
  */
 public function __construct(Common\Mutable\IMap $blackboard = null, Common\Mutable\IMap $policy = null)
 {
     parent::__construct($blackboard, $policy);
     $this->level = Log\Level::informational();
     $this->logger = Log\Manager::instance();
 }