/// <summary> /// Creates a copy of the given part. /// </summary> /// <param name="toCopy"></param> public Part(Part toCopy) : this(toCopy.AllValues) { CurrentValidValues.AddRange(toCopy.CurrentValidValues); IsAssigned = toCopy.IsAssigned; AssignedValue = toCopy.AssignedValue; }
public Constraint(Func<object, object, bool> satisified, Part p1, Part p2) { Satisfied = satisified; Part1 = p1; Part2 = p2; }
/// <summary> /// Returns a list of constraints with the given variable. /// </summary> /// <param name="var">Variable to check for in each constraint</param> /// <param name="excludeThisConstraint">A constraint to ignore</param> /// <param name="constraints">List of constraints to check</param> /// <returns>The constraints that have var as a variable, excluding excludeThisConstraint</returns> private IEnumerable<Constraint> ConstraintsWith(Part part, Constraint excludeThisConstraint, IEnumerable<Constraint> constraints) { List<Constraint> toReturn = new List<Constraint>(); foreach (Constraint c in constraints) { if ((c.Part1 == part || c.Part2 == part) && c != excludeThisConstraint) { toReturn.Add(c); } //else if (c.Part2 == part && c != excludeThisConstraint) //{ // toReturn.Add(c); // //Constraint reverse = Reverse(constraints, c); // //if(reverse != excludeThisConstraint) // // toReturn.Add(reverse); //} } return toReturn; }