org.eclipse.uml2.uml.util
Class UMLUtil.TemplateExpander

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>
              extended by org.eclipse.emf.ecore.util.EcoreUtil.Copier
                  extended by org.eclipse.uml2.uml.util.UMLUtil.PackageMerger
                      extended by org.eclipse.uml2.uml.util.UMLUtil.TemplateExpander
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>
Enclosing class:
UMLUtil

public static class UMLUtil.TemplateExpander
extends UMLUtil.PackageMerger

A specialized copier that "expands" the bindings of templates modeled by TemplateableElements to apply the bindings' parameter substitutions within a bound element. The template bindings are then destroyed as it is effectively replaced by a realization of the template; this is in many ways similar to the way that the UMLUtil.PackageMerger works to effect a Package's PackageMerges.

Since:
5.0
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.uml2.uml.util.UMLUtil.PackageMerger
UMLUtil.PackageMerger.BodyMatcher, UMLUtil.PackageMerger.ImplicitAssociationNameMatcher, UMLUtil.PackageMerger.KeyMatcher, UMLUtil.PackageMerger.NameMatcher, UMLUtil.PackageMerger.ResultingQNameMatcher, UMLUtil.PackageMerger.SourceMatcher, UMLUtil.PackageMerger.StringValueMatcher, UMLUtil.PackageMerger.TypeMatcher
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
protected  TemplateBinding binding
           
static int MISSING_PARAMETER_SUBSTITUTION
          The diagnostic code for cases where parameter substitutions are missing.
static java.lang.String OPTION__MISSING_PARAMETER_SUBSTITUTIONS
          The option for handling cases where a template binding does not have a substitution for some parameter and that parameter does not have a default substitution.
protected  java.util.Map<ParameterableElement,ParameterableElement> substitutionMap
           
 
Fields inherited from class org.eclipse.uml2.uml.util.UMLUtil.PackageMerger
ASSOCIATION_SPECIALIZATION, ATTRIBUTE_TRANSFORMATION, CAPABILITY, context, diagnostics, DIFFERENT_PROPERTY_STATICITY, DIFFERENT_PROPERTY_UNIQUENESS, EMPTY_QUALIFIED_NAME, EMPTY_UNION, IMPLICIT_REDEFINITION, INDISTINGUISHABLE_CLASSIFIER, INVALID_REDEFINITION, INVALID_SUBSET, mergedElements, mergedPackages, OPTION__ASSOCIATION_SPECIALIZATIONS, OPTION__ATTRIBUTE_TRANSFORMATIONS, OPTION__CAPABILITIES, OPTION__DIFFERENT_PROPERTY_STATICITY, OPTION__DIFFERENT_PROPERTY_UNIQUENESS, OPTION__EMPTY_QUALIFIED_NAMES, OPTION__EMPTY_UNIONS, OPTION__IMPLICIT_REDEFINITIONS, OPTION__INDISTINGUISHABLE_CLASSIFIERS, OPTION__INVALID_REDEFINITIONS, OPTION__INVALID_SUBSETS, OPTION__REDUNDANT_GENERALIZATIONS, options, receivingElement, receivingPackage, REDUNDANT_GENERALIZATION, resultingToMergedEObjectMap
 
Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
resolveProxies, useOriginalReferences
 
Constructor Summary
UMLUtil.TemplateExpander()
           
 
Method Summary
protected  void cleanupMergeRelationships()
          Cleans up (removing or otherwise trimming as necessary) the relationships on the UMLUtil.PackageMerger.receivingElement that define the merges that were performed.
protected  void copyAttribute(org.eclipse.emf.ecore.EAttribute eAttribute, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyEObject)
           
protected  void copyContainment(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyEObject)
           
 void copyReferences()
           
protected  org.eclipse.emf.ecore.EObject createCopy(org.eclipse.emf.ecore.EObject eObject)
           
 java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<org.eclipse.emf.ecore.EObject>> expand(TemplateableElement boundElement, java.util.Map<java.lang.String,java.lang.String> options, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<org.eclipse.emf.ecore.EObject>> expand(TemplateBinding binding, TemplateableElement receivingElement, java.util.Map<java.lang.String,java.lang.String> options, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  TemplateParameterSubstitution findSubstitution(TemplateParameter templateParameter)
           
protected  UML2Util.EObjectMatcher getAssociationMatcher(Association association)
           
protected  NamedElement getCapability(org.eclipse.emf.ecore.EObject mergedEObject)
          Queries the template in our scope that is or contains (recursively) the given object.
protected  NamedElement getReceivingElement(org.eclipse.emf.ecore.EObject resultingEObject)
          Queries the bound template in our scope that is or contains (recursively) the given object.
protected  ParameterableElement getSubstitution(ParameterableElement parameterableElement)
           
protected  void mergeLiteralString_Value(LiteralString receivingLiteralString, LiteralString mergedLiteralString)
           
protected  void mergeNamedElement_Name(NamedElement receivingNamedElement, NamedElement mergedNamedElement)
           
protected  void processMissingParameterSubstitutions(java.util.Map<java.lang.String,java.lang.String> options, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
           
protected  void processNameExpressions()
          Replace named element names with (template-expanded) name expressions where appropriate.
protected  void processOptions(java.util.Map<java.lang.String,java.lang.String> options, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,java.lang.Object> context)
           
 
Methods inherited from class org.eclipse.uml2.uml.util.UMLUtil.PackageMerger
copy, copyAll, copyReference, getAllMergedPackages, getMatchCandidates, getMergedEObjects, getPreviouslyMergedEObject, getResultingQName, isPackageMerge, merge, merge, mergeAssociation_IsDerived, mergeClassifier_IsAbstract, mergeClassifier_IsFinalSpecialization, mergeLiteralInteger_Value, mergeLiteralUnlimitedNatural_Value, mergeMultiplicityElement_IsOrdered, mergeMultiplicityElement_IsUnique, mergeMultiplicityElement_Lower, mergeMultiplicityElement_Upper, mergeNamedElement_Visibility, mergeProperty_IsDerived, mergeProperty_IsDerivedUnion, mergeRedefinableElement_IsLeaf, mergeStructuralFeature_IsReadOnly, mergeTypedElement_Type, processAssociationSpecializations, processCapabilities, processDifferentPropertyStaticity, processDifferentPropertyUniqueness, processEmptyQualifiedNames, processEmptyUnions, processImplicitRedefinitions, processIndistinguishableClassifiers, processInvalidRedefinitions, processInvalidSubsets, processRedundantGeneralizations, updateReferences
 
Methods inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
copyAttributeValue, copyFeatureMap, copyProxyURI, getTarget, getTarget, getTarget, getTarget
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Field Detail

OPTION__MISSING_PARAMETER_SUBSTITUTIONS

public static final java.lang.String OPTION__MISSING_PARAMETER_SUBSTITUTIONS
The option for handling cases where a template binding does not have a substitution for some parameter and that parameter does not have a default substitution. Supported choices are OPTION__IGNORE and OPTION__REPORT.

See Also:
Constant Field Values

MISSING_PARAMETER_SUBSTITUTION

public static final int MISSING_PARAMETER_SUBSTITUTION
The diagnostic code for cases where parameter substitutions are missing.

See Also:
Constant Field Values

binding

protected TemplateBinding binding

substitutionMap

protected java.util.Map<ParameterableElement,ParameterableElement> substitutionMap
Constructor Detail

UMLUtil.TemplateExpander

public UMLUtil.TemplateExpander()
Method Detail

findSubstitution

protected TemplateParameterSubstitution findSubstitution(TemplateParameter templateParameter)

getSubstitution

protected ParameterableElement getSubstitution(ParameterableElement parameterableElement)

mergeNamedElement_Name

protected void mergeNamedElement_Name(NamedElement receivingNamedElement,
                                      NamedElement mergedNamedElement)

mergeLiteralString_Value

protected void mergeLiteralString_Value(LiteralString receivingLiteralString,
                                        LiteralString mergedLiteralString)

copyAttribute

protected void copyAttribute(org.eclipse.emf.ecore.EAttribute eAttribute,
                             org.eclipse.emf.ecore.EObject eObject,
                             org.eclipse.emf.ecore.EObject copyEObject)
Overrides:
copyAttribute in class UMLUtil.PackageMerger

copyContainment

protected void copyContainment(org.eclipse.emf.ecore.EReference eReference,
                               org.eclipse.emf.ecore.EObject eObject,
                               org.eclipse.emf.ecore.EObject copyEObject)
Overrides:
copyContainment in class UMLUtil.PackageMerger

getAssociationMatcher

protected UML2Util.EObjectMatcher getAssociationMatcher(Association association)
Overrides:
getAssociationMatcher in class UMLUtil.PackageMerger

createCopy

protected org.eclipse.emf.ecore.EObject createCopy(org.eclipse.emf.ecore.EObject eObject)
Overrides:
createCopy in class UMLUtil.PackageMerger

copyReferences

public void copyReferences()
Overrides:
copyReferences in class org.eclipse.emf.ecore.util.EcoreUtil.Copier

processMissingParameterSubstitutions

protected void processMissingParameterSubstitutions(java.util.Map<java.lang.String,java.lang.String> options,
                                                    org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                                    java.util.Map<java.lang.Object,java.lang.Object> context)

processNameExpressions

protected void processNameExpressions()
Replace named element names with (template-expanded) name expressions where appropriate.


getCapability

protected NamedElement getCapability(org.eclipse.emf.ecore.EObject mergedEObject)
Queries the template in our scope that is or contains (recursively) the given object. A template is one that has a signature bound by a template binding that we are expanding.

Overrides:
getCapability in class UMLUtil.PackageMerger
Parameters:
eObject - an object
Returns:
its nearest containing template, which may be itself
Since:
5.0

getReceivingElement

protected NamedElement getReceivingElement(org.eclipse.emf.ecore.EObject resultingEObject)
Queries the bound template in our scope that is or contains (recursively) the given object. A bound template is one that has a template binding that we are expanding.

Overrides:
getReceivingElement in class UMLUtil.PackageMerger
Parameters:
eObject - an object
Returns:
its nearest containing bound template, which may be itself
Since:
5.0

processOptions

protected void processOptions(java.util.Map<java.lang.String,java.lang.String> options,
                              org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                              java.util.Map<java.lang.Object,java.lang.Object> context)
Overrides:
processOptions in class UMLUtil.PackageMerger

cleanupMergeRelationships

protected void cleanupMergeRelationships()
Description copied from class: UMLUtil.PackageMerger
Cleans up (removing or otherwise trimming as necessary) the relationships on the UMLUtil.PackageMerger.receivingElement that define the merges that were performed.

Overrides:
cleanupMergeRelationships in class UMLUtil.PackageMerger

expand

protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<org.eclipse.emf.ecore.EObject>> expand(TemplateBinding binding,
                                                                                                            TemplateableElement receivingElement,
                                                                                                            java.util.Map<java.lang.String,java.lang.String> options,
                                                                                                            org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                                                                                            java.util.Map<java.lang.Object,java.lang.Object> context)

expand

public java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<org.eclipse.emf.ecore.EObject>> expand(TemplateableElement boundElement,
                                                                                                         java.util.Map<java.lang.String,java.lang.String> options,
                                                                                                         org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                                                                                         java.util.Map<java.lang.Object,java.lang.Object> context)

Copyright 2003, 2014 IBM Corporation, CEA, and others.
All Rights Reserved.