org.opencyc.util
Class AbstractPair

java.lang.Object
  |
  +--org.opencyc.util.AbstractPair
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Pair

public abstract class AbstractPair
extends java.lang.Object
implements java.io.Serializable

Implements an ordered pair, two associated Objects.

Author:
Bjørn Aldag

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

See Also:
Serialized Form

Field Summary
protected static java.lang.String beginChar
           
 java.lang.Object component1
          The first component of the pair.
 java.lang.Object component2
          The second component of the pair.
protected static java.lang.String endChar
           
protected static java.lang.String separatorChar
           
protected static java.lang.String separators
           
 
Constructor Summary
AbstractPair()
          Constructs an AbstractPair object.
AbstractPair(java.lang.Object component1, java.lang.Object component2)
          Constructs a new pair, with component1 as its first and component2 as its second component.
 
Method Summary
 boolean elementsEqual()
           
 boolean equals(java.lang.Object o)
          Compares the specified object with this AbstractPair for equality.
 int hashCode()
          Returns a hash code value of this pair.
 java.lang.String toString()
          Returns a string representation of this pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

beginChar

protected static final java.lang.String beginChar

endChar

protected static final java.lang.String endChar

separatorChar

protected static final java.lang.String separatorChar

separators

protected static final java.lang.String separators

component1

public java.lang.Object component1
The first component of the pair.

component2

public java.lang.Object component2
The second component of the pair.
Constructor Detail

AbstractPair

public AbstractPair()
Constructs an AbstractPair object.

AbstractPair

public AbstractPair(java.lang.Object component1,
                    java.lang.Object component2)
Constructs a new pair, with component1 as its first and component2 as its second component.
Method Detail

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this AbstractPair for equality.

Returns true if the given object is also a pair with the same components, false otherwise.

Overrides:
equals in class java.lang.Object
Returns:
true if the given object is also a pair with the same components, false otherwise.

elementsEqual

public boolean elementsEqual()

hashCode

public int hashCode()
Returns a hash code value of this pair.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value of this pair.

toString

public java.lang.String toString()
Returns a string representation of this pair.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this pair.