Dresden OCL Toolkit

tudresden.ocl.lib
Interface OclRoot

All Superinterfaces:
Cloneable
All Known Subinterfaces:
OclAddable, OclComparable, OclMultiplyable, OclSizable, OclSubtractable
All Known Implementing Classes:
OclAny, OclCollection, OclContainer, OclReal, OclSet, OclString

public interface OclRoot
extends Cloneable

This interface is implemented by those classes of the library representing Predefined OCL Types, and is therefore the return type of all factory methods in Ocl and OclFactory. OclRoot defines operations available for all Predefined Types, i.e. tests for equality, definedness and the operation getFeature.

Author:
Frank Finger
See Also:
getFeature(String s)

Method Summary
 OclRoot getFeature(String name)
          The operation getFeature represents both the query of a property of an application object and the shorthand for collect, depending on the implementing class.
 OclCollection getFeatureAsCollection(String name)
          OCL allows to treat association ends of maximal multiplicity one as Sets.
 String getUndefinedReason()
          Returns the reason, why this undefined ocl object has been created.
 OclBoolean isEqualTo(Object o)
          Returns true if this object is equal to the object given as parameter.
 OclBoolean isNotEqualTo(Object o)
          Returns the negated result of isEqualTo.
 boolean isUndefined()
          Returns true if this object is the result of an undefined OCL expression.
 

Method Detail

getFeature

public OclRoot getFeature(String name)
The operation getFeature represents both the query of a property of an application object and the shorthand for collect, depending on the implementing class. This is to faciliate Java code generation in the case of an OCL expression like "expr.property", where it is not possible to decide without model information if "expr" denotes a Set or Bag, making the result of the expression (that is then the shorthand notation for collect) a Bag, or is it denotes a single object, making the result a Set or some other object. In both cases, a call to this method will be the correct transformation to Java.

Parameters:
name - the name of the queried attribute
See Also:
OclCollection.collect(OclIterator iter, OclRootEvaluatable eval)

getFeatureAsCollection

public OclCollection getFeatureAsCollection(String name)
OCL allows to treat association ends of maximal multiplicity one as Sets. This is useful to check if optional association ends (multiplicity 0..1) are navigable. Therefore, the result type of some navigation expressions can be both OclAny (in this library OclAnyImpl) and Set (OclSet in this library). Which result type is desired can only be derived from the operation applied to the result.

This method should be called instead of getFeature whenever a collection operation, easily recognizable by the "-> ", is applied to the result of a subexpression. It is implemented in OclCollection, OclAny and OclContainer to call getFeature and check if the result is an instance of OclCollection. If it is, it just returns the result; if not, a new OclCollection containing only that result is returned.

See Also:
getFeature(String s)

isEqualTo

public OclBoolean isEqualTo(Object o)
Returns true if this object is equal to the object given as parameter. For definitions of equality for the different types, see the implementing methods. Generally, all basic and collection objects are considered equal if they contain the same value(s), application objects are considered equal if they are identical (==, not equal).


isNotEqualTo

public OclBoolean isNotEqualTo(Object o)
Returns the negated result of isEqualTo.

See Also:
isEqualTo(Object o)

isUndefined

public boolean isUndefined()
Returns true if this object is the result of an undefined OCL expression.


getUndefinedReason

public String getUndefinedReason()
Returns the reason, why this undefined ocl object has been created.

Throws:
RuntimeException - if the onject is not undefined

Dresden OCL Toolkit

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