com.limegroup.gnutella.downloader
Class Interval

java.lang.Object
  extended bycom.limegroup.gnutella.downloader.Interval
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class Interval
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

The half-open interval [low, high) inclusive on the low end.

See Also:
Serialized Form

Field Summary
 int high
           
 int low
          INVARIANT: low<=high
 
Constructor Summary
Interval(int singleton)
           
Interval(int low, int high)
           
 
Method Summary
 boolean adjacent(Interval other)
          True if this and other are adjacent, i.e.
 int compareTo(java.lang.Object o)
          Compares this to another interval by the 'low' element of the interval.
 boolean equals(java.lang.Object o)
           
 boolean overlaps(Interval other)
          True if this and other overlap.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

low

public int low
INVARIANT: low<=high


high

public int high
Constructor Detail

Interval

public Interval(int low,
                int high)

Interval

public Interval(int singleton)
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Compares this to another interval by the 'low' element of the interval. If the low elements are the same, then the high element is compared.

Specified by:
compareTo in interface java.lang.Comparable

adjacent

public boolean adjacent(Interval other)
True if this and other are adjacent, i.e. the high end of one equals the low end of the other.


overlaps

public boolean overlaps(Interval other)
True if this and other overlap.


toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object o)