com.jrockit.memleak
Class LimitedNumber

java.lang.Object
  extended by java.lang.Number
      extended by com.jrockit.memleak.LimitedNumber
All Implemented Interfaces:
java.io.Serializable

public class LimitedNumber
extends java.lang.Number

A Number implementation to be used as return value for potentially expensive calculations. When the calculation cannot be completed within some given time or complexity limit, the value reached so far can be returned within a LimitedNumber that specifies that it was limited by an external limit.

Author:
mpersson
See Also:
Serialized Form

Field Summary
static LimitedNumber AT_LEAST_ZERO
          Convenience constant for zero, limited.
static LimitedNumber EXACTLY_ZERO
          Convenience constant for zero, not limited.
 
Constructor Summary
LimitedNumber(java.lang.Number value, boolean limited)
           
 
Method Summary
 double doubleValue()
           
 float floatValue()
           
 java.lang.Number getValue()
           
 int intValue()
           
 boolean isLimited()
           
 long longValue()
           
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXACTLY_ZERO

public static final LimitedNumber EXACTLY_ZERO
Convenience constant for zero, not limited.


AT_LEAST_ZERO

public static final LimitedNumber AT_LEAST_ZERO
Convenience constant for zero, limited.

Constructor Detail

LimitedNumber

public LimitedNumber(java.lang.Number value,
                     boolean limited)
Parameters:
value -
limited -
Method Detail

getValue

public java.lang.Number getValue()
Returns:
the Number

isLimited

public boolean isLimited()
Returns:
true iff this number was limited due to some limit

intValue

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

longValue

public long longValue()
Specified by:
longValue 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


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.