@OpenApiAll
public class PatternHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PatternHelper.PathElementCreationResult
Class is used to return info about created or found path element.
|
static class |
PatternHelper.ShapeElementCreationResult
Class is used to return info about created or found shape element.
|
Modifier and Type | Field and Description |
---|---|
static int |
BOTTOM
Constant for layouting two presentation elements.
|
static int |
RIGHT
Constant for layouting two presentation elements.
|
Constructor and Description |
---|
PatternHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addDistinctAttribute(Classifier classifier,
Property attr)
Add Distinct Attribute.
|
static void |
addDistinctConstructor(Classifier classifier,
Operation op)
Added operations only if they are different from exist ones.
|
static void |
addDistinctOperation(Classifier classifier,
Operation op)
Add Operation to class.
|
static void |
addDistinctOperations(Classifier classifier,
java.util.Collection operations,
boolean clone)
Add list of Operations to class.
|
static void |
breakPathElement(PathElement path)
Breaks the given path according to the path ends.
|
static java.util.List |
collectPublicOperations(Classifier classifier)
Collect the public operation from the given class.
|
static void |
copyDistinctOperations(Classifier src,
Classifier dst,
boolean makeNotAbstract)
Copy Distinct Operations form source to destination Classifier.
|
static PatternHelper.PathElementCreationResult |
createAggregation(java.lang.String name,
java.lang.String multiplicity,
PresentationElement supplierPE,
PresentationElement clientPE)
Creates Aggregation path.
|
static PatternHelper.PathElementCreationResult |
createBinding(PresentationElement supplierPE,
PresentationElement clientPE)
Create Binding path.
|
static PatternHelper.PathElementCreationResult |
createGeneralization(PresentationElement parentPE,
PresentationElement childPE)
Create Generalization path.
|
static PatternHelper.PathElementCreationResult |
createRealization(PresentationElement interfacePE,
PresentationElement classPE)
Create Realization path.
|
static PatternHelper.PathElementCreationResult |
createRealizationOrGeneralization(PresentationElement parentPE,
PresentationElement childPE)
Creates Realization or Generalization.
|
static PatternHelper.ShapeElementCreationResult |
createShapeElement(Classifier element,
ShapeElement target,
int position,
int distance,
boolean suppressOperations)
Creates Shape element of the given class.
|
static TypeProperty |
createTypeProperty(java.lang.String id,
java.lang.Object value,
boolean canSelectModelClass,
boolean canSelectInterface)
Created type property.
|
static Operation |
deepClone(Operation old,
Classifier classifier)
Makes copy of specified element and places under parent.
|
static Classifier |
getClassifier(Element parent,
java.lang.Object classifier,
java.lang.Class type)
Get Classifier
|
static Classifier |
getClassifier(Project project,
java.lang.Object classifier,
java.lang.Class type)
Get Classifier
|
static boolean |
hasAttribute(Classifier classifier,
Property another)
Tests the given classifier has the given attribute.
|
static boolean |
hasOperation(Classifier classifier,
Operation op)
Tests The given classifier has the given operation.
|
static void |
renameTarget(Target target,
java.lang.String newName)
Rename the target.
|
static void |
setException(Classifier classifier,
java.lang.String exception)
Set The given exception to the given class.
|
static void |
setException(Operation op,
java.lang.String exception)
Set The exception to the given operation.
|
static void |
setPosition(ShapeElement target,
ShapeElement elementToMove,
int direction,
int space)
Sets position for the
view2move according to target . |
public static final int BOTTOM
public static final int RIGHT
public static boolean hasOperation(Classifier classifier, Operation op)
classifier
- The given classifier.op
- The given operation.public static boolean hasAttribute(Classifier classifier, Property another)
classifier
- The given classifier.another
- The given attribute.public static void addDistinctOperation(Classifier classifier, Operation op) throws ReadOnlyElementException
classifier
- The given class.op
- Added operation.ReadOnlyElementException
public static void addDistinctOperations(Classifier classifier, java.util.Collection operations, boolean clone) throws ReadOnlyElementException
classifier
- The given class.operations
- List of operation.clone
- Clone flag.ReadOnlyElementException
public static void addDistinctAttribute(Classifier classifier, Property attr)
classifier
- Classifierattr
- Propertypublic static void copyDistinctOperations(Classifier src, Classifier dst, boolean makeNotAbstract) throws ReadOnlyElementException
src
- Sourcedst
- DestinationmakeNotAbstract
- ReadOnlyElementException
public static Classifier getClassifier(Element parent, java.lang.Object classifier, java.lang.Class type)
parent
- Parent Element.classifier
- The given classifier.type
- The Class type.public static Classifier getClassifier(Project project, java.lang.Object classifier, java.lang.Class type)
project
- projectclassifier
- The given classifier.type
- The Class type.public static void setPosition(ShapeElement target, ShapeElement elementToMove, int direction, int space) throws ReadOnlyElementException
view2move
according to target
.
view2move
can be positioned to the right or bottom according to the target
.
Argument direction can have values PatternHelper.BOTTOM or PatternHelper.RIGHT.target
- the target element.elementToMove
- shape element to move.direction
- the direction from target.space
- space between target and elementToMove.ReadOnlyElementException
public static PatternHelper.PathElementCreationResult createGeneralization(PresentationElement parentPE, PresentationElement childPE) throws ReadOnlyElementException
parentPE
- Parent presentation element.childPE
- Child presentation element.ReadOnlyElementException
public static PatternHelper.PathElementCreationResult createRealizationOrGeneralization(PresentationElement parentPE, PresentationElement childPE) throws ReadOnlyElementException
parentPE
- Parent of the created path.childPE
- Child of the created path.ReadOnlyElementException
public static PatternHelper.PathElementCreationResult createRealization(PresentationElement interfacePE, PresentationElement classPE) throws ReadOnlyElementException
interfacePE
- The supplier of the realization path.classPE
- The client of the realization path.ReadOnlyElementException
public static PatternHelper.PathElementCreationResult createAggregation(java.lang.String name, java.lang.String multiplicity, PresentationElement supplierPE, PresentationElement clientPE) throws ReadOnlyElementException
name
- Name of created path.multiplicity
- Multiplicity of the created path.supplierPE
- Supplier.clientPE
- Client.ReadOnlyElementException
public static PatternHelper.PathElementCreationResult createBinding(PresentationElement supplierPE, PresentationElement clientPE) throws ReadOnlyElementException
supplierPE
- Supplier.clientPE
- Client.ReadOnlyElementException
public static void breakPathElement(PathElement path) throws ReadOnlyElementException
path
- link to change break pointsReadOnlyElementException
public static void addDistinctConstructor(Classifier classifier, Operation op) throws ReadOnlyElementException
classifier
- The given classifier.op
- OperationReadOnlyElementException
public static Operation deepClone(Operation old, Classifier classifier)
old
- classifier
- public static void setException(Operation op, java.lang.String exception)
op
- Operation that be set.exception
- The exception name.public static void setException(Classifier classifier, java.lang.String exception)
classifier
- The given class.exception
- The given exception.public static PatternHelper.ShapeElementCreationResult createShapeElement(Classifier element, ShapeElement target, int position, int distance, boolean suppressOperations) throws ReadOnlyElementException
element
- Class.target
- The target of the creation.position
- Created position.distance
- the direction from target.suppressOperations
- If true suppress the operation in presentation element.ReadOnlyElementException
public static TypeProperty createTypeProperty(java.lang.String id, java.lang.Object value, boolean canSelectModelClass, boolean canSelectInterface)
id
- ID of the created element.value
- Value of the created element.canSelectModelClass
- Can Select Model Class flag.canSelectInterface
- Can Select Interface flag.public static java.util.List collectPublicOperations(Classifier classifier)
classifier
- The given class.public static void renameTarget(Target target, java.lang.String newName) throws ReadOnlyElementException
target
- the given target.newName
- A new name.ReadOnlyElementException