org.argouml.model
Class AbstractExtensionMechanismsHelperDecorator

java.lang.Object
  extended by org.argouml.model.AbstractExtensionMechanismsHelperDecorator
All Implemented Interfaces:
ExtensionMechanismsHelper

public abstract class AbstractExtensionMechanismsHelperDecorator
extends java.lang.Object
implements ExtensionMechanismsHelper

An abstract Decorator for the ExtensionMechanismsHelper.


Constructor Summary
protected AbstractExtensionMechanismsHelperDecorator(ExtensionMechanismsHelper component)
           
 
Method Summary
 void addBaseClass(java.lang.Object handle, java.lang.Object baseClass)
          Add a baseclass to some stereotype.
 void addCopyStereotype(java.lang.Object modelElement, java.lang.Object stereotype)
          Sets the stereotype of some modelelement.
 void addExtendedElement(java.lang.Object handle, java.lang.Object extendedElement)
          Add an extended element to a stereotype.
 void addTaggedValue(java.lang.Object handle, java.lang.Object taggedValue)
          Add a tagged value.
 void applyProfile(java.lang.Object handle, java.lang.Object profile)
          Apply a profile to a model or another profile.
 java.util.Collection getAllPossibleStereotypes(java.util.Collection models, java.lang.Object modelElement)
          Returns all possible stereotypes for some modelelement.
protected  ExtensionMechanismsHelper getComponent()
          The component we are decorating.
 java.lang.String getMetaModelName(java.lang.Object m)
           
 java.lang.Object getStereotype(java.util.Collection models, java.lang.Object stereo)
          Searches for a stereotype just like the given stereotype in all given models (and their sub-namespaces).
 java.lang.Object getStereotype(java.lang.Object ns, java.lang.Object stereo)
          Finds a stereotype in a given namespace, and all those in any sub-namespace of the given namespace.
 java.util.Collection getStereotypes(java.util.Collection models)
          Get all stereotypes from all Models in the list.
 java.util.Collection getStereotypes(java.lang.Object ns)
          Returns all stereotypes in a given namespace, and all those in any sub-namespace of the given namespace.
 boolean hasStereotype(java.lang.Object handle, java.lang.String name)
          Returns true if the given ModelElement has a Stereotype with the given name.
 boolean isStereotype(java.lang.Object object, java.lang.String name, java.lang.String base)
          Tests if a stereotype has a given name and given base class.
 boolean isStereotypeInh(java.lang.Object object, java.lang.String name, java.lang.String base)
          Tests if a stereotype is or inherits from a stereotype with some name and base class.
 boolean isValidStereotype(java.lang.Object theModelElement, java.lang.Object theStereotype)
          Returns true if the given stereotype has a baseclass that equals the baseclass of the given ModelElement or one of the superclasses of the given ModelElement.
 java.lang.Object makeProfileApplicable(java.lang.Object handle)
          Make a profile applicable.
 void removeBaseClass(java.lang.Object handle, java.lang.Object baseClass)
          Remove baseclass from some stereotype.
 void removeTaggedValue(java.lang.Object handle, java.lang.Object taggedValue)
          Remove a tagged value.
 void setDataValues(java.lang.Object handle, java.lang.String[] values)
          Sets the dataValues of the given TaggedValue.
 void setIcon(java.lang.Object handle, java.lang.Object icon)
          Set the icon for a stereotype.
 void setTaggedValue(java.lang.Object handle, java.util.Collection taggedValues)
          Set the list of tagged values for a model element.
 void setTagType(java.lang.Object handle, java.lang.String tagType)
          Set the tagType of a TaggedDefinition.
 void setType(java.lang.Object handle, java.lang.Object type)
          Set the type of a taggedvalue.
 void setValueOfTag(java.lang.Object handle, java.lang.String value)
          Deprecated. 
 void unapplyProfile(java.lang.Object handle, java.lang.Object profile)
          Unapply a profile to a model or another profile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractExtensionMechanismsHelperDecorator

protected AbstractExtensionMechanismsHelperDecorator(ExtensionMechanismsHelper component)
Parameters:
component - The component to decorate.
Method Detail

getComponent

protected ExtensionMechanismsHelper getComponent()
The component we are decorating.

Returns:
Returns the component.

getStereotypes

public java.util.Collection getStereotypes(java.lang.Object ns)
Description copied from interface: ExtensionMechanismsHelper
Returns all stereotypes in a given namespace, and all those in any sub-namespace of the given namespace.

Specified by:
getStereotypes in interface ExtensionMechanismsHelper
Parameters:
ns - is the namespace.
Returns:
a Collection with the stereotypes.

getStereotype

public java.lang.Object getStereotype(java.lang.Object ns,
                                      java.lang.Object stereo)
Description copied from interface: ExtensionMechanismsHelper
Finds a stereotype in a given namespace, and all those in any sub-namespace of the given namespace. Returns null if no such stereotype is found.

TODO: What if stereo.getName() or stereo.getBaseClass() is null? Then you know immediately that none will be found, but is that the correct answer? Currently, null is returned in these cases.

TODO: This function should not take a stereotype object as parameter, but a name and a baseclass.

TODO: Currently only works for stereotypes with only one baseclass.

TODO: Currently only works for stereotypes where the baseclass is equal to the given one - inheritance does not work.

Specified by:
getStereotype in interface ExtensionMechanismsHelper
Parameters:
ns - is the namespace.
stereo - is the stereotype.
Returns:
the stereotype found or null.

getStereotype

public java.lang.Object getStereotype(java.util.Collection models,
                                      java.lang.Object stereo)
Description copied from interface: ExtensionMechanismsHelper
Searches for a stereotype just like the given stereotype in all given models (and their sub-namespaces). The given stereotype can not have its namespace set yet; otherwise it will be returned itself! TODO: This function should not take a stereotype object as parameter, but a name and a baseclass.

TODO: Currently only works for stereotypes with only one baseclass.

TODO: Should it only search for stereotypes owned by the Model object?

Specified by:
getStereotype in interface ExtensionMechanismsHelper
Parameters:
models - a collection of models
stereo - is the given stereotype
Returns:
Stereotype

getMetaModelName

public java.lang.String getMetaModelName(java.lang.Object m)
Specified by:
getMetaModelName in interface ExtensionMechanismsHelper
Parameters:
m - the ModelElement
Returns:
the name of the metatype (i.e UML type) of this Element

getAllPossibleStereotypes

public java.util.Collection getAllPossibleStereotypes(java.util.Collection models,
                                                      java.lang.Object modelElement)
Description copied from interface: ExtensionMechanismsHelper
Returns all possible stereotypes for some modelelement. Possible stereotypes are those stereotypes that are owned by the same namespace the modelelement is owned by and that have a baseclass that is the same as the metamodelelement name of the modelelement.

Specified by:
getAllPossibleStereotypes in interface ExtensionMechanismsHelper
Parameters:
models - the models to search in
modelElement - is the model element
Returns:
Collection

isValidStereotype

public boolean isValidStereotype(java.lang.Object theModelElement,
                                 java.lang.Object theStereotype)
Description copied from interface: ExtensionMechanismsHelper
Returns true if the given stereotype has a baseclass that equals the baseclass of the given ModelElement or one of the superclasses of the given ModelElement.

Specified by:
isValidStereotype in interface ExtensionMechanismsHelper
Parameters:
theModelElement - is the model element
theStereotype - is the stereotype
Returns:
boolean

getStereotypes

public java.util.Collection getStereotypes(java.util.Collection models)
Description copied from interface: ExtensionMechanismsHelper
Get all stereotypes from all Models in the list.

Finds also all stereotypes owned by any sub-namespaces of the Model.

Specified by:
getStereotypes in interface ExtensionMechanismsHelper
Parameters:
models - the models to search
Returns:
the collection of stereotypes in all models in the current project

addCopyStereotype

public void addCopyStereotype(java.lang.Object modelElement,
                              java.lang.Object stereotype)
Description copied from interface: ExtensionMechanismsHelper
Sets the stereotype of some modelelement. The method also copies a stereotype that is not a part of the current model to the current model.

Specified by:
addCopyStereotype in interface ExtensionMechanismsHelper
Parameters:
modelElement - is the model element
stereotype - is the stereotype

isStereotype

public boolean isStereotype(java.lang.Object object,
                            java.lang.String name,
                            java.lang.String base)
Description copied from interface: ExtensionMechanismsHelper
Tests if a stereotype has a given name and given base class. While comparing the baseclass, inheritance is not considered.

Specified by:
isStereotype in interface ExtensionMechanismsHelper
Parameters:
object - is the stereotype.
name - is the name of the stereotype.
base - is a string representing the base class of the stereotype.
Returns:
true if object is a stereotype with the desired characteristics.

isStereotypeInh

public boolean isStereotypeInh(java.lang.Object object,
                               java.lang.String name,
                               java.lang.String base)
Description copied from interface: ExtensionMechanismsHelper
Tests if a stereotype is or inherits from a stereotype with some name and base class.

Specified by:
isStereotypeInh in interface ExtensionMechanismsHelper
Parameters:
object - is the stereotype.
name - is the name of the stereotype.
base - is the base class of the stereotype.
Returns:
true if object is a (descendant of a) stereotype with the desired characteristics.

addExtendedElement

public void addExtendedElement(java.lang.Object handle,
                               java.lang.Object extendedElement)
Description copied from interface: ExtensionMechanismsHelper
Add an extended element to a stereotype.

Specified by:
addExtendedElement in interface ExtensionMechanismsHelper
Parameters:
handle - Stereotype
extendedElement - ExtensionPoint

addBaseClass

public void addBaseClass(java.lang.Object handle,
                         java.lang.Object baseClass)
Description copied from interface: ExtensionMechanismsHelper
Add a baseclass to some stereotype.

Specified by:
addBaseClass in interface ExtensionMechanismsHelper
Parameters:
handle - the stereotype
baseClass - the baseclass to add

removeBaseClass

public void removeBaseClass(java.lang.Object handle,
                            java.lang.Object baseClass)
Description copied from interface: ExtensionMechanismsHelper
Remove baseclass from some stereotype.

Specified by:
removeBaseClass in interface ExtensionMechanismsHelper
Parameters:
handle - the stereotype
baseClass - the baseclass to remove

setIcon

public void setIcon(java.lang.Object handle,
                    java.lang.Object icon)
Description copied from interface: ExtensionMechanismsHelper
Set the icon for a stereotype.

Specified by:
setIcon in interface ExtensionMechanismsHelper
Parameters:
handle - Stereotype
icon - String

setTagType

public void setTagType(java.lang.Object handle,
                       java.lang.String tagType)
Description copied from interface: ExtensionMechanismsHelper
Set the tagType of a TaggedDefinition. This controls the range of legal values for the associated TaggedValues.

Specified by:
setTagType in interface ExtensionMechanismsHelper
Parameters:
handle - the taggedValue
tagType - A string containing the name of the type for values that may be assigned to this tag. This can either be the name of a datatype (e.g. "String", "Integer" or "Boolean") or the name of a metaclass for more complex types of tagged values.

setType

public void setType(java.lang.Object handle,
                    java.lang.Object type)
Description copied from interface: ExtensionMechanismsHelper
Set the type of a taggedvalue.

Specified by:
setType in interface ExtensionMechanismsHelper
Parameters:
handle - the taggedValue
type - the tagDefinition

setValueOfTag

@Deprecated
public void setValueOfTag(java.lang.Object handle,
                                     java.lang.String value)
Deprecated. 

Description copied from interface: ExtensionMechanismsHelper
Sets the dataValues of the given TaggedValue to a single String value. Provided for backward compatibility with UML 1.3. new uses should use setDataValues.

Specified by:
setValueOfTag in interface ExtensionMechanismsHelper
Parameters:
handle - is the tagged value
value - is the value

setDataValues

public void setDataValues(java.lang.Object handle,
                          java.lang.String[] values)
Description copied from interface: ExtensionMechanismsHelper
Sets the dataValues of the given TaggedValue.

Specified by:
setDataValues in interface ExtensionMechanismsHelper
Parameters:
handle - is the tagged value
values - an array of String values

addTaggedValue

public void addTaggedValue(java.lang.Object handle,
                           java.lang.Object taggedValue)
Description copied from interface: ExtensionMechanismsHelper
Add a tagged value.

Specified by:
addTaggedValue in interface ExtensionMechanismsHelper
Parameters:
handle - The model element to add to.
taggedValue - The tagged value to add.

removeTaggedValue

public void removeTaggedValue(java.lang.Object handle,
                              java.lang.Object taggedValue)
Description copied from interface: ExtensionMechanismsHelper
Remove a tagged value.

Specified by:
removeTaggedValue in interface ExtensionMechanismsHelper
Parameters:
handle - The model element to remove from.
taggedValue - The tagged value to remove.

setTaggedValue

public void setTaggedValue(java.lang.Object handle,
                           java.util.Collection taggedValues)
Description copied from interface: ExtensionMechanismsHelper
Set the list of tagged values for a model element.

Specified by:
setTaggedValue in interface ExtensionMechanismsHelper
Parameters:
handle - The model element to set for.
taggedValues - A Collection of tagged values.

hasStereotype

public boolean hasStereotype(java.lang.Object handle,
                             java.lang.String name)
Description copied from interface: ExtensionMechanismsHelper
Returns true if the given ModelElement has a Stereotype with the given name.

Specified by:
hasStereotype in interface ExtensionMechanismsHelper
Parameters:
handle - the given ModelElement
name - the given name
Returns:
true if there is such a stereotype

makeProfileApplicable

public java.lang.Object makeProfileApplicable(java.lang.Object handle)
Description copied from interface: ExtensionMechanismsHelper
Make a profile applicable. Usually a profile edited in a UML design environment like ArgoUML is not directly applicable, but needs to be shifted to the metamodel level, so that it can serve as an extension to the UML metamodel.

Specified by:
makeProfileApplicable in interface ExtensionMechanismsHelper
Parameters:
handle - the profile before made applicable to a model
Returns:
the profile made applicable to a model

applyProfile

public void applyProfile(java.lang.Object handle,
                         java.lang.Object profile)
Description copied from interface: ExtensionMechanismsHelper
Apply a profile to a model or another profile.

Specified by:
applyProfile in interface ExtensionMechanismsHelper
Parameters:
handle - The model or profile.
profile - The to be applied profile.

unapplyProfile

public void unapplyProfile(java.lang.Object handle,
                           java.lang.Object profile)
Description copied from interface: ExtensionMechanismsHelper
Unapply a profile to a model or another profile.

Specified by:
unapplyProfile in interface ExtensionMechanismsHelper
Parameters:
handle - The model or profile.
profile - The to be unapplied profile.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook