net.spy.util
Class Range

java.lang.Object
  extended by net.spy.util.Range
All Implemented Interfaces:
java.lang.Comparable

public class Range
extends java.lang.Object
implements java.lang.Comparable

A range of Comparable objects.


Field Summary
static int EXCLUSIVE
          Match type for exclusive matches.
static int INCLUSIVE
          Match type for inclusive matches.
 
Constructor Summary
Range(java.lang.Comparable lowObject, java.lang.Comparable highObject)
          Get an instance of Range.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean contains(java.lang.Comparable c)
          True if the given object lies within this range.
 boolean equals(java.lang.Object o)
          True if the given object is a Range object that represents the same range.
 java.lang.Comparable getHigh()
          Get the high object.
 int getHighMatch()
          Get the high match type.
 java.lang.Comparable getLow()
          Get the low object.
 int getLowMatch()
          Get the low match type.
 int hashCode()
          Get a predictable hash code.
 void setHighMatch(int hm)
          Set the high match type.
 void setLowMatch(int lm)
          Set the low match type.
 java.lang.String toString()
          Describe this object in Set notation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INCLUSIVE

public static final int INCLUSIVE
Match type for inclusive matches.

See Also:
Constant Field Values

EXCLUSIVE

public static final int EXCLUSIVE
Match type for exclusive matches.

See Also:
Constant Field Values
Constructor Detail

Range

public Range(java.lang.Comparable lowObject,
             java.lang.Comparable highObject)
Get an instance of Range.

Method Detail

getLowMatch

public int getLowMatch()
Get the low match type.


setLowMatch

public void setLowMatch(int lm)
Set the low match type.

Parameters:
lm - either INCLUSIVE or EXCLUSIVE

getHighMatch

public int getHighMatch()
Get the high match type.


setHighMatch

public void setHighMatch(int hm)
Set the high match type.

Parameters:
hm - either INCLUSIVE or EXCLUSIVE

getLow

public java.lang.Comparable getLow()
Get the low object.


getHigh

public java.lang.Comparable getHigh()
Get the high object.


toString

public java.lang.String toString()
Describe this object in Set notation.

Overrides:
toString in class java.lang.Object

contains

public boolean contains(java.lang.Comparable c)
True if the given object lies within this range.


compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable

equals

public boolean equals(java.lang.Object o)
True if the given object is a Range object that represents the same range.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Get a predictable hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
the low object's hash code if it's available, else the high object's hash code


Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.