public override bool Equals(Constraint c, VarNameMap vars) { if (!(c is Constant)) { return(false); } return(ToString().Equals(c.ToString())); }
public override bool Equals(Constraint c, VarNameMap vars) { if (!(c is Var)) { return(false); } return(vars.AreVarsEqual(this, c as Var)); }
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)); }
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); }
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); }
public override bool Equals(Constraint c, VarNameMap vars) { return(c is RecursiveRelation); }
public abstract bool Equals(Constraint c, VarNameMap vars);