Skip to content

Instantly share code, notes, and snippets.

@louismrose
Created June 18, 2010 10:01
Show Gist options
  • Save louismrose/443458 to your computer and use it in GitHub Desktop.
Save louismrose/443458 to your computer and use it in GitHub Desktop.
// Currently type is checked against the name of each class directly
public Collection<EObject> getAllOfType(String type) throws EolModelElementTypeNotFoundException {
...
if (allOfType == null || !cachingEnabled){
allOfType = new ArrayList<EObject>();
for (EObject eObject : allContents()) {
if (eObject.eClass().getName().equals(type) || getFullyQualifiedName(eObject.eClass()).equals(type)){
allOfType.add(eObject);
eClass = eObject.eClass();
}
}
}
...
}
// But perhaps we could use classForName instead?
// classForName uses getFullyQualifiedName if the type contains at least one occurrence of "::"
public Collection<EObject> getAllOfType(String type) throws EolModelElementTypeNotFoundException {
...
EClass eClass = classForName(type);
if (allOfType == null || !cachingEnabled){
allOfType = new ArrayList<EObject>();
for (EObject eObject : allContents()) {
if (eObject.eClass().getName().equals(eClass.getName())) {
allOfType.add(eObject);
}
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment