org.knime.core.util
Class MutableInteger

java.lang.Object
  extended by java.lang.Number
      extended by org.knime.core.util.MutableInteger
All Implemented Interfaces:
Serializable

public final class MutableInteger
extends Number

This class is essentially an integer whose value can be changed. The hash code and therefore also the equals change dynamically with the value stored. Be patient not to use this object as a key in a hashtable and such.

Author:
Thorsten Meinl, University of Konstanz
See Also:
Serialized Form

Constructor Summary
MutableInteger(int i)
          Creates a new mutable integer.
 
Method Summary
 void add(int value)
          Adds the given value to this mutable integer.
 int dec()
          Decrements this integer by one.
 double doubleValue()
          
 boolean equals(Object obj)
          
 float floatValue()
          
 int hashCode()
          
 int inc()
          Increments this integer by one.
 int intValue()
          
 long longValue()
          
 void setValue(int newValue)
          Sets the value of this integer.
 String toString()
          
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableInteger

public MutableInteger(int i)
Creates a new mutable integer.

Parameters:
i - the start value
Method Detail

intValue

public int intValue()

Specified by:
intValue in class Number

longValue

public long longValue()

Specified by:
longValue in class Number

floatValue

public float floatValue()

Specified by:
floatValue in class Number

doubleValue

public double doubleValue()

Specified by:
doubleValue in class Number

setValue

public void setValue(int newValue)
Sets the value of this integer.

Parameters:
newValue - the new value

inc

public int inc()
Increments this integer by one.

Returns:
the new value

add

public void add(int value)
Adds the given value to this mutable integer.

Parameters:
value - the value to add

dec

public int dec()
Decrements this integer by one.

Returns:
the new value

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.