Exemplo n.º 1
0
  @Override
  public void runTest() throws Exception {
    super.runTest();

    checkLibrary((Library) QvtOperationalStdLibrary.INSTANCE.getStdLibModule());
    EList<ModuleImport> moduleImports =
        getCompiledResults()[0].getModules().get(0).getModuleImport();
    assertEquals(moduleImports.size(), 2);

    for (ModuleImport nextImport : moduleImports) {
      checkLibrary((Library) nextImport.getImportedModule());
    }
  }
  private void readHierarchy(Module module) {
    for (ModuleImport moduleImport : module.getModuleImport()) {
      Module importedModule = moduleImport.getImportedModule();
      if (importedModule != null) {
        readHierarchy(importedModule);
      }
    }

    for (EStructuralFeature nextFeature : module.getEAllStructuralFeatures()) {
      if (nextFeature instanceof ContextualProperty) {
        ContextualProperty ctxProp = (ContextualProperty) nextFeature;
        if (ctxProp.getContext() == null) {
          continue;
        }
        String name = ctxProp.getName();
        List<Entry> entryList = getData().get(name);
        if (entryList == null) {
          entryList = new LinkedList<Entry>();
          getData().put(name, entryList);
        }

        boolean joined = false;
        for (Entry entry : entryList) {
          if (entry.addIfApplicable(ctxProp)) {
            joined = true;
            break;
          }
        }

        if (!joined) {
          Entry newEntry = new Entry();
          entryList.add(newEntry);
          newEntry.addIfApplicable(ctxProp);
        }
      }
    }
  }