Dresden OCL Toolkit

tudresden.ocl.check.types.xmifacade
Class Model

java.lang.Object
  extended bytudresden.ocl.check.types.xmifacade.Model
All Implemented Interfaces:
ModelFacade

public final class Model
extends Object
implements ModelFacade

Implements ModelFacade using model information of a xmi file. The actual Model object can be in one of two modes. In the first mode, called "not rough", the Model has flattened generalization relationships and dissolved associations. In the second mode, called "rough", the Model's generalizations relationships are not flattened and the associations are not dissolved. This mode enables the user of the Model to query the object oriented information from a more structural point of view. Additional notes: An attribute overrides an inherited attribute, if and and only if it has the same name. Ordinary attributes and attributes generated by association partner role names are handled equally. If an ambiguity is caused by this behaviour, the attribute name is marked to be ambiguious for this class, and cannot be used for OCL any more (see OCL spec 5.4.1). This ambiguity is inherited to all classes, which do not override this attribute name. However, overriding such an ambiguious attribute in a subclass makes this attribute available for the subclass and its subclasses again. Overriding attributes is considered to be unnormal, and issues a warning to standard out. An operation overrides an inherited operation, if and only if it has the same signature. The signature consist of the name and a vector of parameter types. Note, that parameter types must be exactly equal. Matching by inheritance is not enough. Overriding an operation with a different return type is considered to be unnormal, and issues a warning to standard out. If you dont like the warnings, edit ModelClass.flatten for your needs.

See Also:
flatten()

Field Summary
static Any AMBIGOUS
          Indicates, that a ModelAttribute is ambiguiuos, thus cannot be used in OCL.
private  HashSet associations
          Set of associations in the model.
private  HashMap classifiers
          Maps classifier names to ModelClass objects.
private  String description
          A description of the source of this model.
private  boolean roughMode
          Flag for the distinction of rough and ordinary models.
 
Constructor Summary
Model(String description)
           
 
Method Summary
 Set associations()
           
 Map classifiers()
           
 void determineAllSupertypes()
          This methode will be called instead of flatten if the model is rough.
 void flatten()
          Flattens all classes in model.
 Any getClassifier(String name)
           
 Set getDirectClassSubtypes(ModelClass mc)
          This methode determines all direct subtypes of a given class in the model.
 boolean isRough()
           
 void printData(PrintStream o)
          Useful for debugging.
 void putAssociation(ModelAssociation association)
           
 void putClassifier(ModelClass modelclass)
           
 void setRoughMode(boolean roughMode)
           
static String strip(String x)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classifiers

private HashMap classifiers
Maps classifier names to ModelClass objects.

See Also:
ModelClass

description

private String description
A description of the source of this model. Usually the xmi file. Should be independent from system environment, so that regression tests have always the same description.


roughMode

private boolean roughMode
Flag for the distinction of rough and ordinary models.


associations

private HashSet associations
Set of associations in the model. If the model is in not rough mode, this variable must be set to null.


AMBIGOUS

public static final Any AMBIGOUS
Indicates, that a ModelAttribute is ambiguiuos, thus cannot be used in OCL.

See Also:
ModelAttribute
Constructor Detail

Model

public Model(String description)
Method Detail

flatten

public void flatten()
Flattens all classes in model.


printData

public void printData(PrintStream o)
Useful for debugging.


putClassifier

public void putClassifier(ModelClass modelclass)

strip

public static String strip(String x)

getClassifier

public Any getClassifier(String name)
Specified by:
getClassifier in interface ModelFacade
Parameters:
name - the name of an application type (not the name of a predefined type, like "Integer"), possibly a "::"-separated path name

toString

public String toString()

setRoughMode

public void setRoughMode(boolean roughMode)
Parameters:
roughMode - true if the model is flattend and dissolved, false otherwise

isRough

public boolean isRough()
Returns:
true if the model is in rough mode, false otherwise

putAssociation

public void putAssociation(ModelAssociation association)
                    throws IllegalStateException
Parameters:
association - an association
Throws:
IllegalStateException - if the model is not in rough mode

classifiers

public Map classifiers()
Returns:
a map containing all classifiers of the model

associations

public Set associations()
                 throws IllegalStateException
Returns:
a set of all associations of the model
Throws:
IllegalStateException - if the model is not in rough mode

determineAllSupertypes

public void determineAllSupertypes()
                            throws IllegalStateException
This methode will be called instead of flatten if the model is rough. It determines all generalization relationships but does no flattening.

Throws:
IllegalStateException - if the model is not in rough mode

getDirectClassSubtypes

public Set getDirectClassSubtypes(ModelClass mc)
                           throws IllegalArgumentException
This methode determines all direct subtypes of a given class in the model.

Parameters:
mc - the class
Returns:
a set that contains all subtypes of the given class
Throws:
IllegalArgumentException - if the class is not contained within this model

Dresden OCL Toolkit

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