edu.stanford.nlp.util
Class MutableInteger

java.lang.Object
  extended by java.lang.Number
      extended by edu.stanford.nlp.util.MutableInteger
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MutableInteger>

public final class MutableInteger
extends java.lang.Number
implements java.lang.Comparable<MutableInteger>

A class for Integer objects that you can change.

Author:
Dan Klein
See Also:
Serialized Form

Constructor Summary
MutableInteger()
           
MutableInteger(int i)
           
 
Method Summary
 byte byteValue()
           
 int compareTo(MutableInteger anotherMutableInteger)
          Compares two MutableInteger objects numerically.
 double doubleValue()
           
 boolean equals(java.lang.Object obj)
          Compares this object to the specified object.
 float floatValue()
           
 int hashCode()
           
 void incValue(int val)
          Add the argument to the value of this integer.
 int intValue()
           
 long longValue()
           
 void set(int i)
           
 short shortValue()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableInteger

public MutableInteger()

MutableInteger

public MutableInteger(int i)
Method Detail

set

public void set(int i)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compares this object to the specified object. The result is true if and only if the argument is not null and is an MutableInteger object that contains the same int value as this object. Note that a MutableInteger isn't and can't be equal to an Integer.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(MutableInteger anotherMutableInteger)
Compares two MutableInteger objects numerically.

Specified by:
compareTo in interface java.lang.Comparable<MutableInteger>
Parameters:
anotherMutableInteger - the MutableInteger to be compared.
Returns:
Tthe value 0 if this MutableInteger is equal to the argument MutableInteger; a value less than 0 if this MutableInteger is numerically less than the argument MutableInteger; and a value greater than 0 if this MutableInteger is numerically greater than the argument MutableInteger (signed comparison).

intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

shortValue

public short shortValue()
Overrides:
shortValue in class java.lang.Number

byteValue

public byte byteValue()
Overrides:
byteValue in class java.lang.Number

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class java.lang.Number

incValue

public void incValue(int val)
Add the argument to the value of this integer. A convenience method.

Parameters:
val - Value to be added to this integer


Stanford NLP Group