public static ArrayList<EnumerationLiteral> findEnumerationLiteral( Enumeration e, String name, boolean fuzzy) { ArrayList<EnumerationLiteral> result = new ArrayList<EnumerationLiteral>(); for (EnumerationLiteral t : e.getLiterals()) { if (t.getName().startsWith(name)) { if (fuzzy) result.add(t); else if (t.getName().equals(name)) result.add(t); } } return result; }
public void resolve( String identifier, org.sintef.thingml.EnumLiteralRef container, org.eclipse.emf.ecore.EReference reference, int position, boolean resolveFuzzy, final org.sintef.thingml.resource.thingml.IThingmlReferenceResolveResult< org.sintef.thingml.EnumerationLiteral> result) { ArrayList<EnumerationLiteral> ts = ThingMLHelpers.findEnumerationLiteral(container.getEnum(), identifier, resolveFuzzy); for (EnumerationLiteral t : ts) result.addMapping(t.getName(), t); if (!result.wasResolved()) result.setErrorMessage("Cannot resolve enumeration literal " + identifier); }