Beispiel #1
0
 /**
  * Decides if this constraint can be satisfied and which way it
  * should flow based on the relative strength of the variables related,
  * and record that decision.
  */
 function chooseMethod($mark)
 {
     if ($this->v1->mark == $mark) {
         $this->direction = $this->v2->mark != $mark && Strength::stronger($this->strength, $this->v2->walkStrength) ? Direction::FORWARD : Direction::NONE;
     }
     if ($this->v2->mark == $mark) {
         $this->direction = $this->v1->mark != $mark && Strength::stronger($this->strength, $this->v1->walkStrength) ? Direction::BACKWARD : Direction::NONE;
     }
     if (Strength::weaker($this->v1->walkStrength, $this->v2->walkStrength)) {
         $this->direction = Strength::stronger($this->strength, $this->v1->walkStrength) ? Direction::BACKWARD : Direction::NONE;
     } else {
         $this->direction = Strength::stronger($this->strength, $this->v2->walkStrength) ? Direction::FORWARD : Direction::BACKWARD;
     }
 }
Beispiel #2
0
 function chooseMethod($mark)
 {
     if ($this->v1->mark == $mark) {
         $this->direction = $this->v2->mark != $mark && Strength::stronger($this->strength, $this->v2->walkStrength) ? $this->forward : $this->nodirection;
     }
     if ($this->v2->mark == $mark) {
         $this->direction = $this->v1->mark != $mark && Strength::stronger($this->strength, $this->v1->walkStrength) ? $this->backward : $this->nodirection;
     }
     // If we get here, neither variable is marked, so we have a choice.
     if (Strength::weaker($this->v1->walkStrength, $this->v2->walkStrength)) {
         $this->direction = Strength::stronger($this->strength, $this->v1->walkStrength) ? $this->backward : $this->nodirection;
     } else {
         $this->direction = Strength::stronger($this->strength, $this->v2->walkStrength) ? $this->forward : $this->nodirection;
     }
 }