Opus5
Class AbstractObject

java.lang.Object
  |
  +--Opus5.AbstractObject
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
AbstractContainer, AbstractGraph.GraphEdge, AbstractGraph.GraphVertex, Association, Chr, Dbl, Int, Lng, ScalesBalancingProblem.Node, Str, Term, ZeroOneKnapsackProblem.Node

public abstract class AbstractObject
extends java.lang.Object
implements Comparable

The AbstractObject class is the base class from which all concrete classes that implement the Comparable interface are derived. This abstract class provides default implementations for various methods declared in the Comparable interface.

Version:
$Id: AbstractObject.java,v 3.2 1998/07/28 13:03:31 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.
See Also:
Comparable

Fields inherited from interface Opus5.Comparable
copyright
 
Constructor Summary
AbstractObject()
           
 
Method Summary
 int compare(Comparable arg)
          Compares this comparable object to the specified comparable object.
protected abstract  int compareTo(Comparable arg)
          Compares this comparable object to the specified comparable object.
 boolean equals(java.lang.Object object)
          Tests whether this comparable object equals the specified object.
 boolean isEQ(Comparable object)
          Tests whether this comparable object is equal to the specified comparable object.
 boolean isGE(Comparable object)
          Tests whether this comparable object is greater than or equal to the specified comparable object.
 boolean isGT(Comparable object)
          Tests whether this comparable object is greater than the specified comparable object.
 boolean isLE(Comparable object)
          Tests whether this comparable object is less than or equal to the specified comparable object.
 boolean isLT(Comparable object)
          Tests whether this comparable object is less than the specified comparable object.
 boolean isNE(Comparable object)
          Tests whether this comparable object is not equal to the specified comparable object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractObject

public AbstractObject()
Method Detail

compareTo

protected abstract int compareTo(Comparable arg)
Compares this comparable object to the specified comparable object. This abstract method is called from the compare method. When this method is called, it shall always be the case that the actual class of this object is the same as the actual class of the specified object.
Parameters:
arg - The object to which this object is compared.
Returns:
An integer less than one if this object is less than the specified one; an integer greater than one if this object is greater than the specified one; and, zero if both objects are equal.
See Also:
compare(Opus5.Comparable)

compare

public final int compare(Comparable arg)
Compares this comparable object to the specified comparable object. If this object and the specified object are instances of the same class, the compareTo is used to do the comparison. If this object and the specified object are instances of different classes, the result is obtained by comparing the names of the classes using the compareTo for strings.
Specified by:
compare in interface Comparable
Parameters:
arg - The comparable object to which this object is compared.
Returns:
An integer less than one if this object is less than the specified one; an integer greater than one if this object is greater than the specified one; and, zero if both objects are equal.
See Also:
compareTo(Opus5.Comparable)

isLT

public final boolean isLT(Comparable object)
Tests whether this comparable object is less than the specified comparable object. This method is implemented as follows:
 return compare (object) <  0;
 
Specified by:
isLT in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is less than the specified one.
See Also:
compare(Opus5.Comparable)

isLE

public final boolean isLE(Comparable object)
Tests whether this comparable object is less than or equal to the specified comparable object. This method is implemented as follows:
 return compare (object) <= 0;
 
Specified by:
isLE in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is less than or equal to the specified one.
See Also:
compare(Opus5.Comparable)

isGT

public final boolean isGT(Comparable object)
Tests whether this comparable object is greater than the specified comparable object. This method is implemented as follows:
 return compare (object) >  0;
 
Specified by:
isGT in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is greater than the specified one.
See Also:
compare(Opus5.Comparable)

isGE

public final boolean isGE(Comparable object)
Tests whether this comparable object is greater than or equal to the specified comparable object. This method is implemented as follows:
 return compare (object) >= 0;
 
Specified by:
isGE in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is greater than or equal to the specified one.
See Also:
compare(Opus5.Comparable)

isEQ

public final boolean isEQ(Comparable object)
Tests whether this comparable object is equal to the specified comparable object. This method is implemented as follows:
 return compare (object) == 0;
 
Specified by:
isEQ in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is equal to the specified one.
See Also:
compare(Opus5.Comparable)

isNE

public final boolean isNE(Comparable object)
Tests whether this comparable object is not equal to the specified comparable object. This method is implemented as follows:
 return compare (object) != 0;
 
Specified by:
isNE in interface Comparable
Parameters:
object - The object with which this object is compared.
Returns:
True if this object is not equal to the specified one.
See Also:
compare(Opus5.Comparable)

equals

public final boolean equals(java.lang.Object object)
Tests whether this comparable object equals the specified object. The argument in this case is not necessarily a comparable object. If the specified object implements the Comparable interface, the isEQ method is called to do the comparsion. Otherwise, the objects are not equal.
Overrides:
equals in class java.lang.Object
Parameters:
object - The object with which this object is compared.
Returns:
True if this object equals the specified one.
See Also:
compare(Opus5.Comparable), Comparable