Esempio n. 1
0
 public static ArrayList<Message> findOutgoingMessage(Port port, String name, boolean fuzzy) {
   ArrayList<Message> result = new ArrayList<Message>();
   for (Message t : port.getSends()) {
     if (t.getName().startsWith(name)) {
       if (fuzzy) result.add(t);
       else if (t.getName().equals(name)) result.add(t);
     }
   }
   return result;
 }
Esempio n. 2
0
 public static ArrayList<Message> findMessage(Thing thing, String name, boolean fuzzy) {
   ArrayList<Message> result = new ArrayList<Message>();
   for (Message msg : allMessages(thing)) {
     if (msg.getName().startsWith(name)) {
       if (fuzzy) result.add(msg);
       else if (msg.getName().equals(name)) result.add(msg);
     }
   }
   return result;
 }
  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);
  }