Class ClosedInterval

java.lang.Object
xal.tools.math.Interval
xal.tools.math.ClosedInterval
All Implemented Interfaces:
Serializable

public class ClosedInterval extends Interval
Represents a closed interval of the real line.
Author:
Christopher K. Allen
See Also:
  • Constructor Details

    • ClosedInterval

      public ClosedInterval()
      Default constructor - creates a new instance of Interval with one point, the origin.
    • ClosedInterval

      public ClosedInterval(double pt)
      Initializing constructor - creates a single point (zero length) interval given by the value of the argument pt.
      Parameters:
      pt - The single point contained in the interval
    • ClosedInterval

      public ClosedInterval(double min, double max) throws MathException
      Initializing constructor - create a new open interval with specified endpoints.
      Parameters:
      min - left endpoint
      max - right endpoint
      Throws:
      MathException - max is smaller than min
    • ClosedInterval

      public ClosedInterval(Interval interval) throws MathException
      Copy constructor - create a new open interval initialized to the argument.
      Parameters:
      interval - interval to copy
      Throws:
      MathException - malformed interval to copy
  • Method Details

    • membership

      public boolean membership(double x)
      Is point a member of the open interval
      Overrides:
      membership in class Interval
      Parameters:
      x - point to test for membership
      Returns:
      true if x is in interval
    • intersect

      public boolean intersect(ClosedInterval interval)
      Is there a nonzero intersection between this interval and the argument.
      Parameters:
      interval - interval to be tested
      Returns:
      true if the intervals intersect
    • contains

      public boolean contains(ClosedInterval interval)
      Is the given interval a subset of this interval.
      Parameters:
      interval - interval under test
      Returns:
      true if Ithis, false otherwise.
      Since:
      Apr 27, 2011
    • equals

      public boolean equals(Object obj)
      Are intervals equal
      Overrides:
      equals in class Interval
      Parameters:
      I - interval object to be checked for equality
      Returns:
      true if both objects are equal as intervals
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Interval
    • toString

      public String toString()
      Return the contents of the interval as a String. return string representation of interval
      Overrides:
      toString in class Interval
      See Also: