sdr 0.7

net.cscott.sdr.util
Class Interval

java.lang.Object
  extended by net.cscott.sdr.util.Interval
All Implemented Interfaces:
Comparable<Interval>

public class Interval
extends Object
implements Comparable<Interval>

An interval between two Fractions. 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

Field Summary
 Fraction end
           
 Fraction start
           
 
Constructor Summary
Interval(Fraction start, Fraction end)
          Create an Interval from start to end.
 
Method Summary
 int compareTo(Interval i)
          Compare two Intervals.
 boolean equals(Object o)
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

start

public final Fraction start

end

public final Fraction end
Constructor Detail

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.

Method Detail

compareTo

public int compareTo(Interval i)
Compare two Intervals. 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

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian