Dresden OCL Toolkit

tudresden.ocl.lib
Class OclContainer

java.lang.Object
  extended bytudresden.ocl.lib.OclContainer
All Implemented Interfaces:
Cloneable, OclRoot

public class OclContainer
extends Object
implements OclRoot

This class is a implementation of OclRoot that is backed by a "contained" OclRoot object. That contained object can be changed. OclContainer is necessary for the iterate operation on collections: The accumulator argument is initialized as an instance of OclContainer and can be updated with every iteration step. The method iterate is implemented to update the contained value of the OclContainer every step and return the contained value (NOT the OclContainer) after the iteration is complete.

Author:
Frank Finger
See Also:
OclCollection.iterate(OclIterator iter, OclContainer acc, OclRootEvaluatable eval)

Field Summary
private  OclRoot containedValue
           
 
Constructor Summary
OclContainer(OclRoot o)
          create a new OclContainer that contains the OclRoot object given as argument
 
Method Summary
 OclRoot getFeature(String name)
          calls getFeature of the contained value
 OclCollection getFeatureAsCollection(String name)
          Please consult the documentation of OclRoot.getFeatureAsCollection for a detailed explanation.
 String getUndefinedReason()
          Returns the reason, why this undefined ocl object has been created.
 OclRoot getValue()
          returns the contained value; this method is called inside the method iterate of OclCollection to get the OclRoot that will be returned by that method, and in (inner) classes implementing OclRootEvaluatable to refer to the value of the accumulator
 OclBoolean isEqualTo(Object o)
          two OclContainers are equal if their contained values are equal; usually not the OclContainers themselves should be compared, but their values
 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.
protected  void setValue(OclRoot o)
          sets the contained value to the argument; this method is called inside the method iterate of OclCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

containedValue

private OclRoot containedValue
Constructor Detail

OclContainer

public OclContainer(OclRoot o)
create a new OclContainer that contains the OclRoot object given as argument

Parameters:
o - the initial value to be contained by this OclContainer
Method Detail

isEqualTo

public OclBoolean isEqualTo(Object o)
two OclContainers are equal if their contained values are equal; usually not the OclContainers themselves should be compared, but their values

Specified by:
isEqualTo in interface OclRoot
See Also:
getValue()

isNotEqualTo

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

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

getFeature

public OclRoot getFeature(String name)
calls getFeature of the contained value

Specified by:
getFeature in interface OclRoot
Parameters:
name - the name of the queried attribute
See Also:
OclCollection.collect(OclIterator iter, OclRootEvaluatable eval)

getFeatureAsCollection

public OclCollection getFeatureAsCollection(String name)
Please consult the documentation of OclRoot.getFeatureAsCollection for a detailed explanation.

Specified by:
getFeatureAsCollection in interface OclRoot
See Also:
OclRoot.getFeatureAsCollection(String name)

setValue

protected void setValue(OclRoot o)
sets the contained value to the argument; this method is called inside the method iterate of OclCollection


getValue

public OclRoot getValue()
returns the contained value; this method is called inside the method iterate of OclCollection to get the OclRoot that will be returned by that method, and in (inner) classes implementing OclRootEvaluatable to refer to the value of the accumulator


isUndefined

public boolean isUndefined()
Description copied from interface: OclRoot
Returns true if this object is the result of an undefined OCL expression.

Specified by:
isUndefined in interface OclRoot
Returns:
the result of isUndefined() of the contained value; the OclContainer itself can not be undefined

getUndefinedReason

public final String getUndefinedReason()
Description copied from interface: OclRoot
Returns the reason, why this undefined ocl object has been created.

Specified by:
getUndefinedReason in interface OclRoot
Returns:
the result of getUndefinedReason() of the contained value; the OclContainer itself can not be 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.