edu.stanford.nlp.util
Class MutableInteger

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

public final class MutableInteger
extends Number
implements Comparable

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.
 int compareTo(Object o)
          Compares this MutableInteger object to another object.
 double doubleValue()
           
 boolean equals(Object obj)
          Compares this object to the specified object.
 float floatValue()
           
 int hashCode()
           
 int intValue()
           
 long longValue()
           
 void set(int i)
           
 short shortValue()
           
 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 Object

equals

public boolean equals(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 Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

toString

public String toString()
Overrides:
toString in class Object

compareTo

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

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).

compareTo

public int compareTo(Object o)
Compares this MutableInteger object to another object. If the object is an MutableInteger, this function behaves like compareTo(MutableInteger). Otherwise, it throws a ClassCastException (as MutableInteger objects are only comparable to other MutableInteger objects).

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
0/-1/1
Throws:
ClassCastException - if the argument is not an MutableInteger.
See Also:
Comparable

intValue

public int intValue()
Specified by:
intValue in class Number

longValue

public long longValue()
Specified by:
longValue in class Number

shortValue

public short shortValue()
Overrides:
shortValue in class Number

byteValue

public byte byteValue()
Overrides:
byteValue in class Number

floatValue

public float floatValue()
Specified by:
floatValue in class Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class Number


Stanford NLP Group