Hi,
I was under the impression that searching an item in the index (meaning an IResourceDescriptions instance) would be in O(1), if the fully qualified name is given. Under Eclipse, this seems to work fine.
However under Standalone, the access seems to be in O(n) (where n is the number of resources within the resourceSet). Am I doing something wrong or is this working as intended?
More details:
1. as index the class ResourceSetBasedResourceDescriptions
is used.
2. the access is in O(n), because ResourceSetBasedResourceDescriptions.getExportedObjects(EClass, QualifiedName, boolean)
indirectly calls ResourceSetBasedResourceDescriptions.getSelectables()
which then calls ResourceSetBasedResourceDescriptions.getAllResourceDescriptions()
which iterates over all resources in order to create ResourceDescriptions. Details are listed below.
3. I call the index by making use of containers, in order to deal with classpath issues:
private def getVisibleEObjectDescriptionsByName(Resource r, EClass type, QualifiedName fqn) {
val tmp = r.getVisibleContainers.flatMap [ c |
c.getExportedObjects(type, fqn, false)
]
return tmp
}
Listings for Point 2:
@Override
public Iterable<IEObjectDescription> getExportedObjects(EClass type, QualifiedName qualifiedName, boolean ignoreCase) {
if (data != null) {
return data.getExportedObjects(type, qualifiedName, ignoreCase);
}
return super.getExportedObjects(type, qualifiedName, ignoreCase);
}
@Override
protected Iterable<? extends ISelectable> getSelectables() {
return getAllResourceDescriptions();
}