public void resolve(
      String identifier,
      org.sintef.thingml.InstanceRef container,
      org.eclipse.emf.ecore.EReference reference,
      int position,
      boolean resolveFuzzy,
      final org.sintef.thingml.resource.thingml.IThingmlReferenceResolveResult<
              org.sintef.thingml.Instance>
          result) {

    // In which configuration should we look:
    Configuration cfg = ThingMLHelpers.findContainingConfiguration(container);
    if (cfg != null) {

      for (Instance ci : cfg.getInstances()) {
        if (ci.getName().startsWith(identifier)) {
          if (resolveFuzzy) result.addMapping(ci.getName(), ci);
          else if (ci.getName().equals(identifier)) result.addMapping(ci.getName(), ci);
        }
      }
      if (!result.wasResolved())
        result.setErrorMessage(
            "Cannot resolve instance " + identifier + " in configuration " + cfg.getName());
    }
    if (!result.wasResolved()) result.setErrorMessage("Cannot resolve instance " + identifier);
  }
  public void resolve(
      String identifier,
      org.sintef.thingml.MessageParameter container,
      org.eclipse.emf.ecore.EReference reference,
      int position,
      boolean resolveFuzzy,
      final org.sintef.thingml.resource.thingml.IThingmlReferenceResolveResult<
              org.sintef.thingml.Message>
          result) {
    Thing thing = ThingMLHelpers.findContainingThing(container);

    for (Message m : thing.allMessages()) {
      if (resolveFuzzy && m.getName().startsWith(identifier)) {
        result.addMapping(m.getName(), m);
      } else if (!resolveFuzzy && m.getName().equals(identifier)) {
        result.addMapping(m.getName(), m);
      }
    }

    if (!result.wasResolved()) result.setErrorMessage("Cannot resolve message name: " + identifier);
  }
 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);
 }