org.knime.core.util
Class MutableDouble

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

public final class MutableDouble
extends Number

This class is essentially a double 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
MutableDouble(double i)
          Creates a new mutable double.
 
Method Summary
 void add(double d)
          Adds a value to this object.
 double dec()
          Decrements this double by one.
 double doubleValue()
          
 boolean equals(Object obj)
          
 float floatValue()
          
 int hashCode()
          
 double inc()
          Increments this double by one.
 int intValue()
          
 long longValue()
          
 void setValue(double newValue)
          Sets the value of this double.
 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

MutableDouble

public MutableDouble(double i)
Creates a new mutable double.

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(double newValue)
Sets the value of this double.

Parameters:
newValue - the new value

inc

public double inc()
Increments this double by one.

Returns:
the new value

dec

public double dec()
Decrements this double 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

add

public void add(double d)
Adds a value to this object.

Parameters:
d - a double value


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.