public final class AmaltheaIndex
extends Object
An AmaltheaCrossReferenceAdapter
is created and attached to the root context of the model.
The adapter maintains an index that allows fast access to inverse references and an index based on object name.
The method getInverseReferences
is called from several
generated model objects to compute inverse transient references based on the incoming references.
Modifier and Type | Method and Description |
---|---|
static void |
buildIndex(@NonNull Notifier context)
Creates the index explicitly.
|
static void |
delete(@NonNull EObject eObject)
Deletes the object from its
containing resource
and/or its containing object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object). |
static void |
deleteAll(@NonNull Collection<? extends EObject> eObjects)
Deletes the objects from their
containing resource
and/or their containing object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object). |
static void |
deleteAll(@NonNull Collection<? extends EObject> eObjects,
boolean recursive)
Deletes the objects from their
containing resource
and/or their containing object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object). |
static void |
dumpAdapterInfo(@NonNull Notifier context,
int info,
@Nullable PrintStream stream)
Dumps adapter info to a print stream
|
static <T extends INamed> |
getElements(@NonNull Notifier context,
@NonNull Pattern namePattern,
@NonNull Class<T> targetClass)
Finds elements by name pattern and class
|
static <T extends INamed> |
getElements(@NonNull Notifier context,
@NonNull String name,
@NonNull Class<T> targetClass)
Finds elements by name and class
|
static <T> EList<T> |
getInverseReferences(@NonNull EObject eObject,
@NonNull EReference resultEReference,
@NonNull Set<EReference> targetEReferences)
Computes a list of objects that refer to an EObject via dedicated references.
|
static List<Set<IReferable>> |
getObjectsWithConflictingNames(@NonNull Notifier context) |
static Set<EObject> |
getReferringObjects(@NonNull EObject eObject)
Returns a set of objects that refer to the given
eObject . |
static <T extends EObject> |
getReferringObjects(@NonNull EObject eObject,
@NonNull Class<T> targetClass)
Returns a type filtered set of objects that refer to the given
eObject . |
static <T extends EObject> |
getReferringObjects(@NonNull EObject eObject,
@NonNull Class<T> targetClass,
@NonNull EReference targetEReference)
Returns a filtered set of objects that refer to the given
eObject
Filters:
type (targetClass )
reference (targetEReference )
|
public static <T> EList<T> getInverseReferences(@NonNull EObject eObject, @NonNull EReference resultEReference, @NonNull Set<EReference> targetEReferences)
This method is called from several generated model objects to compute an inverse transient reference based on the incoming references.
eObject
- object that implements a derived transient opposite referenceresultEReference
- opposite reference definition (resulting objects are computed)targetEReferences
- list of incoming referencespublic static Set<EObject> getReferringObjects(@NonNull EObject eObject)
eObject
.eObject
- public static <T extends EObject> Set<T> getReferringObjects(@NonNull EObject eObject, @NonNull Class<T> targetClass)
eObject
.eObject
- targetClass
- public static <T extends EObject> Set<T> getReferringObjects(@NonNull EObject eObject, @NonNull Class<T> targetClass, @NonNull EReference targetEReference)
eObject
Filters:
targetClass
)targetEReference
)eObject
- targetClass
- targetEReference
- public static List<Set<IReferable>> getObjectsWithConflictingNames(@NonNull Notifier context)
public static void buildIndex(@NonNull Notifier context)
This method is optional. Normally the index will be built on demand.
eObject
- public static void delete(@NonNull EObject eObject)
containing
resource
and/or its containing
object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object). Contained children of the object
are similarly removed from any features that reference them.eObject
- object to deletepublic static void deleteAll(@NonNull Collection<? extends EObject> eObjects)
containing
resource
and/or their containing
object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object). Contained children of the object
are similarly removed from any features that reference them.eObjects
- objects to deletepublic static void deleteAll(@NonNull Collection<? extends EObject> eObjects, boolean recursive)
containing
resource
and/or their containing
object as well as from any
other feature that references it within the enclosing root context
(resource set, resource or root object).
If recursive is true, contained children of the object are similarly removed
from any features that reference them.eObjects
- objects to deleterecursive
- true: contained children should also be deletedpublic static <T extends INamed> Set<T> getElements(@NonNull Notifier context, @NonNull String name, @NonNull Class<T> targetClass)
context
- EObject, Resource or ResourceSetname
- StringtargetClass
- for example: Label.class
public static <T extends INamed> Set<T> getElements(@NonNull Notifier context, @NonNull Pattern namePattern, @NonNull Class<T> targetClass)
context
- EObject, Resource or ResourceSetnamePattern
- for example: Pattern.compile("Prefix_.*")
targetClass
- for example: Label.class
public static void dumpAdapterInfo(@NonNull Notifier context, int info, @Nullable PrintStream stream)
context
- EObject, Resource or ResourceSetinfo
- content selector stream
- output stream (if undefined then System.out
is used)