JML

org.jmlspecs.models
Class JMLDouble

java.lang.Object
  extended byorg.jmlspecs.models.JMLDouble
All Implemented Interfaces:
Cloneable, Comparable, JMLComparable, JMLType, Serializable

public strictfp class JMLDouble
extends Object
implements JMLComparable

A reflection of Double that implements JMLType.

Version:
$Revision: 1.34 $
Author:
Brandon Shilling, Gary T. Leavens, David Cok
See Also:
Double, JMLDouble

Field Summary
private  double doubleValue
          The double that is the abstract value of this object.
 
Constructor Summary
JMLDouble()
          Initialize this object to contain zero.
JMLDouble(double inDouble)
          Initialize this object to contain the given double.
JMLDouble(int inInt)
          Initialize this object to contain an approximation to the given integer.
JMLDouble(Double inDouble)
          Initialize this object to contain the value of the given Double.
JMLDouble(String s)
          Initialize this object to contain the value given by the string argument.
 
Method Summary
 boolean approximatelyEqualTo(double d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
static boolean approximatelyEqualTo(double d1, double d2, double epsilon)
          Tell whether relative difference of the two arguments is within the given epsilon.
 boolean approximatelyEqualTo(Double d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
 boolean approximatelyEqualTo(JMLDouble d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLDouble d1, double d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLDouble d1, Double d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLDouble d1, JMLDouble d2, double epsilon)
          Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.
 Object clone()
          Return a clone of this object.
 int compareTo(Object op2)
          Compare this to op2, returning a comparison code.
 JMLDouble dividedBy(JMLDouble d2)
          Return the quotient of this divided by the given argument.
 double doubleValue()
          Return the double contained in this object.
 boolean equals(Object op2)
          Tell whether this object is equal to the argument.
 Double getDouble()
          Return a Double containing the double contained in this object.
 boolean greaterThan(JMLDouble d2)
          Tell whether this is strictly greater than the given argument.
 boolean greaterThanOrEqualTo(JMLDouble d2)
          Tell whether this is greater than or equal to the given argument.
 int hashCode()
          Return a hash code for this object.
 boolean isInfinite()
          Tell if this object contains either positive or negative infinity.
 boolean isNaN()
          Tell if this object contains NaN (not a number).
 boolean isZero()
          Tell if this object contains zero (either positive or negative).
static boolean isZero(double d)
          Tell if the argument is zero (either positive or negative).
 boolean lessThan(JMLDouble d2)
          Tell whether this is strictly less than the given argument.
 boolean lessThanOrEqualTo(JMLDouble d2)
          Tell whether this is less than or equal to the given argument.
 JMLDouble minus(JMLDouble d2)
          Return the difference between this and the given argument.
 JMLDouble negated()
          Return the negation of this.
 JMLDouble plus(JMLDouble d2)
          Return the sum of this and the given argument.
 JMLDouble remainderBy(JMLDouble d2)
          Return the remainder of this divided by the given argument.
 JMLDouble times(JMLDouble d2)
          Return the product of this and the given argument.
 String toString()
          Return a string representation of this object.
 boolean withinEpsilonOf(double d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
static boolean withinEpsilonOf(double d1, double d2, double epsilon)
          Tell whether absolute value of difference of the two arguments is within the given epsilon.
 boolean withinEpsilonOf(Double d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
 boolean withinEpsilonOf(JMLDouble d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLDouble d1, double d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLDouble d1, Double d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLDouble d1, JMLDouble d2, double epsilon)
          Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

doubleValue

private double doubleValue
The double that is the abstract value of this object.

Constructor Detail

JMLDouble

public JMLDouble()
Initialize this object to contain zero.


JMLDouble

public JMLDouble(double inDouble)
Initialize this object to contain the given double.


JMLDouble

public JMLDouble(int inInt)
Initialize this object to contain an approximation to the given integer.


JMLDouble

public JMLDouble(Double inDouble)
Initialize this object to contain the value of the given Double.


JMLDouble

public JMLDouble(String s)
          throws NumberFormatException
Initialize this object to contain the value given by the string argument.

Throws:
NumberFormatException
Method Detail

isInfinite

public boolean isInfinite()
Tell if this object contains either positive or negative infinity.


isNaN

public boolean isNaN()
Tell if this object contains NaN (not a number).


clone

public Object clone()
Return a clone of this object.

Specified by:
clone in interface JMLType
Overrides:
clone in class Object

compareTo

public int compareTo(Object op2)
              throws ClassCastException
Compare this to op2, returning a comparison code.

Specified by:
compareTo in interface JMLComparable
Parameters:
op2 - the object this is compared to.
Throws:
ClassCastException - when o is not a JMLDouble.

isZero

public static boolean isZero(double d)
Tell if the argument is zero (either positive or negative).


isZero

public boolean isZero()
Tell if this object contains zero (either positive or negative).


equals

public boolean equals(Object op2)
Tell whether this object is equal to the argument.

Specified by:
equals in interface JMLType
Overrides:
equals in class Object

hashCode

public int hashCode()
Return a hash code for this object.

Specified by:
hashCode in interface JMLType
Overrides:
hashCode in class Object

doubleValue

public double doubleValue()
Return the double contained in this object.


getDouble

public Double getDouble()
Return a Double containing the double contained in this object.


negated

public JMLDouble negated()
Return the negation of this.


plus

public JMLDouble plus(JMLDouble d2)
Return the sum of this and the given argument.


minus

public JMLDouble minus(JMLDouble d2)
Return the difference between this and the given argument.


times

public JMLDouble times(JMLDouble d2)
Return the product of this and the given argument.


dividedBy

public JMLDouble dividedBy(JMLDouble d2)
Return the quotient of this divided by the given argument.


remainderBy

public JMLDouble remainderBy(JMLDouble d2)
Return the remainder of this divided by the given argument.


greaterThan

public boolean greaterThan(JMLDouble d2)
Tell whether this is strictly greater than the given argument.


lessThan

public boolean lessThan(JMLDouble d2)
Tell whether this is strictly less than the given argument.


greaterThanOrEqualTo

public boolean greaterThanOrEqualTo(JMLDouble d2)
Tell whether this is greater than or equal to the given argument.


lessThanOrEqualTo

public boolean lessThanOrEqualTo(JMLDouble d2)
Tell whether this is less than or equal to the given argument.


toString

public String toString()
Return a string representation of this object.

Overrides:
toString in class Object

withinEpsilonOf

public boolean withinEpsilonOf(JMLDouble d2,
                               double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(JMLDouble d2,
                                    double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

withinEpsilonOf

public boolean withinEpsilonOf(Double d2,
                               double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(Double d2,
                                    double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

withinEpsilonOf

public boolean withinEpsilonOf(double d2,
                               double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(double d2,
                                    double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

withinEpsilonOf

public static boolean withinEpsilonOf(double d1,
                                      double d2,
                                      double epsilon)
Tell whether absolute value of difference of the two arguments is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(double d1,
                                           double d2,
                                           double epsilon)
Tell whether relative difference of the two arguments is within the given epsilon.


withinEpsilonOf

public static boolean withinEpsilonOf(JMLDouble d1,
                                      JMLDouble d2,
                                      double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLDouble d1,
                                           JMLDouble d2,
                                           double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

withinEpsilonOf

public static boolean withinEpsilonOf(JMLDouble d1,
                                      Double d2,
                                      double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLDouble d1,
                                           Double d2,
                                           double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

withinEpsilonOf

public static boolean withinEpsilonOf(JMLDouble d1,
                                      double d2,
                                      double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLDouble d1,
                                           double d2,
                                           double epsilon)
Tell whether relative difference of this JMLDouble and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(double, double, double)

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.