JML

org.jmlspecs.models
Class JMLFloat

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

public strictfp class JMLFloat
extends Object
implements JMLComparable

A reflection of Float that implements JMLType.

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

Field Summary
private  float floatValue
          The float that is the abstract value of this object.
 
Constructor Summary
JMLFloat()
          Initialize this object to contain zero.
JMLFloat(float inFloat)
          Initialize this object to contain the given float.
JMLFloat(int inInt)
          Initialize this object to contain an approximation to the given integer.
JMLFloat(Float inFloat)
          Initialize this object to contain the value of the given Float.
JMLFloat(String s)
          Initialize this object to contain the value given by the string argument.
 
Method Summary
 boolean approximatelyEqualTo(float f2, float epsilon)
          Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.
static boolean approximatelyEqualTo(float f1, float f2, float epsilon)
          Tell whether relative difference of the two arguments is within the given epsilon.
 boolean approximatelyEqualTo(Float f2, float epsilon)
          Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.
 boolean approximatelyEqualTo(JMLFloat f2, float epsilon)
          Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLFloat f1, float f2, float epsilon)
          Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLFloat f1, Float f2, float epsilon)
          Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.
static boolean approximatelyEqualTo(JMLFloat f1, JMLFloat f2, float epsilon)
          Tell whether relative difference of this JMLFloat 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.
 JMLFloat dividedBy(JMLFloat f2)
          Return the quotient of this divided by the given argument.
 boolean equals(Object op2)
          Tell whether this object is equal to the argument.
 float floatValue()
          Return the float contained in this object.
 Float getFloat()
          Return a Float containing the float contained in this object.
 boolean greaterThan(JMLFloat f2)
          Tell whether this is strictly greater than the given argument.
 boolean greaterThanOrEqualTo(JMLFloat f2)
          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(float f)
          Tell if the argument is zero (either positive or negative).
 boolean lessThan(JMLFloat f2)
          Tell whether this is strictly less than the given argument.
 boolean lessThanOrEqualTo(JMLFloat f2)
          Tell whether this is less than or equal to the given argument.
 JMLFloat minus(JMLFloat f2)
          Return the difference between this and the given argument.
 JMLFloat negated()
          Return the negation of this.
 JMLFloat plus(JMLFloat f2)
          Return the sum of this and the given argument.
 JMLFloat remainderBy(JMLFloat f2)
          Return the remainder of this divided by the given argument.
 JMLFloat times(JMLFloat f2)
          Return the product of this and the given argument.
 String toString()
          Return a string representation of this object.
 boolean withinEpsilonOf(float f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
static boolean withinEpsilonOf(float f1, float f2, float epsilon)
          Tell whether absolute value of difference of the two arguments is within the given epsilon.
 boolean withinEpsilonOf(Float f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
 boolean withinEpsilonOf(JMLFloat f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLFloat f1, float f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLFloat f1, Float f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
static boolean withinEpsilonOf(JMLFloat f1, JMLFloat f2, float epsilon)
          Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

floatValue

private float floatValue
The float that is the abstract value of this object.

Constructor Detail

JMLFloat

public JMLFloat()
Initialize this object to contain zero.


JMLFloat

public JMLFloat(float inFloat)
Initialize this object to contain the given float.


JMLFloat

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


JMLFloat

public JMLFloat(Float inFloat)
Initialize this object to contain the value of the given Float.


JMLFloat

public JMLFloat(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 JMLFloat.

isZero

public static boolean isZero(float f)
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

floatValue

public float floatValue()
Return the float contained in this object.


getFloat

public Float getFloat()
Return a Float containing the float contained in this object.


negated

public JMLFloat negated()
Return the negation of this.


plus

public JMLFloat plus(JMLFloat f2)
Return the sum of this and the given argument.


minus

public JMLFloat minus(JMLFloat f2)
Return the difference between this and the given argument.


times

public JMLFloat times(JMLFloat f2)
Return the product of this and the given argument.


dividedBy

public JMLFloat dividedBy(JMLFloat f2)
Return the quotient of this divided by the given argument.


remainderBy

public JMLFloat remainderBy(JMLFloat f2)
Return the remainder of this divided by the given argument.


greaterThan

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


lessThan

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


greaterThanOrEqualTo

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


lessThanOrEqualTo

public boolean lessThanOrEqualTo(JMLFloat f2)
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(JMLFloat f2,
                               float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(JMLFloat f2,
                                    float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

withinEpsilonOf

public boolean withinEpsilonOf(Float f2,
                               float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(Float f2,
                                    float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

withinEpsilonOf

public boolean withinEpsilonOf(float f2,
                               float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public boolean approximatelyEqualTo(float f2,
                                    float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

withinEpsilonOf

public static boolean withinEpsilonOf(float f1,
                                      float f2,
                                      float epsilon)
Tell whether absolute value of difference of the two arguments is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(float f1,
                                           float f2,
                                           float epsilon)
Tell whether relative difference of the two arguments is within the given epsilon.


withinEpsilonOf

public static boolean withinEpsilonOf(JMLFloat f1,
                                      JMLFloat f2,
                                      float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLFloat f1,
                                           JMLFloat f2,
                                           float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

withinEpsilonOf

public static boolean withinEpsilonOf(JMLFloat f1,
                                      Float f2,
                                      float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLFloat f1,
                                           Float f2,
                                           float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

withinEpsilonOf

public static boolean withinEpsilonOf(JMLFloat f1,
                                      float f2,
                                      float epsilon)
Tell whether absolute value of difference of this JMLFloat and the arg is within the given epsilon.


approximatelyEqualTo

public static boolean approximatelyEqualTo(JMLFloat f1,
                                           float f2,
                                           float epsilon)
Tell whether relative difference of this JMLFloat and the arg is within the given epsilon.

See Also:
approximatelyEqualTo(float, float, float)

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.