www.sdmetrics.com

com.sdmetrics.model
Class Model

java.lang.Object
  extended by com.sdmetrics.model.Model
All Implemented Interfaces:
java.lang.Iterable<ModelElement>

public class Model
extends java.lang.Object
implements java.lang.Iterable<ModelElement>

Container for the model elements of the UML design to be analyzed. Provides access to the model elements and element filtering based on qualified names.


Constructor Summary
Model(MetaModel metaModel)
          Creates a new, empty model.
 
Method Summary
 java.util.List<ModelElement> getAcceptedElements(MetaModelElement type)
          Returns the list of accepted elements of a given type.
 java.util.List<ModelElement> getElements(MetaModelElement type)
          Returns the list of all elements of a given type.
 MetaModel getMetaModel()
          Retrieves the metamodel on which this model is based.
 java.util.Iterator<ModelElement> iterator()
          Returns an iterator over all model elements of the model, ignoring any filters settings.
 void setFilter(java.lang.String[] filterStrings, boolean acceptMatchingElements, boolean ignoreRelationsToRejectedElements)
          Applies filter settings to the elements of this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Model

public Model(MetaModel metaModel)
Creates a new, empty model.

Parameters:
metaModel - Metamodel that defines the element types and attributes.
Method Detail

setFilter

public void setFilter(java.lang.String[] filterStrings,
                      boolean acceptMatchingElements,
                      boolean ignoreRelationsToRejectedElements)
Applies filter settings to the elements of this model.

Parameters:
filterStrings - The list of element filters to apply. Can be null or empty to disable filtering.
acceptMatchingElements - Set to true to accept elements matching at least on of the element filters. Set to false to accept only elements that matching none of the element filters.
ignoreRelationsToRejectedElements - Set to true to ignore links to rejected elements for metrics calculation, set to false to include links to rejected elements for metrics calculation.

getElements

public java.util.List<ModelElement> getElements(MetaModelElement type)
Returns the list of all elements of a given type. For example, a list of all classes, all packages, etc. This method ignores filter settings, and always returns all model elements.

Parameters:
type - The type ID of the elements to return.
Returns:
A random access list of all elements of the specified type.

getAcceptedElements

public java.util.List<ModelElement> getAcceptedElements(MetaModelElement type)
Returns the list of accepted elements of a given type. If the element filter is active, this method only returns the elements that should appear in the output data tables, as per the filter settings.

Parameters:
type - The type of the elements to return.
Returns:
A random access list of all accepted elements of the specified type.

iterator

public java.util.Iterator<ModelElement> iterator()
Returns an iterator over all model elements of the model, ignoring any filters settings.

Specified by:
iterator in interface java.lang.Iterable<ModelElement>
Returns:
Iterator over all model elements of all types.

getMetaModel

public MetaModel getMetaModel()
Retrieves the metamodel on which this model is based.

Returns:
This model's metamodel.

www.sdmetrics.com