Dresden OCL Toolkit

tudresden.ocl.lib
Class OclInteger

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

public class OclInteger
extends OclReal

This class represents the basic OCL type Integer. The Integer value is stored in a long attribute, thus restricting the possible values. Please note that OclInteger extends OclReal.

All operations on OclIntegers return undefined values if one or more of the operands is undefined.

Author:
Frank Finger

Field Summary
private  long lValue
           
 
Fields inherited from class tudresden.ocl.lib.OclReal
 
Fields inherited from class tudresden.ocl.lib.OclAny
 
Constructor Summary
OclInteger(int i)
          Usually it's preferable to use this constructor but the factory methods of the class Ocl.
OclInteger(int dummy, String reason)
          constructor for undefined OclInteger value
OclInteger(long l)
          Usually it's preferable to use this constructor but the factory methods of the class Ocl.
 
Method Summary
 OclReal abs()
           
 OclAddable add(OclAddable a)
          This method is only invoked in case of an error: OclInteger's add must be called with an OclInteger parameter.
 OclInteger add(OclInteger i)
           
 OclReal add(OclReal i)
           
 OclInteger div(OclInteger i)
           
 OclReal divide(OclInteger oi)
           
 OclMultiplyable divide(OclMultiplyable m)
          This method is only invoked in case of an error: OclInteger's divide must be called with an OclInteger parameter.
 boolean equals(Object o)
           
 double getDouble()
           
 int getInt()
           
 long getLong()
           
 int hashCode()
           
 OclInteger max(OclInteger i)
           
 OclInteger min(OclInteger i)
           
 OclInteger mod(OclInteger i)
           
 OclInteger multiply(OclInteger oi)
           
 OclMultiplyable multiply(OclMultiplyable m)
          This method is only invoked in case of an error: OclInteger's multiply must be called with an OclInteger parameter.
 OclReal multiply(OclReal oi)
           
 OclReal negative()
           
 OclBoolean oclIsKindOf(OclType type)
          This method returns true if the OclType given as parameter is a type of the object whose method is called or a supertype of such a type.
 OclType oclType()
          This property is no longer present in OCL 1.3.
 OclInteger subtract(OclInteger oi)
           
 OclSubtractable subtract(OclSubtractable s)
          This method is only invoked in case of an error: OclInteger's subtract must be called with an OclInteger parameter.
private  OclInteger toOclInteger(Object o, String methodname)
           
 String toString()
           
 
Methods inherited from class tudresden.ocl.lib.OclReal
compareTo, divide, floor, getFeature, isEqualTo, isGreaterEqual, isGreaterThan, isLessEqual, isLessThan, isNotEqualTo, max, min, round, subtract
 
Methods inherited from class tudresden.ocl.lib.OclAny
getFeatureAsCollection, getUndefinedReason, isUndefined, oclAsType, oclInState, oclIsTypeOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tudresden.ocl.lib.OclRoot
getFeatureAsCollection, getUndefinedReason, isUndefined
 

Field Detail

lValue

private long lValue
Constructor Detail

OclInteger

public OclInteger(int i)
Usually it's preferable to use this constructor but the factory methods of the class Ocl.

See Also:
Ocl.getOclRepresentationFor(int i)

OclInteger

public OclInteger(long l)
Usually it's preferable to use this constructor but the factory methods of the class Ocl.

See Also:
Ocl.getOclRepresentationFor(long l)

OclInteger

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

Method Detail

add

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

Specified by:
add in interface OclAddable
Overrides:
add in class OclReal
See Also:
add(OclInteger or), OclReal.add(OclReal r)

add

public OclInteger add(OclInteger i)
Returns:
an instance of OclInteger represeting the sum of this value and the parameter

add

public OclReal add(OclReal i)
Overrides:
add in class OclReal
Returns:
an instance of OclReal represeting the sum of this value and the parameter

subtract

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

Specified by:
subtract in interface OclSubtractable
Overrides:
subtract in class OclReal
See Also:
subtract(OclInteger or), OclReal.subtract(OclReal r)

subtract

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

negative

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

multiply

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

Specified by:
multiply in interface OclMultiplyable
Overrides:
multiply in class OclReal
See Also:
multiply(OclInteger or), OclReal.multiply(OclReal r)

multiply

public OclInteger multiply(OclInteger oi)
Returns:
an instance of OclInteger representing the product of this value and the parameter

multiply

public OclReal multiply(OclReal oi)
Overrides:
multiply in class OclReal
Returns:
an instance of OclReal representing the product of this value and the parameter

divide

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

Specified by:
divide in interface OclMultiplyable
Overrides:
divide in class OclReal
See Also:
divide(OclInteger or), OclReal.divide(OclReal r)

divide

public OclReal divide(OclInteger oi)
Parameters:
oi - must not be zero
Returns:
this value devided by the parameter

mod

public OclInteger mod(OclInteger i)
Returns:
this modulo the parameter

max

public OclInteger max(OclInteger i)

min

public OclInteger min(OclInteger i)

div

public OclInteger div(OclInteger i)
Parameters:
i - must not be zero
Returns:
the number of times that the parameter completely fits within this value

abs

public OclReal abs()
Overrides:
abs in class OclReal
Returns:
the absolute value of this OclInteger value

getInt

public int getInt()
Returns:
the value of this OclInteger as an int
Throws:
OclException - if this is an undefined OclInteger value

getLong

public long getLong()
Returns:
the value of this OclInteger as an long
Throws:
OclException - if this is an undefined OclInteger value

getDouble

public double getDouble()
Overrides:
getDouble in class OclReal
Returns:
the value of this OclInteger as an double
Throws:
OclException - if this is an undefined OclInteger value

toOclInteger

private OclInteger toOclInteger(Object o,
                                String methodname)

toString

public String toString()

equals

public boolean equals(Object o)

hashCode

public int hashCode()

oclIsKindOf

public OclBoolean oclIsKindOf(OclType type)
Description copied from class: OclAny
This method returns true if the OclType given as parameter is a type of the object whose method is called or a supertype of such a type.

Overrides:
oclIsKindOf in class OclAny
See Also:
OclAny.oclIsKindOf(OclType type)

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 OclReal

Dresden OCL Toolkit

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