net.cscott.sdr.util
Class Interval
java.lang.Object
net.cscott.sdr.util.Interval
- All Implemented Interfaces:
- Comparable<Interval>
public class Interval
- extends Object
- implements Comparable<Interval>
An interval between two Fraction
s. It is open or closed
as you see fit. Intervals are ordered first by their start,
and then (if two intervals have the same start) by their ends.
The start fraction must always be less than or equal to the end
fraction.
- Version:
- $Id: Interval.java,v 1.2 2006-10-23 16:54:12 cananian Exp $
- Author:
- C. Scott Ananian
start
public final Fraction start
end
public final Fraction end
Interval
public Interval(Fraction start,
Fraction end)
- Create an
Interval
from start
to end
.
The start
parameter must be less than or equal to end
.
compareTo
public int compareTo(Interval i)
- Compare two
Interval
s. Intervals are ordered first by
start, and if the starts are equal, by their ends.
- Specified by:
compareTo
in interface Comparable<Interval>
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2006-2009 C. Scott Ananian