org.argouml.model.uml.foundation.core
Class CoreHelper

java.lang.Object
  extended byorg.argouml.model.uml.foundation.core.CoreHelper

public class CoreHelper
extends java.lang.Object

Helper class for UML Foundation::Core Package. Current implementation is a placeholder.

Since:
ARGO0.11.2

Field Summary
protected static org.apache.log4j.Category cat
           
 
Method Summary
 ru.novosoft.uml.foundation.core.MDependency buildSupportDependency(ru.novosoft.uml.foundation.core.MModelElement from, ru.novosoft.uml.foundation.core.MModelElement to)
          Builds a dependency with stereotype support
 java.util.Collection getAllAttributes(ru.novosoft.uml.foundation.core.MClassifier clazz)
          Returns all attributes of some classifier clazz and of its parents
 java.util.Collection getAllBehavioralFeatures()
          Returns all behavioralfeatures found in the projectbrowser model
 java.util.Collection getAllBehavioralFeatures(ru.novosoft.uml.foundation.core.MClassifier clazz)
          Returns all behavioralfeatures found in this classifier and its children
 java.util.Collection getAllBehavioralFeatures(ru.novosoft.uml.foundation.core.MModelElement element)
          Returns all behavioralfeatures found in this element and its children
 java.util.Collection getAllClasses()
          Returns all classes found in the projectbrowser model
 java.util.Collection getAllClasses(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all classes found in this namespace and in its children
 java.util.Collection getAllClassifiers()
          Returns all classifiers found in the projectbrowser model
 java.util.Collection getAllClassifiers(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all classifiers found in this namespace and in its children
 java.util.Collection getAllComponents()
          Returns all components found in the projectbrowser model
 java.util.Collection getAllComponents(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all components found in this namespace and in its children
 java.util.Collection getAllContents(ru.novosoft.uml.foundation.core.MClassifier clazz)
          Returns the contents (owned elements) of this classifier and all its parents as specified in section 2.5.3.8 of the UML 1.3 spec
 java.util.Collection getAllDataTypes()
          Returns all datatypes found in the projectbrowser model
 java.util.Collection getAllDataTypes(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all components found in this namespace and in its children
 java.util.Collection getAllInterfaces()
          Returns all interfaces found in the projectbrowser model
 java.util.Collection getAllInterfaces(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all interfaces found in this namespace and in its children
 java.util.Collection getAllNodes()
          Returns all nodes found in the projectbrowser model
 java.util.Collection getAllNodes(ru.novosoft.uml.foundation.core.MNamespace ns)
          Returns all components found in this namespace and in its children
 java.util.Collection getAllPossibleNamespaces(ru.novosoft.uml.foundation.core.MModelElement m)
          Returns all possible namespaces that may be selected by some given modelelement m.
 java.util.Collection getAllRealizedInterfaces(java.lang.Object o)
          Returns all interfaces that are realized by the given class or by its superclasses.
 java.util.Collection getAllSupertypes(ru.novosoft.uml.foundation.core.MClassifier cls)
          This method returns all Classifiers of which this class is a direct or indirect subtype.
 java.util.Collection getAssociatedClassifiers(ru.novosoft.uml.foundation.core.MClassifier classifier)
          Gets all classifiers that are associated to the given classifier (have an association relationship with the classifier).
 java.util.Collection getAssociateEnds(ru.novosoft.uml.foundation.core.MClassifier classifier)
          This method returns all opposite AssociationEnds of a given Classifier
 java.util.Collection getAssociateEndsInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
          This method returns all opposite AssociationEnds of a given Classifier, including inherited
 ru.novosoft.uml.foundation.core.MAssociationEnd getAssociationEnd(ru.novosoft.uml.foundation.core.MClassifier type, ru.novosoft.uml.foundation.core.MAssociation assoc)
          Returns the associationend between some classifier type and some associaton assoc.
 java.util.Collection getAssociations(ru.novosoft.uml.foundation.core.MClassifier from, ru.novosoft.uml.foundation.core.MClassifier to)
          Gets the associations between the classifiers from and to.
 java.util.Collection getAssociations(java.lang.Object oclassifier)
          Returns all associations for some classifier
 java.util.Collection getAttributes(ru.novosoft.uml.foundation.core.MClassifier classifier)
          This method returns all attributes of a given Classifier.
 java.util.Collection getAttributesInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
          This method returns all attributes of a given Classifier, including inherited
 java.util.Collection getBaseClasses(java.lang.Object o)
          Returns the base classes (that are the classes that do not have any generalizations) for some given namespace.
 java.util.Collection getChildren(java.lang.Object o)
          Returns all children from some given generalizableelement on all levels (the complete tree excluding the generalizable element itself).
 java.util.Collection getDependencies(java.lang.Object supplierObj, java.lang.Object clientObj)
          Returns the dependencies between some supplier modelelement and some client modelelement.
 ru.novosoft.uml.foundation.core.MModelElement getDestination(ru.novosoft.uml.foundation.core.MRelationship relation)
          Returns the destination of a relation.
 java.util.Collection getExtendedClassifiers(ru.novosoft.uml.foundation.core.MGeneralizableElement clazz)
          Returns all classes some generalizable element clazz extends.
 java.util.Collection getExtendingClassifiers(ru.novosoft.uml.foundation.core.MClassifier clazz)
          Returns all classifiers that extend some classifier clazz.
 java.util.Collection getExtendingElements(ru.novosoft.uml.foundation.core.MGeneralizableElement clazz)
          Returns all elements that extend some class clazz.
 java.lang.String getFeatureName(java.lang.Object o)
          This method returns the name of a feature.
 ru.novosoft.uml.foundation.core.MNamespace getFirstSharedNamespace(ru.novosoft.uml.foundation.core.MNamespace ns1, ru.novosoft.uml.foundation.core.MNamespace ns2)
          Gets the first namespace two namespaces share.
 java.util.Collection getFlows(ru.novosoft.uml.foundation.core.MModelElement source, ru.novosoft.uml.foundation.core.MModelElement target)
          Returns all flows from some source modelelement to a target modelelement.
 ru.novosoft.uml.foundation.core.MGeneralization getGeneralization(ru.novosoft.uml.foundation.core.MGeneralizableElement child, ru.novosoft.uml.foundation.core.MGeneralizableElement parent)
          Gets the generalization between two generalizable elements.
static CoreHelper getHelper()
          Singleton instance access method.
 java.util.Collection getOperations(java.lang.Object classifier)
          This method returns all operations of a given Classifier
 java.util.Collection getOperationsInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
          This method returns all operations of a given Classifier, including inherited
 java.util.Collection getRealizedInterfaces(ru.novosoft.uml.foundation.core.MClassifier clazz)
          Return all interfaces the given class realizes.
 java.util.Collection getRelationships(ru.novosoft.uml.foundation.core.MModelElement source, ru.novosoft.uml.foundation.core.MModelElement dest)
          Returns all relationships between the source and dest modelelement and vica versa.
 ru.novosoft.uml.foundation.core.MParameter getReturnParameter(ru.novosoft.uml.foundation.core.MOperation operation)
          this method finds all paramters of the given operation which have the MParamterDirectionType RETURN.
 java.util.Collection getReturnParameters(ru.novosoft.uml.foundation.core.MOperation operation)
          Returns all return parameters for an operation.
 ru.novosoft.uml.foundation.core.MModelElement getSource(ru.novosoft.uml.foundation.core.MRelationship relation)
          Returns the source of a relation.
 ru.novosoft.uml.foundation.core.MOperation getSpecification(java.lang.Object object)
          Returns the operation that some method realized.
 java.util.Collection getSpecifications(ru.novosoft.uml.foundation.core.MClassifier cls)
          Returns all Interfaces of which this class is a realization.
 java.util.Collection getSubtypes(ru.novosoft.uml.foundation.core.MClassifier cls)
          This method returns all Classifiers of which this class is a direct supertype.
 java.util.Collection getSupertypes(java.lang.Object ogeneralizableelement)
          This method returns all Classifiers of which this class is a direct subtype.
 boolean isMethod(java.lang.Object o)
          This method returns if the object is a method.
 boolean isOperation(java.lang.Object o)
          This method returns if the object is an operation.
 boolean isValidNamespace(java.lang.Object mObj, java.lang.Object nsObj)
          Returns true if some modelelement may be owned by the given namespace
 void removeFeature(java.lang.Object cls, java.lang.Object feature)
          This method removes a feature from a classifier.
 void setReturnParameter(ru.novosoft.uml.foundation.core.MOperation operation, ru.novosoft.uml.foundation.core.MParameter newReturnParameter)
          Build a returnparameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static org.apache.log4j.Category cat
Method Detail

getHelper

public static CoreHelper getHelper()
Singleton instance access method.


getAllSupertypes

public java.util.Collection getAllSupertypes(ru.novosoft.uml.foundation.core.MClassifier cls)
This method returns all Classifiers of which this class is a direct or indirect subtype.

Parameters:
cls - the class you want to have the parents for
Returns:
a collection of the parents, each of which is a MGeneralizableElement

getSupertypes

public java.util.Collection getSupertypes(java.lang.Object ogeneralizableelement)
This method returns all Classifiers of which this class is a direct subtype.

Returns:
a collection of the parents, each of which is a MGeneralizableElement

getAssociateEnds

public java.util.Collection getAssociateEnds(ru.novosoft.uml.foundation.core.MClassifier classifier)
This method returns all opposite AssociationEnds of a given Classifier

Parameters:
classifier - the classifier you want to have the opposite association ends for
Returns:
a collection of the opposite associationends

getAssociateEndsInh

public java.util.Collection getAssociateEndsInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
This method returns all opposite AssociationEnds of a given Classifier, including inherited

Parameters:
classifier - the classifier you want to have the opposite association ends for
Returns:
a collection of the opposite associationends

removeFeature

public void removeFeature(java.lang.Object cls,
                          java.lang.Object feature)
This method removes a feature from a classifier.

Parameters:
feature -

getFeatureName

public java.lang.String getFeatureName(java.lang.Object o)
This method returns the name of a feature.

Returns:
name

isMethod

public boolean isMethod(java.lang.Object o)
This method returns if the object is a method.

Returns:
true if it's a method, false if not

isOperation

public boolean isOperation(java.lang.Object o)
This method returns if the object is an operation.

Returns:
true if it's an operation, false if not

getOperations

public java.util.Collection getOperations(java.lang.Object classifier)
This method returns all operations of a given Classifier

Parameters:
classifier - the classifier you want to have the operations for
Returns:
a collection of the operations

getAttributes

public java.util.Collection getAttributes(ru.novosoft.uml.foundation.core.MClassifier classifier)
This method returns all attributes of a given Classifier.

Parameters:
classifier - the classifier you want to have the attributes for
Returns:
a collection of the attributes

getAttributesInh

public java.util.Collection getAttributesInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
This method returns all attributes of a given Classifier, including inherited

Parameters:
classifier - the classifier you want to have the attributes for
Returns:
a collection of the attributes

getOperationsInh

public java.util.Collection getOperationsInh(ru.novosoft.uml.foundation.core.MClassifier classifier)
This method returns all operations of a given Classifier, including inherited

Parameters:
classifier - the classifier you want to have the operations for
Returns:
a collection of the operations

getReturnParameter

public ru.novosoft.uml.foundation.core.MParameter getReturnParameter(ru.novosoft.uml.foundation.core.MOperation operation)
this method finds all paramters of the given operation which have the MParamterDirectionType RETURN. If it is only one, it is returned. In case there are no return parameters, null is returned. If there is more than one return paramter, first of them is returned, but a message is logged.

Parameters:
operation - the operation you want to find the return parameter for
Returns:
If this operation has only one paramter with Kind: RETURN, this is it, otherwise null

getReturnParameters

public java.util.Collection getReturnParameters(ru.novosoft.uml.foundation.core.MOperation operation)
Returns all return parameters for an operation.

Parameters:
operation -
Returns:
Collection

getSpecification

public ru.novosoft.uml.foundation.core.MOperation getSpecification(java.lang.Object object)
Returns the operation that some method realized. Returns null if object isn't a method or, possibly, if the method isn't properly defined.

Parameters:
object - the method you want the realized operation of.
Returns:
an operation, or null.

getSpecifications

public java.util.Collection getSpecifications(ru.novosoft.uml.foundation.core.MClassifier cls)
Returns all Interfaces of which this class is a realization.

Parameters:
cls - the class you want to have the interfaces for
Returns:
a collection of the Interfaces

getSubtypes

public java.util.Collection getSubtypes(ru.novosoft.uml.foundation.core.MClassifier cls)
This method returns all Classifiers of which this class is a direct supertype.

Parameters:
cls - the class you want to have the children for
Returns:
a collection of the children, each of which is a MGeneralizableElement

setReturnParameter

public void setReturnParameter(ru.novosoft.uml.foundation.core.MOperation operation,
                               ru.novosoft.uml.foundation.core.MParameter newReturnParameter)
Build a returnparameter. Removes all current return parameters from the operation and adds the supplied parameter. The directionkind of the parameter will be return. The name will be equal to the name of the last found return parameter or the default value "return" if no return parameter was present in the operation.

Parameters:
operation -
newReturnParameter -

buildSupportDependency

public ru.novosoft.uml.foundation.core.MDependency buildSupportDependency(ru.novosoft.uml.foundation.core.MModelElement from,
                                                                          ru.novosoft.uml.foundation.core.MModelElement to)
Builds a dependency with stereotype support


getAllBehavioralFeatures

public java.util.Collection getAllBehavioralFeatures(ru.novosoft.uml.foundation.core.MModelElement element)
Returns all behavioralfeatures found in this element and its children

Returns:
Collection

getAllBehavioralFeatures

public java.util.Collection getAllBehavioralFeatures(ru.novosoft.uml.foundation.core.MClassifier clazz)
Returns all behavioralfeatures found in this classifier and its children

Returns:
Collection

getAllBehavioralFeatures

public java.util.Collection getAllBehavioralFeatures()
Returns all behavioralfeatures found in the projectbrowser model

Returns:
Collection

getAllInterfaces

public java.util.Collection getAllInterfaces()
Returns all interfaces found in the projectbrowser model

Returns:
Collection

getAllInterfaces

public java.util.Collection getAllInterfaces(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all interfaces found in this namespace and in its children

Returns:
Collection

getAllClasses

public java.util.Collection getAllClasses()
Returns all classes found in the projectbrowser model

Returns:
Collection

getAllClasses

public java.util.Collection getAllClasses(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all classes found in this namespace and in its children

Returns:
Collection

getRealizedInterfaces

public java.util.Collection getRealizedInterfaces(ru.novosoft.uml.foundation.core.MClassifier clazz)
Return all interfaces the given class realizes.

Parameters:
clazz -
Returns:
Collection

getExtendedClassifiers

public java.util.Collection getExtendedClassifiers(ru.novosoft.uml.foundation.core.MGeneralizableElement clazz)
Returns all classes some generalizable element clazz extends.

Parameters:
clazz -
Returns:
Collection

getGeneralization

public ru.novosoft.uml.foundation.core.MGeneralization getGeneralization(ru.novosoft.uml.foundation.core.MGeneralizableElement child,
                                                                         ru.novosoft.uml.foundation.core.MGeneralizableElement parent)
Gets the generalization between two generalizable elements. Returns null if there is none.

Parameters:
child -
parent -
Returns:
MGeneralization

getFlows

public java.util.Collection getFlows(ru.novosoft.uml.foundation.core.MModelElement source,
                                     ru.novosoft.uml.foundation.core.MModelElement target)
Returns all flows from some source modelelement to a target modelelement.

Parameters:
source -
target -
Returns:
Collection

getExtendingElements

public java.util.Collection getExtendingElements(ru.novosoft.uml.foundation.core.MGeneralizableElement clazz)
Returns all elements that extend some class clazz.

Parameters:
clazz -
Returns:
Collection

getExtendingClassifiers

public java.util.Collection getExtendingClassifiers(ru.novosoft.uml.foundation.core.MClassifier clazz)
Returns all classifiers that extend some classifier clazz.

Parameters:
clazz -
Returns:
Collection

getAllComponents

public java.util.Collection getAllComponents()
Returns all components found in the projectbrowser model

Returns:
Collection

getAllComponents

public java.util.Collection getAllComponents(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all components found in this namespace and in its children

Returns:
Collection

getAllDataTypes

public java.util.Collection getAllDataTypes()
Returns all datatypes found in the projectbrowser model

Returns:
Collection

getAllDataTypes

public java.util.Collection getAllDataTypes(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all components found in this namespace and in its children

Returns:
Collection

getAllNodes

public java.util.Collection getAllNodes()
Returns all nodes found in the projectbrowser model

Returns:
Collection

getAllNodes

public java.util.Collection getAllNodes(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all components found in this namespace and in its children

Returns:
Collection

getAssociatedClassifiers

public java.util.Collection getAssociatedClassifiers(ru.novosoft.uml.foundation.core.MClassifier classifier)
Gets all classifiers that are associated to the given classifier (have an association relationship with the classifier).

Parameters:
classifier -
Returns:
Collection

getAssociations

public java.util.Collection getAssociations(ru.novosoft.uml.foundation.core.MClassifier from,
                                            ru.novosoft.uml.foundation.core.MClassifier to)
Gets the associations between the classifiers from and to. Returns null if from or to is null or if there is no association between them.

Parameters:
from -
to -
Returns:
MAssociation

getAllClassifiers

public java.util.Collection getAllClassifiers()
Returns all classifiers found in the projectbrowser model

Returns:
Collection

getAllClassifiers

public java.util.Collection getAllClassifiers(ru.novosoft.uml.foundation.core.MNamespace ns)
Returns all classifiers found in this namespace and in its children

Returns:
Collection

getAssociations

public java.util.Collection getAssociations(java.lang.Object oclassifier)
Returns all associations for some classifier

Returns:
Collection

getAssociationEnd

public ru.novosoft.uml.foundation.core.MAssociationEnd getAssociationEnd(ru.novosoft.uml.foundation.core.MClassifier type,
                                                                         ru.novosoft.uml.foundation.core.MAssociation assoc)
Returns the associationend between some classifier type and some associaton assoc.

Parameters:
type -
assoc -
Returns:
MAssociationEnd

getAllContents

public java.util.Collection getAllContents(ru.novosoft.uml.foundation.core.MClassifier clazz)
Returns the contents (owned elements) of this classifier and all its parents as specified in section 2.5.3.8 of the UML 1.3 spec

Parameters:
clazz -
Returns:
Collection

getAllAttributes

public java.util.Collection getAllAttributes(ru.novosoft.uml.foundation.core.MClassifier clazz)
Returns all attributes of some classifier clazz and of its parents

Parameters:
clazz -
Returns:
Collection

getSource

public ru.novosoft.uml.foundation.core.MModelElement getSource(ru.novosoft.uml.foundation.core.MRelationship relation)
Returns the source of a relation. The source of a relation is defined as the modelelement that propagates this relation. If there are more then 1 sources, only the first is returned. If there is no source, null is returned. Examples of sources include classifiers that are types to associationends, usecases that are bases to extend and include relations and so on. A source is allways the start from the arrow in the fig, the destination the end.

Parameters:
relation -
Returns:
MModelElement

getDestination

public ru.novosoft.uml.foundation.core.MModelElement getDestination(ru.novosoft.uml.foundation.core.MRelationship relation)
Returns the destination of a relation. The destination of a relation is defined as the modelelement that receives this relation. If there are more then 1 destinations, only the first is returned. If there is no destination, null is returned. Examples of sources include classifiers that are types to associationends, usecases that are bases to extend and include relations and so on. In the case of an association, the destination is defined as the type of the second element in the connections list.

Parameters:
relation -
Returns:
MModelElement

getDependencies

public java.util.Collection getDependencies(java.lang.Object supplierObj,
                                            java.lang.Object clientObj)
Returns the dependencies between some supplier modelelement and some client modelelement. Does not return the vica versa relationship (dependency 'from client to supplier'.

Returns:
Collection

getRelationships

public java.util.Collection getRelationships(ru.novosoft.uml.foundation.core.MModelElement source,
                                             ru.novosoft.uml.foundation.core.MModelElement dest)
Returns all relationships between the source and dest modelelement and vica versa.

Parameters:
source -
dest -
Returns:
Collection

isValidNamespace

public boolean isValidNamespace(java.lang.Object mObj,
                                java.lang.Object nsObj)
Returns true if some modelelement may be owned by the given namespace

Returns:
boolean

getFirstSharedNamespace

public ru.novosoft.uml.foundation.core.MNamespace getFirstSharedNamespace(ru.novosoft.uml.foundation.core.MNamespace ns1,
                                                                          ru.novosoft.uml.foundation.core.MNamespace ns2)
Gets the first namespace two namespaces share. That is: it returns the first namespace that owns the given namespaces itself or some owner of the given namespaces.

Parameters:
ns1 -
ns2 -
Returns:
MNamespace

getAllPossibleNamespaces

public java.util.Collection getAllPossibleNamespaces(ru.novosoft.uml.foundation.core.MModelElement m)
Returns all possible namespaces that may be selected by some given modelelement m. Which namespaces are allowed, is decided in the method isValidNamespace.

Parameters:
m -
Returns:
Collection

getBaseClasses

public java.util.Collection getBaseClasses(java.lang.Object o)
Returns the base classes (that are the classes that do not have any generalizations) for some given namespace. Personally, this seems a pointless operation to me but in GoModelToBaseElements this is done like this for some reason. TODO: find out if someone uses this.

Parameters:
o -
Returns:
Collection

getChildren

public java.util.Collection getChildren(java.lang.Object o)
Returns all children from some given generalizableelement on all levels (the complete tree excluding the generalizable element itself).

Parameters:
o -
Returns:
Collection
Throws:
java.lang.IllegalStateException - if there is a circular reference.

getAllRealizedInterfaces

public java.util.Collection getAllRealizedInterfaces(java.lang.Object o)
Returns all interfaces that are realized by the given class or by its superclasses. It's possible that interfaces occur twice in the collection returned. In that case there is a double reference to that interface.

Parameters:
o -
Returns:
Collection


ArgoUML © 1996-2003 (20040125)ArgoUML Project HomeArgoUML Cookbook