class NumberRange {
/**
* <p>Indicates whether some other <code>Object</code> is
* "equal" to this one.</p>
*
* @param obj the reference object with which to compare
* @return <code>true</code> if this object is the same as the obj
* argument; <code>false</code> otherwise
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (!(obj instanceof NumberRange)) {
return false;
} else {
NumberRange range = (NumberRange)obj;
return min.equals(range.min) && max.equals(range.max);
}
}
}
|