public Set<Message> allMessages(ThingMLModel self) {
   Set<Message> msg = new HashSet<Message>();
   for (Thing t : allThings(self)) {
     msg.addAll(ThingMLHelpers.allMessages(t));
   }
   return msg;
 }
 public static Set<Type> allUsedSimpleTypes(ThingMLModel model) {
   Set<Type> result = new HashSet<Type>();
   for (Type t : allSimpleTypes(model)) {
     for (Thing thing : allThings(model)) {
       for (Property p : ThingHelper.allPropertiesInDepth(thing)) {
         if (EcoreUtil.equals(p.getType(), t)) result.add(t);
       }
       for (Message m : ThingMLHelpers.allMessages(thing)) {
         for (Parameter p : m.getParameters()) {
           if (EcoreUtil.equals(p.getType(), t)) {
             result.add(t);
           }
         }
       }
     }
   }
   return result;
 }