JML

org.jmlspecs.models
Class JMLValueBagEntry

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

class JMLValueBagEntry
extends Object
implements JMLType

Internal class used in the implementation of JMLValueBag.

Author:
Gary T. Leavens
See Also:
JMLValueBag, JMLValueBagEntryNode

Field Summary
 int count
          The number of times the element occurs.
 JMLType theElem
          The element in this bag entry.
 
Constructor Summary
JMLValueBagEntry(JMLType e)
          The type of the element in this entry.
JMLValueBagEntry(JMLType 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(JMLType 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.
 JMLValueBagEntry 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 JMLType theElem
The element in this bag entry.


count

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

Constructor Detail

JMLValueBagEntry

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


JMLValueBagEntry

public JMLValueBagEntry(JMLType 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(JMLType 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 JMLValueBagEntry 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.