Click or drag to resize
Interval1D Class
The Interval1D class represents a one-dimensional interval. The interval is Closed, which contains both endpoints. Intervals are immutable: their values cannot be changed after they are created. The class Interval1D includes methods for checking whether an interval contains a point and determining whether two intervals intersect.
Inheritance Hierarchy
SystemObject
  Algs4NetInterval1D

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class Interval1D

The Interval1D type exposes the following members.

Constructors
  NameDescription
Public methodInterval1D
Initializes a closed interval [min, max].
Top
Properties
  NameDescription
Public propertyLength
Returns the length of this interval.
Public propertyMax
Returns the max endpoint of this interval.
Public propertyMin
Returns the min endpoint of this interval.
Top
Methods
  NameDescription
Public methodContains
Returns true if this interval contains the specified value.
Public methodEquals
Compares this transaction to the specified object.
(Overrides ObjectEquals(Object).)
Public methodGetHashCode
Returns an integer hash code for this interval.
(Overrides ObjectGetHashCode.)
Public methodIntersects
Returns true if this interval intersects the specified interval.
Public methodStatic memberMainTest
Demo test the Interval1D data type.
Public methodToString
Returns a string representation of this interval.
(Overrides ObjectToString.)
Top
Fields
  NameDescription
Public fieldStatic memberLENGTH_ORDER
Compares two intervals by length.
Public fieldStatic memberMAX_ENDPOINT_ORDER
Compares two intervals by max endpoint.
Public fieldStatic memberMIN_ENDPOINT_ORDER
Compares two intervals by min endpoint.
Top
Remarks

For additional documentation, see Section 1.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class Interval1D implementation by the respective authors.

See Also