UML

org.topcased.modeler.uml
Class UMLTools

java.lang.Object
  extended by org.topcased.modeler.uml.UMLTools

public final class UMLTools
extends java.lang.Object

Class for generic operation
creation : 8 avr. 2005


Method Summary
static boolean compareType(org.eclipse.uml2.uml.Type t1, org.eclipse.uml2.uml.Type t2)
          Compare two types.
static org.eclipse.uml2.uml.Element findRootElement(org.eclipse.uml2.uml.Element elt)
          Retrieve the root Element of an UML model that contains a given Element
static java.lang.String[] getAllAvailableTypeNames(java.util.Collection<org.eclipse.uml2.uml.Type> types)
          Return an array of type names.
static java.util.Collection<org.eclipse.uml2.uml.Element> getAllAvailableTypes(org.eclipse.uml2.uml.Element element)
          Return a collection of all types contained in the model associated to a given element
static java.util.ArrayList<org.eclipse.uml2.uml.Element> getAllObjects(org.eclipse.uml2.uml.Element element, java.lang.Class clazz)
          Search in the given model every occurence of a type
static java.util.ArrayList<org.eclipse.uml2.uml.Element> getAllObjects(org.eclipse.uml2.uml.Package element)
          Search in the given model every elements
static java.lang.String getCompleteName(org.eclipse.uml2.uml.Element elem)
          Return the complete name, ie with the owner names
static org.eclipse.uml2.uml.NamedElement getElementFromPath(org.eclipse.uml2.uml.Model root, java.lang.String completePath)
          Return the element correspong to the specified path.
static java.lang.String getFromPackageNotation(org.eclipse.uml2.uml.Element element, org.eclipse.uml2.uml.Element parent)
          Get a string representation of all the applied stereoptypes on the given UML2 element.
static java.lang.String getMultiplicityNotation(int lowerBound, int upperBound)
          Return a representation for a given multiplicity
static java.lang.String getStereotypesNotation(org.eclipse.uml2.uml.Element uml2Element)
          Deprecated. Use the method declared in the org.topcased.modeler.uml.UMLLabel class
static java.lang.String getStringValue(org.eclipse.uml2.uml.ValueSpecification valueSpec)
          Return the string representation of the ValueSpecification
static java.lang.String getTypeFullName(org.eclipse.uml2.uml.Type type)
          Customized type name
static java.lang.String getVisibilityNotation(org.eclipse.uml2.uml.VisibilityKind visibility)
          Deprecated. Use the method declared in the org.topcased.modeler.uml.UMLLabel class
static void initializePrimitiveTypes(org.eclipse.uml2.uml.Model model)
          if primitive types do not exist, create them
static boolean isPrimitiveType(org.eclipse.uml2.uml.Type type, java.lang.String primitiv)
          Test if the type is a primitive type with the right name
static boolean isPrimitiveTypeBoolean(org.eclipse.uml2.uml.Type type)
          Test if the type is a boolean primitive type
static boolean isPrimitiveTypeInteger(org.eclipse.uml2.uml.Type type)
          Test if the type is a integer primitive type
static boolean isPrimitiveTypeString(org.eclipse.uml2.uml.Type type)
          Test if the type is a string primitive type
static java.util.ArrayList<org.eclipse.uml2.uml.Element> removeRelationship(java.util.Collection<org.eclipse.uml2.uml.Element> c)
          Remove the relation ships from the collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCompleteName

public static java.lang.String getCompleteName(org.eclipse.uml2.uml.Element elem)
Return the complete name, ie with the owner names

Parameters:
elem - the element
Returns:
the complete name

getElementFromPath

public static org.eclipse.uml2.uml.NamedElement getElementFromPath(org.eclipse.uml2.uml.Model root,
                                                                   java.lang.String completePath)
Return the element correspong to the specified path. The path should be a path return by getCompleteName

Parameters:
root - the UML2 root element
completePath - the path of the element
Returns:
the found element

initializePrimitiveTypes

public static void initializePrimitiveTypes(org.eclipse.uml2.uml.Model model)
if primitive types do not exist, create them

Parameters:
model - current edited model

getAllAvailableTypes

public static java.util.Collection<org.eclipse.uml2.uml.Element> getAllAvailableTypes(org.eclipse.uml2.uml.Element element)
Return a collection of all types contained in the model associated to a given element

Parameters:
element - the element
Returns:
types (data type, class) including primitive types

getAllObjects

public static java.util.ArrayList<org.eclipse.uml2.uml.Element> getAllObjects(org.eclipse.uml2.uml.Package element)
Search in the given model every elements

Parameters:
element - the element to search in
Returns:
an ArrayList containing the wanted model objects

getAllObjects

public static java.util.ArrayList<org.eclipse.uml2.uml.Element> getAllObjects(org.eclipse.uml2.uml.Element element,
                                                                              java.lang.Class clazz)
Search in the given model every occurence of a type

Parameters:
element - the element to search in
clazz - the wanted type
Returns:
an ArrayList containing the wanted model objects

findRootElement

public static org.eclipse.uml2.uml.Element findRootElement(org.eclipse.uml2.uml.Element elt)
Retrieve the root Element of an UML model that contains a given Element

Parameters:
elt - an Element in the model
Returns:
the root Element of the model

removeRelationship

public static java.util.ArrayList<org.eclipse.uml2.uml.Element> removeRelationship(java.util.Collection<org.eclipse.uml2.uml.Element> c)
Remove the relation ships from the collection

Parameters:
c - the collection to filter
Returns:
the filtered list

getTypeFullName

public static java.lang.String getTypeFullName(org.eclipse.uml2.uml.Type type)
Customized type name

Parameters:
type - type to customize name
Returns:
customized name

getAllAvailableTypeNames

public static java.lang.String[] getAllAvailableTypeNames(java.util.Collection<org.eclipse.uml2.uml.Type> types)
Return an array of type names.

Parameters:
types - a Collection of Type
Returns:
array of type names
See Also:
getAllAvailableTypes(Element)

getVisibilityNotation

public static java.lang.String getVisibilityNotation(org.eclipse.uml2.uml.VisibilityKind visibility)
Deprecated. Use the method declared in the org.topcased.modeler.uml.UMLLabel class

Return a representation for a given visibility kind

Parameters:
visibility - the visibily
Returns:
a string that represents the visibility kind

getMultiplicityNotation

public static java.lang.String getMultiplicityNotation(int lowerBound,
                                                       int upperBound)
Return a representation for a given multiplicity

Parameters:
lowerBound - the lower bound of the multiplicity
upperBound - the upper bound of the multiplicity
Returns:
a string that represents the multiplicity

getStereotypesNotation

public static java.lang.String getStereotypesNotation(org.eclipse.uml2.uml.Element uml2Element)
Deprecated. Use the method declared in the org.topcased.modeler.uml.UMLLabel class

Get a string representation of all the applied stereoptypes on the given UML2 element.

Parameters:
uml2Element - an UML2 element
Returns:
a fully qualified string representation or empty string if no applied stereotypes

getFromPackageNotation

public static java.lang.String getFromPackageNotation(org.eclipse.uml2.uml.Element element,
                                                      org.eclipse.uml2.uml.Element parent)
Get a string representation of all the applied stereoptypes on the given UML2 element.

Parameters:
element - an UML2 element
parent - the element which graphically contains the UML2 Type element
Returns:
a fully qualified string representation or empty string if no applied stereotypes

getStringValue

public static java.lang.String getStringValue(org.eclipse.uml2.uml.ValueSpecification valueSpec)
Return the string representation of the ValueSpecification

Parameters:
valueSpec - the ValueSpecification
Returns:
the string representation of the ValueSpecification

compareType

public static boolean compareType(org.eclipse.uml2.uml.Type t1,
                                  org.eclipse.uml2.uml.Type t2)
Compare two types. Return true is they are the same.

Parameters:
t1 - first type to compare
t2 - second type to compare
Returns:
true if they are the same

isPrimitiveType

public static boolean isPrimitiveType(org.eclipse.uml2.uml.Type type,
                                      java.lang.String primitiv)
Test if the type is a primitive type with the right name

Parameters:
type - type to test
primitiv - the name of the primitiv name to cast
Returns:
true if it's a primitive type of the specified name

isPrimitiveTypeInteger

public static boolean isPrimitiveTypeInteger(org.eclipse.uml2.uml.Type type)
Test if the type is a integer primitive type

Parameters:
type - type to test
Returns:
true if it's a integer primitive type

isPrimitiveTypeBoolean

public static boolean isPrimitiveTypeBoolean(org.eclipse.uml2.uml.Type type)
Test if the type is a boolean primitive type

Parameters:
type - type to test
Returns:
true if it's a boolean primitive type

isPrimitiveTypeString

public static boolean isPrimitiveTypeString(org.eclipse.uml2.uml.Type type)
Test if the type is a string primitive type

Parameters:
type - type to test
Returns:
true if it's a string primitive type

UML

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.