Dresden OCL Toolkit

tudresden.ocl.lib
Class OclReal

java.lang.Object
  extended bytudresden.ocl.lib.OclAny
      extended bytudresden.ocl.lib.OclReal
All Implemented Interfaces:
Cloneable, Comparable, OclAddable, OclComparable, OclMultiplyable, OclRoot, OclSubtractable
Direct Known Subclasses:
OclInteger

public class OclReal
extends OclAny
implements OclSubtractable, OclMultiplyable, OclAddable, OclComparable, Comparable

This class represents the OCL basic type Real. To implement the the abstract mathematical definition of the OCL specification, this class uses double precision values to hold real numbers.

Author:
Frank Finger

Field Summary
private  double dValue
           
 
Fields inherited from class tudresden.ocl.lib.OclAny
 
Constructor Summary
OclReal(double d)
          Usually it's preferable to use not this constructor but the factory methods of the class Ocl.
OclReal(float f)
          Usually it's preferable to use not this constructor but the factory methods of the class Ocl.
OclReal(int dummy, String reason)
          constructor for undefined OclReal value
 
Method Summary
 OclReal abs()
           
 OclAddable add(OclAddable a)
          This method is only invoked in case of an error: OclReal's add must be called only with an OclReal parameter.
 OclReal add(OclReal or)
           
 int compareTo(Object o)
           
 OclMultiplyable divide(OclMultiplyable m)
          This method is only invoked in case of an error: OclReal's divide must be called only with an OclReal parameter.
 OclReal divide(OclReal or)
           
 OclInteger floor()
           
 double getDouble()
           
 OclRoot getFeature(String name)
          This method returns an undefined value.
 OclBoolean isEqualTo(Object o)
          Two OclReals are equal if their long values are equal and non of them is undefined.
 OclBoolean isGreaterEqual(OclComparable c)
           
 OclBoolean isGreaterThan(OclComparable c)
           
 OclBoolean isLessEqual(OclComparable c)
           
 OclBoolean isLessThan(OclComparable c)
           
 OclBoolean isNotEqualTo(Object o)
          Returns the negated result of isEqualTo.
 OclReal max(OclReal r)
           
 OclReal min(OclReal r)
           
 OclMultiplyable multiply(OclMultiplyable m)
          This method is only invoked in case of an error: OclReal's multiply must be called only with an OclReal parameter.
 OclReal multiply(OclReal or)
           
 OclReal negative()
           
 OclType oclType()
          This property is no longer present in OCL 1.3.
 OclInteger round()
           
 OclReal subtract(OclReal or)
           
 OclSubtractable subtract(OclSubtractable s)
          This method is only invoked in case of an error: OclReal's subtract must be called only with an OclReal parameter.
private  OclReal toOclReal(Object o, String methodname)
           
 
Methods inherited from class tudresden.ocl.lib.OclAny
getFeatureAsCollection, getUndefinedReason, isUndefined, oclAsType, oclInState, oclIsKindOf, oclIsTypeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tudresden.ocl.lib.OclRoot
getFeatureAsCollection, getUndefinedReason, isUndefined
 

Field Detail

dValue

private double dValue
Constructor Detail

OclReal

public OclReal(double d)
Usually it's preferable to use not this constructor but the factory methods of the class Ocl.

See Also:
Ocl.getOclRepresentationFor(double d)

OclReal

public OclReal(float f)
Usually it's preferable to use not this constructor but the factory methods of the class Ocl.

See Also:
Ocl.getOclRepresentationFor(float f)

OclReal

public OclReal(int dummy,
               String reason)
constructor for undefined OclReal value

Method Detail

isEqualTo

public OclBoolean isEqualTo(Object o)
Two OclReals are equal if their long values are equal and non of them is undefined.

Specified by:
isEqualTo in interface OclRoot
Specified by:
isEqualTo in class OclAny

isNotEqualTo

public OclBoolean isNotEqualTo(Object o)
Description copied from interface: OclRoot
Returns the negated result of isEqualTo.

Specified by:
isNotEqualTo in interface OclRoot
Overrides:
isNotEqualTo in class OclAny
Returns:
the negated result of isEqualTo
See Also:
isEqualTo(Object o)

add

public OclAddable add(OclAddable a)
This method is only invoked in case of an error: OclReal's add must be called only with an OclReal parameter.

Specified by:
add in interface OclAddable
See Also:
add(OclReal or)

add

public OclReal add(OclReal or)
Returns:
an instance of OclReal representing the sum of this value and the parameter

subtract

public OclSubtractable subtract(OclSubtractable s)
This method is only invoked in case of an error: OclReal's subtract must be called only with an OclReal parameter.

Specified by:
subtract in interface OclSubtractable
See Also:
subtract(OclReal or)

negative

public OclReal negative()
Returns:
an instance of OclReal representing the value of this OclReal multiplied with -1

subtract

public OclReal subtract(OclReal or)
Returns:
an instance of OclReal representing the result of the subtraction of the parameter from this value

multiply

public OclMultiplyable multiply(OclMultiplyable m)
This method is only invoked in case of an error: OclReal's multiply must be called only with an OclReal parameter.

Specified by:
multiply in interface OclMultiplyable
See Also:
multiply(OclReal or)

multiply

public OclReal multiply(OclReal or)
Returns:
an instance of OclReal representing this value multiplied with the parameter

divide

public OclMultiplyable divide(OclMultiplyable m)
This method is only invoked in case of an error: OclReal's divide must be called only with an OclReal parameter.

Specified by:
divide in interface OclMultiplyable
See Also:
divide(OclReal or)

divide

public OclReal divide(OclReal or)
Returns:
an instance of OclReal representing this value divided by the parameter

abs

public OclReal abs()
Returns:
the absolute value of this value

floor

public OclInteger floor()
Returns:
the largest OclInteger value that is not greater than the argument

round

public OclInteger round()
Returns:
the OclInteger value that is closest to this value

max

public OclReal max(OclReal r)
Returns:
an instance of OclReal representing the maximum value of this value and the parameter

min

public OclReal min(OclReal r)
Returns:
an instance of OclReal representing the miniumum value of this value and the parameter

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Returns:
-1, 0 or 1
Throws:
OclException - if one of the values is undefined
See Also:
Comparable

isLessThan

public OclBoolean isLessThan(OclComparable c)
Specified by:
isLessThan in interface OclComparable
Returns:
an OclBoolean representing true if the OclComparable whos method is called is less than the OclComparable given as parameter, an OclBoolean representing false otherwise

isGreaterThan

public OclBoolean isGreaterThan(OclComparable c)
Specified by:
isGreaterThan in interface OclComparable
Returns:
an OclBoolean representing true if the OclComparable whos method is called is greater than the OclComparable given as parameter, an OclBoolean representing false otherwise

isLessEqual

public OclBoolean isLessEqual(OclComparable c)
Specified by:
isLessEqual in interface OclComparable
Returns:
an OclBoolean representing true if the OclComparable whos method is called is less than or equal to the OclComparable given as parameter, an OclBoolean representing false otherwise

isGreaterEqual

public OclBoolean isGreaterEqual(OclComparable c)
Specified by:
isGreaterEqual in interface OclComparable
Returns:
an OclBoolean representing true if the OclComparable whos method is called is greater than or equal to the OclComparable given as parameter, an OclBoolean representing false otherwise

getDouble

public double getDouble()

getFeature

public OclRoot getFeature(String name)
This method returns an undefined value.

Specified by:
getFeature in interface OclRoot
Specified by:
getFeature in class OclAny

toOclReal

private OclReal toOclReal(Object o,
                          String methodname)

oclType

public OclType oclType()
This property is no longer present in OCL 1.3. In spite of this, the library contains this method. The problems that lead to its cancellation do not occur in this Java implementation.

Overrides:
oclType in class OclAny

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.