org.eclipse.ocl.examples.pivot.utilities
Class PivotSaver

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.utilities.AbstractPivotSaver
      extended by org.eclipse.ocl.examples.pivot.utilities.PivotSaver

public class PivotSaver
extends AbstractPivotSaver

PivotSaver ensures that all references to specialized types are terminated by local copies of the specialization.


Nested Class Summary
static class PivotSaver.LocateVisitor
          LocateVisitor locates references to shared specializations, so that local copies can be created and then replaced by the ResolveVisitor.
static class PivotSaver.ResolveVisitor
          ResolveVisitor converts references to shared specializations to references to local copies.
 
Field Summary
static AbstractPivotSaver.Factory FACTORY
           
protected  org.eclipse.emf.ecore.resource.Resource resource
           
 
Constructor Summary
PivotSaver(org.eclipse.emf.ecore.resource.Resource resource)
           
 
Method Summary
 void addSpecializingElement(Element object)
           
 boolean addSpecializingElement(Element object, Operation referredOperation)
           
 boolean addSpecializingElement(Element object, Type referredType)
           
protected  Package getOrphanPackage(org.eclipse.emf.ecore.resource.Resource resource)
           
protected  boolean isOrphanOperation(Operation operation)
           
 Package localizeSpecializations()
          Prepare a pivot resource for save by redirecting all type references to specializations to local copies of the specializations.
protected  void locateSpecializations(java.util.List<? extends org.eclipse.emf.ecore.EObject> eObjects)
           
<T extends Operation>
T
resolveOperation(T referredOperation)
          Return the resolved variant of referredType, which may require creation of a local copy of a specialization.
<T extends Type>
T
resolveType(T referredType)
          Return the resolved variant of referredType, which may require creation of a local copy of a specialization.
 
Methods inherited from class org.eclipse.ocl.examples.pivot.utilities.AbstractPivotSaver
addFactory, getLocateVisitor, getResolveVisitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY

public static AbstractPivotSaver.Factory FACTORY

resource

protected final org.eclipse.emf.ecore.resource.Resource resource
Constructor Detail

PivotSaver

public PivotSaver(org.eclipse.emf.ecore.resource.Resource resource)
Method Detail

addSpecializingElement

public void addSpecializingElement(@NonNull
                                   Element object)
Specified by:
addSpecializingElement in class AbstractPivotSaver

addSpecializingElement

public boolean addSpecializingElement(@NonNull
                                      Element object,
                                      @NonNull
                                      Operation referredOperation)
Specified by:
addSpecializingElement in class AbstractPivotSaver

addSpecializingElement

public boolean addSpecializingElement(@NonNull
                                      Element object,
                                      @NonNull
                                      Type referredType)
Specified by:
addSpecializingElement in class AbstractPivotSaver

getOrphanPackage

protected Package getOrphanPackage(org.eclipse.emf.ecore.resource.Resource resource)

isOrphanOperation

protected boolean isOrphanOperation(Operation operation)

localizeSpecializations

public Package localizeSpecializations()
Prepare a pivot resource for save by redirecting all type references to specializations to local copies of the specializations.


locateSpecializations

protected void locateSpecializations(java.util.List<? extends org.eclipse.emf.ecore.EObject> eObjects)

resolveOperation

@NonNull
public <T extends Operation> T resolveOperation(@NonNull
                                                        T referredOperation)
Return the resolved variant of referredType, which may require creation of a local copy of a specialization.

Specified by:
resolveOperation in class AbstractPivotSaver

resolveType

@NonNull
public <T extends Type> T resolveType(@NonNull
                                              T referredType)
Return the resolved variant of referredType, which may require creation of a local copy of a specialization.

Specified by:
resolveType in class AbstractPivotSaver