예제 #1
0
    public BinaryConstraint() { } // this has to be here because of
                                  // Java's constructor idiocy.

    public BinaryConstraint(Variable var1, Variable var2, Strength strength)
      : base(strength)
    {
        v1 = var1;
        v2 = var2;
        direction = nodirection;
        addConstraint();
    }
예제 #2
0
 public EditConstraint(Variable v, Strength str) : base(v, str) { }
예제 #3
0
 // Install a stay constraint with the given strength on the given variable.
 public StayConstraint(Variable v, Strength str) : base(v, str) { }
예제 #4
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);
 }
예제 #5
0
    public Boolean satisfied; // true if I am currently satisfied

    public UnaryConstraint(Variable v, Strength strength) : base(strength)

    {
        myOutput = v;
        satisfied = false;
        addConstraint();
    }
예제 #6
0
    // Install a constraint with the given strength equating the given variables.
    public EqualityConstraint(Variable var1, Variable var2, Strength strength)
        : base(var1, var2, strength)

    {
    }
예제 #7
0
 public static Strength weakestOf(Strength s1, Strength s2)
 {
     return weaker(s1, s2) ? s1 : s2;
 }
예제 #8
0
 public static Strength strongest(Strength s1, Strength s2)
 {
     return(stronger(s1, s2) ? s1 : s2);
 }
예제 #9
0
        // Install a constraint with the given strength equating the given variables.
        public EqualityConstraint(Variable var1, Variable var2, Strength strength)
            : base(var1, var2, strength)

        {
        }
예제 #10
0
 public static Boolean weaker(Strength s1, Strength s2)
 {
     return(s1._strengthValue > s2._strengthValue);
 }
예제 #11
0
 public static Strength weakestOf(Strength s1, Strength s2)
 {
     return(weaker(s1, s2) ? s1 : s2);
 }
예제 #12
0
 public static Boolean stronger(Strength s1, Strength s2)
 {
     return(s1._strengthValue < s2._strengthValue);
 }
예제 #13
0
 // Install a stay constraint with the given strength on the given variable.
 public StayConstraint(Variable v, Strength str) : base(v, str)
 {
 }
예제 #14
0
 public EditConstraint(Variable v, Strength str) : base(v, str)
 {
 }
예제 #15
0
 public static Boolean stronger(Strength s1, Strength s2)
 {
     return s1._strengthValue < s2._strengthValue;
 }
예제 #16
0
    public String name;             // a symbolic name for reporting purposes


    private Variable(String name, int initialValue, Strength walkStrength,
             int nconstraints)
    {
        value = initialValue;
        constraints = new ArrayList(nconstraints);
        determinedBy = null;
        mark = 0;
        this.walkStrength = walkStrength;
        stay = true;
        this.name = name;
    }
예제 #17
0
 public static Boolean weaker(Strength s1, Strength s2)
 {
     return s1._strengthValue > s2._strengthValue;
 }
예제 #18
0
 // Attempt to assign the given value to me using the given strength.
 public void setValue(int value, Strength strength)
 {
     EditConstraint e = new EditConstraint(this, strength);
     if (e.isSatisfied())
     {
         this.value = value;
         deltablue.planner.propagateFrom(this);
     }
     e.destroyConstraint();
 }
예제 #19
0
    public Variable offset; // offset input variable

    // Install a scale constraint with the given strength on the given variables.
    public ScaleConstraint(Variable src, Variable scale, Variable offset,
                   Variable dest, Strength strength)
    {
        // Curse this wretched language for insisting that constructor invocation
        // must be the first thing in a method...
        // ..because of that, we must copy the code from the inherited
        // constructors.
        this.strength = strength;
        v1 = src;
        v2 = dest;
        direction = nodirection;
        this.scale = scale;
        this.offset = offset;
        addConstraint();
    }
예제 #20
0
    public Constraint() { } // this has to be here because of
                            // Java's constructor idiocy.

    public Constraint(Strength strength)
    {
        this.strength = strength;
    }
예제 #21
0
 public static Strength strongest(Strength s1, Strength s2)
 {
     return stronger(s1, s2) ? s1 : s2;
 }
예제 #22
0
        }                   // this has to be here because of

        // Java's constructor idiocy.

        public Constraint(Strength strength)
        {
            this.strength = strength;
        }