www.sdmetrics.com

sdmetrics.model
Class ModelElement

java.lang.Object
  |
  +--sdmetrics.model.ModelElement

public class ModelElement
extends java.lang.Object

Represent a model element in a UML design. An instance of this class stores the following information for a model element:


Field Summary
static java.lang.String QualifierSep
          Seperator string used to build fully qualified element names.
 
Constructor Summary
ModelElement(sdmetrics.model.MetaModelElement type)
           
 
Method Summary
 java.lang.String getFullName()
          Return the fully qualified name of this model element.
 boolean getLinksIgnored()
          Test if cross-references to this element should be ignored according to the filter settings.
 java.lang.String getName()
          Get the name of this model element.
 java.util.Collection getOwnedElements()
          Get the model elements owned by this element.
 ModelElement getOwner()
          Get the owner of this model element.
 ModelElement getRefAttribute(int num)
          Retrieve the model element referenced by a cross-reference attribute.
 java.util.HashSet getRelations(java.lang.String relname)
          Return the set of model elements that have a certain cross-reference attribute pointing to this model element.
 int getRunningID()
          Return the running ID of the model element.
 java.util.Collection getSetAttribute(int num)
          Retrieve the set stored by a multi-valued attribute.
 int getType()
          Return the ID of the metamodel element of which this element is an instance.
 java.lang.String getXMIID()
          Get the XMI ID of this model element.
 java.lang.String getXMLAttribute(int num)
          Retrieve the value of an attribute for this model element.
 java.lang.String getXMLAttribute(java.lang.String name)
          Retrieve the value of an attribute for this model element.
 java.lang.String toString()
          Return the XMI ID of the model element as its string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QualifierSep

public static final java.lang.String QualifierSep
Seperator string used to build fully qualified element names.

See Also:
Constant Field Values
Constructor Detail

ModelElement

public ModelElement(sdmetrics.model.MetaModelElement type)
Parameters:
type - The metamodel element type of which this element is an instance.
Method Detail

getRelations

public java.util.HashSet getRelations(java.lang.String relname)
Return the set of model elements that have a certain cross-reference attribute pointing to this model element.

Parameters:
relname - Name of the cross-reference attribute.
Returns:
The set of model elements that point to this model element with the specified cross-reference attribute.

getXMLAttribute

public java.lang.String getXMLAttribute(int num)
Retrieve the value of an attribute for this model element.

Parameters:
num - Index of the attribute.
Returns:
Value of the attribute.

getXMLAttribute

public java.lang.String getXMLAttribute(java.lang.String name)
Retrieve the value of an attribute for this model element.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute.

getRefAttribute

public ModelElement getRefAttribute(int num)
Retrieve the model element referenced by a cross-reference attribute.

Parameters:
num - Index of the cross-reference attribute.
Returns:
null if no model element is referenced or the reference should be ignored as per filter settings; else the model element is returned.

getSetAttribute

public java.util.Collection getSetAttribute(int num)
Retrieve the set stored by a multi-valued attribute.

Parameters:
num - Index of the multi-valued attribute.
Returns:
Collection of model elements or values stored by the attribute.

getLinksIgnored

public boolean getLinksIgnored()
Test if cross-references to this element should be ignored according to the filter settings.

Returns:
true if the cross-references to this element should be ignored, else false.

getType

public int getType()
Return the ID of the metamodel element of which this element is an instance.

Returns:
metamodel element ID

getRunningID

public int getRunningID()
Return the running ID of the model element.

Returns:
Running ID of the model element

getFullName

public java.lang.String getFullName()
Return the fully qualified name of this model element. This is the path to the model in the containment hierarchy, with the names of the owner elements separated by dots.

Returns:
Fully name of this model element

getOwner

public ModelElement getOwner()
Get the owner of this model element. Must only be called after crossreferencing the element pool.

Returns:
Owner of the model element. null for root model elements.

getOwnedElements

public java.util.Collection getOwnedElements()
Get the model elements owned by this element. Must only be called after crossreferencing the element pool.

Returns:
A collection of all model elements whose "context" attribute points to this model element.

getXMIID

public java.lang.String getXMIID()
Get the XMI ID of this model element.

Returns:
XMI ID of the model element.

getName

public java.lang.String getName()
Get the name of this model element.

Returns:
Name of the model element (not qualified)

toString

public java.lang.String toString()
Return the XMI ID of the model element as its string representation.

Overrides:
toString in class java.lang.Object

www.sdmetrics.com