Пример #1
0
        // Decide if I can be satisfied and which way I should flow based on
        // the relative strength of the variables I relate, and record that
        // decision.
        //
        public override void chooseMethod(int mark)
        {
            if (v1.mark == mark)
            {
                direction =
                    v2.mark != mark && Strength.stronger(strength, v2.walkStrength)
            ? forward : nodirection;
            }

            if (v2.mark == mark)
            {
                direction =
                    v1.mark != mark && Strength.stronger(strength, v1.walkStrength)
            ? backward : nodirection;
            }

            // If we get here, neither variable is marked, so we have a choice.
            if (Strength.weaker(v1.walkStrength, v2.walkStrength))
            {
                direction =
                    Strength.stronger(strength, v1.walkStrength) ? backward : nodirection;
            }
            else
            {
                direction =
                    Strength.stronger(strength, v2.walkStrength) ? forward : nodirection;
            }
        }
Пример #2
0
 // Decide if I can be satisfied and record that decision.
 public override void chooseMethod(int mark)
 {
     satisfied = myOutput.mark != mark &&
                 Strength.stronger(strength, myOutput.walkStrength);
 }