public bool Equals( PackedExponentTape t, ExponentComparison ec, bool ignoreTheirSuperfluousLeft, bool ignoreTheirSuperfluousRight) { if (t == null) { return(false); } return(true && LeftSideEqualWith(t, ec, ignoreTheirSuperfluousLeft) && RightSideEqualWith(t, ec, ignoreTheirSuperfluousRight)); }
public bool RightSideEqualWith(PackedExponentTape t, ExponentComparison ec, bool ignoreTheirSuperfluous) { if (t == null) { throw new ArgumentNullException(); } if (_PositionInMacro != t._PositionInMacro) { return(false); } if (FacingRight != t.FacingRight) { return(false); } return(ContentEqualWith(ec, _R.First, t._R.First, ignoreTheirSuperfluous)); }
/// <summary> /// Compare cell contents. /// /// Begin is inclusive, end is exclusive (use null to compare to the end). /// </summary> private bool ContentEqualWith( ExponentComparison ec, Cell tape1, Cell tape2, bool ignoreSuperfluousTape2) { while (tape1 != null) { if (tape2 == null) { return(false); } if (tape1.Data != tape2.Data) { return(false); } if (ec == ExponentComparison.Ignore) { // nothing } else if (ec == ExponentComparison.EqualityOfDirectComponent) { if (tape1.Exponent != tape2.Exponent) { return(false); } } else if (ec == ExponentComparison.TotalEquality) { if (!tape1.Exponent.Equals(tape2.Exponent)) { return(false); } } tape1 = tape1.Next; tape2 = tape2.Next; } if (!ignoreSuperfluousTape2 && tape2 != null) { return(false); } return(true); }
/// <summary> /// Compare cell contents. /// /// Begin is inclusive, end is exclusive (use null to compare to the end). /// </summary> private bool ContentEqualWith ( ExponentComparison ec, Cell tape1, Cell tape2, bool ignoreSuperfluousTape2) { while (tape1 != null) { if (tape2 == null) { return false; } if (tape1.Data != tape2.Data) { return false; } if (ec == ExponentComparison.Ignore) { // nothing } else if (ec == ExponentComparison.EqualityOfDirectComponent) { if (tape1.Exponent != tape2.Exponent) { return false; } } else if (ec == ExponentComparison.TotalEquality) { if (!tape1.Exponent.Equals (tape2.Exponent)) { return false; } } tape1 = tape1.Next; tape2 = tape2.Next; } if (!ignoreSuperfluousTape2 && tape2 != null) { return false; } return true; }
public bool RightSideEqualWith (PackedExponentTape t, ExponentComparison ec, bool ignoreTheirSuperfluous) { if (t == null) throw new ArgumentNullException (); if (_PositionInMacro != t._PositionInMacro) { return false; } if (FacingRight != t.FacingRight) { return false; } return ContentEqualWith (ec, _R.First, t._R.First, ignoreTheirSuperfluous); }
public bool Equals ( PackedExponentTape t, ExponentComparison ec, bool ignoreTheirSuperfluousLeft, bool ignoreTheirSuperfluousRight) { if (t == null) { return false; } return true && LeftSideEqualWith (t, ec, ignoreTheirSuperfluousLeft) && RightSideEqualWith (t, ec, ignoreTheirSuperfluousRight); }