Example #1
0
 public override bool Equals(Constraint c, VarNameMap vars)
 {
     if (!(c is Constant))
     {
         return(false);
     }
     return(ToString().Equals(c.ToString()));
 }
Example #2
0
 public override bool Equals(Constraint c, VarNameMap vars)
 {
     if (!(c is Var))
     {
         return(false);
     }
     return(vars.AreVarsEqual(this, c as Var));
 }
Example #3
0
        public override bool Equals(Constraint c, VarNameMap vars)
        {
            if (!(c is Relation))
            {
                return(false);
            }
            Relation r = c as Relation;

            return(mLeft.Equals(r.mLeft, vars) && mRight.Equals(r.mRight, vars));
        }
Example #4
0
        public override bool Equals(Constraint c, VarNameMap vars)
        {
            if (!(c is Vector))
            {
                return(false);
            }
            Vector v = c as Vector;
            int    n = v.GetCount();

            if (n != GetCount())
            {
                return(false);
            }
            for (int i = 0; i < n; ++i)
            {
                Constraint c1 = GetConstraint(i);
                Constraint c2 = v.GetConstraint(i);
                if (!c1.Equals(c2, vars))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #5
0
        private bool CanRollupRelation(Constraint child)
        {
            VarNameMap map = new VarNameMap();

            if (!(child is Relation))
            {
                return(false);
            }

            Relation childRel = child as Relation;

            int n = GetLeft().GetCount();

            if (n != childRel.GetLeft().GetCount())
            {
                return(false);
            }
            for (int i = 0; i < n; ++i)
            {
                Constraint tmp      = GetLeft(i);
                Constraint childTmp = childRel.GetLeft(i);

                if (tmp != child)
                {
                    if (!tmp.Equals(childTmp, map))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!(childTmp is RecursiveRelation))
                    {
                        return(false);
                    }
                }
            }
            n = GetRight().GetCount();
            if (n != childRel.GetRight().GetCount())
            {
                return(false);
            }
            for (int i = 0; i < n; ++i)
            {
                Constraint tmp      = GetRight(i);
                Constraint childTmp = childRel.GetRight(i);

                if (tmp != child)
                {
                    if (!tmp.Equals(childTmp, map))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!(childTmp is RecursiveRelation))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #6
0
 public override bool Equals(Constraint c, VarNameMap vars)
 {
     return(c is RecursiveRelation);
 }
Example #7
0
 public abstract bool Equals(Constraint c, VarNameMap vars);