JML

org.jmlspecs.models
Class JMLValueObjectPair

java.lang.Object
  extended byorg.jmlspecs.models.JMLValueObjectPair
All Implemented Interfaces:
Cloneable, JMLType, Serializable

public class JMLValueObjectPair
extends Object
implements JMLType

Pairs of JMLType and Object, used in the types JMLValueToObjectRelation and JMLValueToObjectMap.

In a pair the first element is called the "key" and the second the "value". Both the key and the value in a pair must be non-null.

Version:
$Revision: 1.30 $
Author:
Gary T. Leavens, Clyde Ruby
See Also:
JMLValueToObjectRelation, JMLValueToObjectMap

Field Summary
 JMLType key
          The key of this pair.
 Object value
          The value of this pair.
 
Constructor Summary
JMLValueObjectPair(JMLType dv, Object rv)
          Initialize the key and value of this pair.
 
Method Summary
 Object clone()
          Return a clone of this object.
 boolean equals(Object obj)
          Test whether this object's value is equal to the given argument.
 int hashCode()
          Return a hash code for this object.
 boolean keyEquals(JMLType dv)
          Tell whether this object's key is equal to the given key.
 String toString()
          Return a string representation of this object.
 boolean valueEquals(Object rv)
          Tell whether this object's key is equal to the given key.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

public final JMLType key
The key of this pair.


value

public final Object value
The value of this pair.

Constructor Detail

JMLValueObjectPair

public JMLValueObjectPair(JMLType dv,
                          Object rv)
                   throws NullPointerException
Initialize the key and value of this pair.

Throws:
NullPointerException
Method Detail

clone

public Object clone()
Description copied from interface: JMLType
Return a clone of this object.

Specified by:
clone in interface JMLType
Overrides:
clone in class Object

keyEquals

public boolean keyEquals(JMLType dv)
Tell whether this object's key is equal to the given key.

See Also:
equals(java.lang.Object)

valueEquals

public boolean valueEquals(Object rv)
Tell whether this object's key is equal to the given key.

See Also:
equals(java.lang.Object)

equals

public boolean equals(Object obj)
Test whether this object's value is equal to the given argument.

Specified by:
equals in interface JMLType
Overrides:
equals in class Object
See Also:
keyEquals(org.jmlspecs.models.JMLType)

hashCode

public int hashCode()
Return a hash code for this object.

Specified by:
hashCode in interface JMLType
Overrides:
hashCode in class Object

toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.