Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.poseidon.uml.model_management

Class ModelElementHelpers


public final class ModelElementHelpers

Contains methods that access and possibly modify the model.


 Method Summary
public void   addAttribute( Attribute attribute , Classifier classifier )
 
public void   addFeature( Feature feature , Classifier classifier )
Sets an initial value for an attribute. 
public void   addModelEventListener(Collection modelElements , MDRChangeListener listener )
 
public void   addModelEventListener( ModelElement modelElement , MDRChangeListener listener )
 
public void   addModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener )
 
public void   addModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener , int eventMask )
 
public void   addOperation( Operation operation , Classifier classifier )
 
public void   addTaggedValues(Collection fromTaggedValues , Collection toTaggedValues )
Adds the specified tagged values to the given collection if the tag type does not exist in the target collection. 
public static void   beginTrans()
Unlocks the repository. 
public Action   cloneAction( Action currentAction )
 
public ModelElement   cloneAndInsertElement( ModelElement element , Model targetModel )
Copies the given element to the target model at the same namespace, including all stereotypes, and returns the clone. 
public Attribute   cloneAttribute( Attribute attribute )
Creates a new attribute having the same internal state as the given one (except for namespace or owner related information). 
public BooleanExpression   cloneBooleanExpression( BooleanExpression originalExpression )
 
public Event   cloneEvent( Event event )
 
public Feature   cloneFeature( Feature feature )
Creates a new feature having the same internal state as the given one (except for namespace or owner related information). 
public ModelElement   cloneGenericElement( ModelElement element )
Creates a clone for any kind of modelelement. 
public Guard   cloneGuard( Guard currentGuard )
 
public Method   cloneMethod( Method method )
Creates a new method having the same internal state as the given one (except for namespace or owner related information). 
public Operation   cloneOperation( Operation operation )
Creates a new operation having the same internal state as the given one (except for namespace or owner related information). 
public Parameter   cloneParameter( Parameter parameter )
Creates a new parameter having the same internal state as the given one (except for namespace or owner related information). 
public TaggedValue   cloneTaggedValue( TaggedValue taggedValue )
Creates a new tagged value having the same internal state as the given one (except for namespace or owner related information). 
public Collection   cloneTaggedValues(Collection taggedValues )
Creates a new collection of tagged values. 
public TimeExpression   cloneTimeExpression( TimeExpression originalExpression )
 
public Transition   cloneTransition( Transition transition )
 
public boolean   compareStereotypeCollections(Collection stereotypes , Collection compareWith )
This method compares two sets of stereotypes. 
public boolean   compareStereotypes( ModelElement element , ModelElement compareWith )
 
public boolean   compareStereotypes( Stereotype stereotype , Stereotype compareWith )
This method compares two stereotypes. 
public boolean   compareTagDefinitions( Stereotype stereotype , Stereotype compareWith )
This method compares the tag definitions for two stereotypes. 
public boolean   compareTaggedValues( TaggedValue taggedValue , TaggedValue compareWith )
This method compares the tag name and the set of data values of two tagged values. 
public boolean   compareTaggedValues( ModelElement element , ModelElement compareWith )
This method compares the set of tagged values of two model elements. 
public static void   endTrans()
Removes all old stereotypes and sets the given one. 
public static ModelElementHelpers   getInstance()
 
public Stereotype   getStereotype(String stereoName )
Gets (if necessary, creates) the stereotype with the given name. 
public Namespace   insertNamespaceIntoModel( Namespace phantomNS , Model targetModel )
 
protected RefObject   mergeLinkEnd(RefObject linkEnd )
 
public Map   mergeNamespaces( Namespace mergeFrom , Namespace mergeInto , List mergedElements )
 
public void   mergeParameters( Operation operation , Collection newParameters )
 
public void   mergeParameters( Operation operation , Collection newParameters , boolean exchangeList )
 
public void   mergeRefAssociations(RefPackage refPackage )
 
protected void   mergeTopLevelModel( Model model , RefObject element , RefAssociation refAssoc )
Maps a list of new parameters onto the list of the existing parameters of a given operation. 
public Collection   moveFeatures(Collection original , Collection movingFeatures , Feature limiter , boolean up )
 
public void   redirectIncomingTransitions( StateVertex oldState , StateVertex newState )
 
public void   redirectOutgoingTransitions( StateVertex oldState , StateVertex newState )
 
public void   removeModelEventListener(Collection modelElements , MDRChangeListener listener )
 
public void   removeModelEventListener( ModelElement modelElement , MDRChangeListener listener )
 
public void   removeModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener )
 
public void   setConstraintExpression( Constraint constraint , String expression )
 
public void   setDefaultValue( Parameter param , String language , String body )
 
public void   setInitialValue( Attribute attr , String language , String body )
 
public void   setIsValidConstraint( Constraint constr , boolean isValid )
 
public void   setNewUUID( ModelElement element )
 
public void   setOnlyStereotype( ModelElement modified , Stereotype newStereo )
This method compares the set of stereotypes of two model elements. 
public Method   setOperationBody( Operation op , String language , String body )
Sets another method body for the given language. 
public void   setReturnParameter( Operation operation , Parameter newReturnParameter )
this method removes ALL paramters of the given operation which have the MParamterDirectionType RETURN and adds the new parameter, which gets RETURN by default 
public static void   setStereotype( ModelElement element , String stereotype )
Sets the stereotye of the given element. 
public static void   setStereotype( ModelElement element , Stereotype stereotype )
Sets one new stereotype, or just removes all if null is given. 
public void   setTaggedValue( ModelElement me , String tag , String value )
Re-sets or creates a tagged value, as opposed to the Factory's method that always creates another one with the same name. 
public void   setUUID( ModelElement element , String uuid )
 
arrow_up
 

 

 Method Detail

addAttribute

public void addAttribute( Attribute attribute , Classifier classifier )

 
arrow_up
 
 

addFeature

public void addFeature( Feature feature , Classifier classifier )

Sets an initial value for an attribute. Removes the old initial value if necessary.
Parameters:
attr - The modified attribute.
language - The language for the new expression,
body - The body, ie, the actual initial value.
 
arrow_up
 
 

addModelEventListener

public void addModelEventListener(Collection modelElements , MDRChangeListener listener )

 
arrow_up
 
 

addModelEventListener

public void addModelEventListener( ModelElement modelElement , MDRChangeListener listener )

 
arrow_up
 
 

addModelEventListener

public void addModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener )

 
arrow_up
 
 

addModelEventListener

public void addModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener , int eventMask )

 
arrow_up
 
 

addOperation

public void addOperation( Operation operation , Classifier classifier )

 
arrow_up
 
 

addTaggedValues

public void addTaggedValues(Collection fromTaggedValues , Collection toTaggedValues )

Adds the specified tagged values to the given collection if the tag type does not exist in the target collection.
Parameters:
fromTaggedValues - collection to add tag values from
toTaggedValues - collection to add missing tag types to
 
arrow_up
 
 

beginTrans

public static void beginTrans()

Unlocks the repository. 
arrow_up
 
 

cloneAction

public Action cloneAction( Action currentAction )

 
arrow_up
 
 

cloneAndInsertElement

public ModelElement cloneAndInsertElement( ModelElement element , Model targetModel )

Copies the given element to the target model at the same namespace, including all stereotypes, and returns the clone.
Parameters:
element - The element that is to clone.
targetModel - The model where the element is supposed to end up.
Returns:
The cloned element or null if a problem occured.
 
arrow_up
 
 

cloneAttribute

public Attribute cloneAttribute( Attribute attribute )

Creates a new attribute having the same internal state as the given one (except for namespace or owner related information).
Parameters:
attribute - Attribute to take the internal state from.
Returns:
New attribute with cloned internal state.
 
arrow_up
 
 

cloneBooleanExpression

public BooleanExpression cloneBooleanExpression( BooleanExpression originalExpression )

 
arrow_up
 
 

cloneEvent

public Event cloneEvent( Event event )

 
arrow_up
 
 

cloneFeature

public Feature cloneFeature( Feature feature )

Creates a new feature having the same internal state as the given one (except for namespace or owner related information). The actual cloning is delegated to a specialized operation.
Parameters:
feature - Feature to take the internal state from.
Returns:
New feature with cloned internal state.
See also:
#cloneAttribute
#cloneOperation
 
arrow_up
 
 

cloneGenericElement

public ModelElement cloneGenericElement( ModelElement element )

Creates a clone for any kind of modelelement. Only the object itself gets cloned along with its name and the stereotypes. The internal state is not known here and therefore not cloned.
Parameters:
element - The modelelement to clone.
Returns:
The cloned modelelement.
 
arrow_up
 
 

cloneGuard

public Guard cloneGuard( Guard currentGuard )

 
arrow_up
 
 

cloneMethod

public Method cloneMethod( Method method )

Creates a new method having the same internal state as the given one (except for namespace or owner related information).
Parameters:
method - Method to take the internal state from.
Returns:
New method with cloned internal state.
 
arrow_up
 
 

cloneOperation

public Operation cloneOperation( Operation operation )

Creates a new operation having the same internal state as the given one (except for namespace or owner related information).
Parameters:
operation - Operation to take the internal state from.
Returns:
New operation with cloned internal state.
 
arrow_up
 
 

cloneParameter

public Parameter cloneParameter( Parameter parameter )

Creates a new parameter having the same internal state as the given one (except for namespace or owner related information).
Parameters:
parameter - Parameter to take the internal state from.
Returns:
New parameter with cloned internal state.
 
arrow_up
 
 

cloneTaggedValue

public TaggedValue cloneTaggedValue( TaggedValue taggedValue )

Creates a new tagged value having the same internal state as the given one (except for namespace or owner related information).
Parameters:
taggedValue - Tagged value to take the internal state from.
Returns:
New tagged value with cloned internal state.
 
arrow_up
 
 

cloneTaggedValues

public Collection cloneTaggedValues(Collection taggedValues )

Creates a new collection of tagged values. Each entry is a cloned tagged value of an entry in the given collection.
Parameters:
taggedValues - Collection to take the clonable tagged values from.
Returns:
New collection of cloned tagged values.
See also:
#cloneTaggedValue
 
arrow_up
 
 

cloneTimeExpression

public TimeExpression cloneTimeExpression( TimeExpression originalExpression )

 
arrow_up
 
 

cloneTransition

public Transition cloneTransition( Transition transition )

 
arrow_up
 
 

compareStereotypeCollections

public boolean compareStereotypeCollections(Collection stereotypes , Collection compareWith )

This method compares two sets of stereotypes. The comparison returns true only, if the number of stereotypes is equal and all stereotypes in one collection is present in the other collection as well.
Parameters:
stereotypes - First collection of stereotypes for comparison.
compareWith - Second collection of stereotypes for comparison.
Returns:
True, if all stereotypes are present in both collections, otherwise false.
 
arrow_up
 
 

compareStereotypes

public boolean compareStereotypes( ModelElement element , ModelElement compareWith )

 
arrow_up
 
 

compareStereotypes

public boolean compareStereotypes( Stereotype stereotype , Stereotype compareWith )

This method compares two stereotypes. The comparison returns true only, if the names and the base classes of both stereotypes are equal and each tagged value assigned to one stereotype is assigned to the other as well.
Parameters:
stereotype - The first stereotype for comparison.
compareWith - The second stereotype for comparison.
Returns:
True, if names, base classes and the collection of tagged values are equal, otherwise false.
 
arrow_up
 
 

compareTagDefinitions

public boolean compareTagDefinitions( Stereotype stereotype , Stereotype compareWith )

This method compares the tag definitions for two stereotypes. The comparison returns true only, if the number of tag definitions is equal and all tag definitions assigned to one stereotype are assigned to the other as well.
Parameters:
stereotype - The first stereotype for comparison.
compareWith - The second stereotype for comparison.
Returns:
True, if all tag definitions are assigned to both stereotypes, otherwise false.
 
arrow_up
 
 

compareTaggedValues

public boolean compareTaggedValues( TaggedValue taggedValue , TaggedValue compareWith )

This method compares the tag name and the set of data values of two tagged values. The comparison returns true only, if the tag name is equal, the number of data values is equal and all values for one element are assigned to the other element as well.
Parameters:
taggedValue - First tagged value for comparison.
compareWith - Second tagged value for comparison.
Returns:
True, if all data values are assigned to both tagged values which have the same tag name, otherwise false.
 
arrow_up
 
 

compareTaggedValues

public boolean compareTaggedValues( ModelElement element , ModelElement compareWith )

This method compares the set of tagged values of two model elements. The comparison returns true only, if the number of tagged values is equal, all tag names are assigned to both elements and the data values for each tag are equal as well.
Parameters:
element - First model element for comparison.
compareWith - Second element for comparison.
Returns:
True, if all tagged values are assigned to both elements, otherwise false.
 
arrow_up
 
 

endTrans

public static void endTrans()

Removes all old stereotypes and sets the given one.
Parameters:
newStereo - If null, all stereotypes are just removed.
 
arrow_up
 
 

getInstance

public static ModelElementHelpers getInstance()

 
arrow_up
 
 

getStereotype

public Stereotype getStereotype(String stereoName )

Gets (if necessary, creates) the stereotype with the given name. 
arrow_up
 
 

insertNamespaceIntoModel

public Namespace insertNamespaceIntoModel( Namespace phantomNS , Model targetModel )

 
arrow_up
 
 

mergeLinkEnd

protected RefObject mergeLinkEnd(RefObject linkEnd )

 
arrow_up
 
 

mergeNamespaces

public Map mergeNamespaces( Namespace mergeFrom , Namespace mergeInto , List mergedElements )

 
arrow_up
 
 

mergeParameters

public void mergeParameters( Operation operation , Collection newParameters )

 
arrow_up
 
 

mergeParameters

public void mergeParameters( Operation operation , Collection newParameters , boolean exchangeList )

 
arrow_up
 
 

mergeRefAssociations

public void mergeRefAssociations(RefPackage refPackage )

 
arrow_up
 
 

mergeTopLevelModel

protected void mergeTopLevelModel( Model model , RefObject element , RefAssociation refAssoc )

Maps a list of new parameters onto the list of the existing parameters of a given operation. Before the existing parameters are removed, the bindings (to arguments) of the existing parameters are turned to the new parameters. Then the new parameters are added to the operation. precond: newParameters.elementAt(size-1) == operation.getReturnParameter()
Parameters:
operation - The operation getting new parameters
newParameters - The list of new parameters
See also:
com.gentleware.poseidon.uml.diagram.NameParser parsing an operation signature
 
arrow_up
 
 

moveFeatures

public Collection moveFeatures(Collection original , Collection movingFeatures , Feature limiter , boolean up )

 
arrow_up
 
 

redirectIncomingTransitions

public void redirectIncomingTransitions( StateVertex oldState , StateVertex newState )

 
arrow_up
 
 

redirectOutgoingTransitions

public void redirectOutgoingTransitions( StateVertex oldState , StateVertex newState )

 
arrow_up
 
 

removeModelEventListener

public void removeModelEventListener(Collection modelElements , MDRChangeListener listener )

 
arrow_up
 
 

removeModelEventListener

public void removeModelEventListener( ModelElement modelElement , MDRChangeListener listener )

 
arrow_up
 
 

removeModelEventListener

public void removeModelEventListener( MDRChangeSource changeSource , MDRChangeListener listener )

 
arrow_up
 
 

setConstraintExpression

public void setConstraintExpression( Constraint constraint , String expression )

 
arrow_up
 
 

setDefaultValue

public void setDefaultValue( Parameter param , String language , String body )

 
arrow_up
 
 

setInitialValue

public void setInitialValue( Attribute attr , String language , String body )

 
arrow_up
 
 

setIsValidConstraint

public void setIsValidConstraint( Constraint constr , boolean isValid )

 
arrow_up
 
 

setNewUUID

public void setNewUUID( ModelElement element )

 
arrow_up
 
 

setOnlyStereotype

public void setOnlyStereotype( ModelElement modified , Stereotype newStereo )

This method compares the set of stereotypes of two model elements. The comparison returns true only, if the number of stereotypes is equal and all stereotypes for one element are assigned to the other element as well.
Parameters:
element - First model element for comparison.
compareWith - Second element for comparison.
Returns:
True, if all stereotypes are assigned to both elements, otherwise false.
 
arrow_up
 
 

setOperationBody

public Method setOperationBody( Operation op , String language , String body )

Sets another method body for the given language.
Returns:
The method that was modified.
 
arrow_up
 
 

setReturnParameter

public void setReturnParameter( Operation operation , Parameter newReturnParameter )

this method removes ALL paramters of the given operation which have the MParamterDirectionType RETURN and adds the new parameter, which gets RETURN by default 
arrow_up
 
 

setStereotype

public static void setStereotype( ModelElement element , String stereotype )

Sets the stereotye of the given element. Stereo is created if not existent.
Parameters:
stereotype - If null, the element's stereo is set to null. Otherwise, it is set to the given stereo name. If stereo does not exist yet, it is created.
 
arrow_up
 
 

setStereotype

public static void setStereotype( ModelElement element , Stereotype stereotype )

Sets one new stereotype, or just removes all if null is given. 
arrow_up
 
 

setTaggedValue

public void setTaggedValue( ModelElement me , String tag , String value )

Re-sets or creates a tagged value, as opposed to the Factory's method that always creates another one with the same name. 
arrow_up
 
 

setUUID

public void setUUID( ModelElement element , String uuid )

 
arrow_up
 

Created  2003 - 3 - 4

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2001 Gentleware AG, Vogt-Kölln-Str.30, 22527 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.