} // GetHashCode public virtual int CompareTo(AIntervalEdge <TFinite> other) { if (other == null) { throw new ArgumentNullException(); } if (Type == other.Type) { return(Type == EdgeType.Finite ? Value.CompareTo(other.Value) : 0); } switch (Type) { case EdgeType.NegativeInfinity: return(-1); case EdgeType.Finite: return(other.Type == EdgeType.NegativeInfinity ? 1 : -1); case EdgeType.PositiveInfinity: return(1); default: throw new ArgumentOutOfRangeException(); } // switch } // CompareTo
} // Min public virtual AIntervalEdge <TFinite> Max(AIntervalEdge <TFinite> other) { if (ReferenceEquals(other, null)) { throw new ArgumentNullException(); } return(this > other ? this : other); } // Max
public TInterval(AIntervalEdge <TFinite> oLeft, AIntervalEdge <TFinite> oRight) { if (ReferenceEquals(oLeft, null) || ReferenceEquals(oRight, null)) { throw new ArgumentNullException(); } Left = oLeft; Right = oRight; } // constructor
} // IsValueEqualTo protected override bool IsValueLessThan(AIntervalEdge <decimal> other) { return(IsValueLessThan(other.Value)); } // IsValueLessThan
protected override bool IsValueEqualTo(AIntervalEdge <decimal> other) { return(IsValueEqualTo(other.Value)); } // IsValueEqualTo
} // Intersects public virtual bool Contains(AIntervalEdge <TFinite> p) { return((Left <= p) && (p <= Right)); } // Contains
} // IsValueEqualTo protected override bool IsValueLessThan(AIntervalEdge <int> other) { return(Value < other.Value); } // IsValueLessThan
} // Next protected override bool IsValueEqualTo(AIntervalEdge <int> other) { return(Value == other.Value); } // IsValueEqualTo
} // constructor protected DateInterval(AIntervalEdge <DateTime> oLeft, AIntervalEdge <DateTime> oRight) : base(oLeft, oRight) { } // constructor
protected abstract bool IsValueLessThan(AIntervalEdge <TFinite> other);
} // constructor protected abstract bool IsValueEqualTo(AIntervalEdge <TFinite> other);