public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     if ($this->condition_results) {
         $step_instance = $this->step_instances[0];
         if ($step_instance->isDone()) {
             $this->done();
         }
         return false;
     }
     if ($this->elseif_instance && $this->elseif_instance->condition_results) {
         if ($this->elseif_instance->isDone()) {
             $this->done();
         }
         return false;
     }
     if ($this->else_instance) {
         if ($this->else_instance->isDone()) {
             $this->done();
         }
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     if (!count($this->step_instances)) {
         $this->done();
         return false;
     }
     $step_instance = $this->step_instances[0];
     if ($step_instance->isDone()) {
         $this->done();
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     $found_undone = false;
     foreach ($this->step_instances as $index => &$step_instance) {
         if (!$step_instance->isDone()) {
             $found_undone = true;
         } else {
             $this->handleDoneStep($step_instance);
         }
     }
     if (!$found_undone) {
         $this->done();
     }
     return false;
 }
 public function isAvailable()
 {
     if (!parent::isStarted()) {
         return parent::isAvailable();
     }
     foreach ($this->step_instances as $index => $step_instance) {
         if (!$step_instance->isDone()) {
             break;
         }
         //			echo get_class($step_instance) . "(" . $step_instance->getName() . ") is done\n";
         $index++;
         if (count($this->step_instances) <= $index) {
             $this->done();
         } else {
             $next_step =& $this->step_instances[$index];
             $next_step->flow($step_instance->getStepId());
         }
     }
     return false;
 }