JML

org.jmlspecs.models
Class JMLObjectBagEntry

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

class JMLObjectBagEntry
extends Object
implements JMLType

Internal class used in the implementation of JMLObjectBag.

Author:
Gary T. Leavens
See Also:
JMLObjectBag, JMLObjectBagEntryNode

Field Summary
 int count
          The number of times the element occurs.
 Object theElem
          The element in this bag entry.
 
Constructor Summary
JMLObjectBagEntry(Object e)
          The type of the element in this entry.
JMLObjectBagEntry(Object e, int cnt)
          Initialize this object to be for the given element with the given number of repetitions.
 
Method Summary
 Object clone()
          Make a clone of the given entry.
 boolean equalElem(Object othElem)
          Are these elements equal?
 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.
 JMLObjectBagEntry insert(int numInserted)
          Return a new bag entry with the same element as this but with the given number of repetitions added to the element's current count.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

theElem

public final Object theElem
The element in this bag entry.


count

public final int count
The number of times the element occurs.

Constructor Detail

JMLObjectBagEntry

public JMLObjectBagEntry(Object e)
The type of the element in this entry. This is Object if the element is null. Initialize this object to be a singleton entry.


JMLObjectBagEntry

public JMLObjectBagEntry(Object e,
                         int cnt)
Initialize this object to be for the given element with the given number of repetitions.

Method Detail

clone

public Object clone()
Make a clone of the given entry.

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

equalElem

public boolean equalElem(Object othElem)
Are these elements equal?


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

hashCode

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

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

insert

public JMLObjectBagEntry insert(int numInserted)
Return a new bag entry with the same element as this but with the given number of repetitions added to the element's current count.


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.