edu.indiana.iucbrf.casebase
Class Range

java.lang.Object
  extended by edu.indiana.iucbrf.casebase.Range
All Implemented Interfaces:
java.lang.Cloneable

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

A Range object holds two Feature objects. These indicate the lower and upper bound of some range of problem feature values. Actually, Feature objects are abstract, and all Range objects contain objects of some non-abstract subclass of Feature.

A Range object includes the lower bound, and excludes the upper bound.

Use a lowerBound of null for negative infinity, and an upperbound of null for positive infinity.


Constructor Summary
protected Range()
           
  Range(Feature lowerBound, Feature upperBound)
          Creates new Range.
 
Method Summary
 java.lang.Object clone()
          Create a copy of this Range object.
 int compareThisToFeature(Feature featureObject)
          Compare this range to a Feature object.
 Feature getLowerBound()
          Get the lower bound of this range.
 Feature getUpperBound()
          Get the upper bound of this range.
 boolean isInBounds(Feature featureObject)
          Check if a given Feature object is within the bounds of this range (including the lowerBound, excluding the upperBound).
 java.lang.String toString()
          Convert this Range into a String representation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

protected Range()

Range

public Range(Feature lowerBound,
             Feature upperBound)
Creates new Range. For a range that has no lower bound, send null for the lowerBound. Do likewise for the upperBound.

Method Detail

getLowerBound

public Feature getLowerBound()
Get the lower bound of this range.


getUpperBound

public Feature getUpperBound()
Get the upper bound of this range.


isInBounds

public boolean isInBounds(Feature featureObject)
Check if a given Feature object is within the bounds of this range (including the lowerBound, excluding the upperBound).

Parameters:
featureObject - The Feature object in question.

compareThisToFeature

public int compareThisToFeature(Feature featureObject)
Compare this range to a Feature object.
If the Feature object fits in the range, return 0.
If the Feature object is too low for the range, return -1.
If the Feature object is too high for the range, return 1. Note that this method is similar to a compareTo method, except that it compares a Range object to a Feature object.

Parameters:
featureObject - The Feature object to be compared to this Range.

toString

public java.lang.String toString()
Convert this Range into a String representation.

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Create a copy of this Range object.

Overrides:
clone in class java.lang.Object