Exemplo n.º 1
0
  public static ArrayList<ThingMLModel> allThingMLModelModels(ThingMLModel model) {
    ArrayList<ThingMLModel> result = new ArrayList<ThingMLModel>();
    result.add(model);

    ArrayList<ThingMLModel> temp = new ArrayList<ThingMLModel>();

    int prevSize = result.size();
    int newSize = prevSize;
    do {
      for (ThingMLModel m : result) {
        for (ThingMLModel m2 : m.getImports()) {
          if (!temp.contains(m2)) {
            temp.add(m2);
          }
        }
      }
      for (ThingMLModel m : temp) {
        if (!result.contains(m)) {
          result.add(m);
        }
      }
      prevSize = newSize;
      newSize = result.size();
    } while (newSize > prevSize);
    return result;
  }
Exemplo n.º 2
0
 public static ArrayList<Configuration> allConfigurations(ThingMLModel model) {
   ArrayList<Configuration> result = new ArrayList<Configuration>();
   for (ThingMLModel m : allThingMLModelModels(model)) {
     for (Configuration c : m.getConfigs()) {
       if (!result.contains(c)) result.add(c);
     }
   }
   return result;
 }
Exemplo n.º 3
0
 public static ArrayList<Thing> allThings(ThingMLModel model) {
   ArrayList<Thing> result = new ArrayList<Thing>();
   for (ThingMLModel m : allThingMLModelModels(model)) {
     for (Type t : m.getTypes()) {
       if ((t instanceof Thing) && !result.contains(t)) result.add((Thing) t);
     }
   }
   return result;
 }
Exemplo n.º 4
0
 public static ArrayList<Enumeration> allEnnumerations(ThingMLModel model) {
   ArrayList<Enumeration> result = new ArrayList<Enumeration>();
   for (ThingMLModel m : allThingMLModelModels(model)) {
     for (Type t : m.getTypes()) {
       if ((t instanceof Enumeration) && !result.contains(t)) result.add((Enumeration) t);
     }
   }
   return result;
 }
Exemplo n.º 5
0
 public static ArrayList<Type> allTypes(ThingMLModel model) {
   ArrayList<Type> result = new ArrayList<Type>();
   for (ThingMLModel m : allThingMLModelModels(model)) {
     for (Type t : m.getTypes()) {
       if (!result.contains(t)) result.add(t);
     }
   }
   return result;
 }
Exemplo n.º 6
0
 public static ArrayList<Type> allSimpleTypes(ThingMLModel model) {
   ArrayList<Type> result = new ArrayList<Type>();
   for (ThingMLModel m : allThingMLModelModels(model)) {
     for (Type t : m.getTypes()) {
       if ((t instanceof ObjectType || t instanceof PrimitiveType || t instanceof Enumeration)
           && !result.contains(t)) result.add(t);
     }
   }
   return result;
 }