Ejemplo n.º 1
0
 public void AddConstraintToList(Constraint c, ConstraintList a)
 {
     if (c is Var)
     {
         // Update the constraint list associated with this particular variable
         // to now be "a".
         string sVar = c.ToString();
         Trace.Assert(mLookup.ContainsKey(sVar));
         ConstraintList list = mLookup[sVar];
         if (list == a)
         {
             Err("Internal error, expected constraint list to contain constraint " + c.ToString());
         }
         mLookup[sVar] = a;
     }
     if (a.Contains(c))
     {
         return;
     }
     foreach (Constraint k in a)
     {
         AddSubConstraints(k, c);
     }
     a.Add(c);
 }
Ejemplo n.º 2
0
        ConstraintList GetConstraints(string s)
        {
            if (!mLookup.ContainsKey(s))
            {
                ConstraintList a = new ConstraintList();
                a.Add(CreateVar(s));
                mLookup.Add(s, a);
            }

            Trace.Assert(mLookup[s].ContainsVar(s));
            return(mLookup[s]);
        }