public Collection<Language> getAllExtendingLanguages(Language l) {
    List<Language> result = new LinkedList<Language>();
    for (Language lang : getAllModules(Language.class)) {

      if (ModuleUtil.refsToLanguages(lang.getExtendedLanguageRefs()).contains(l)) {
        result.add(lang);
      }
    }
    return result;
  }
Example #2
0
  public static boolean checkCyclicInheritance(Language lang) {

    List<Language> frontier = ModuleUtil.refsToLanguages(lang.getExtendedLanguageRefs());
    ArrayList<Language> passed = new ArrayList<Language>();
    while (!frontier.isEmpty()) {
      List<Language> newFrontier = new ArrayList<Language>();
      for (Language extendedLang : frontier) {
        if (extendedLang == lang && lang != BootstrapLanguages.coreLanguage()) {
          return false;
        }
        if (!passed.contains(extendedLang)) {

          newFrontier.addAll(ModuleUtil.refsToLanguages(extendedLang.getExtendedLanguageRefs()));
        }
        passed.add(extendedLang);
      }
      frontier = newFrontier;
    }
    return true;
  }
Example #3
0
  private void fillInDevkits(Set<IModule> initialModules) {
    myUsedDevkits = new HashSet<DevKit>();
    for (IModule m : initialModules) {
      if (m instanceof DevKit) {
        DevKit dk = (DevKit) m;
        myUsedDevkits.add(dk);
        myUsedDevkits.addAll(dk.getAllExtendedDevkits());
      }

      for (DevKit dk : ModuleUtil.refsToDevkits(m.getUsedDevkitReferences())) {
        myUsedDevkits.add(dk);
        myUsedDevkits.addAll(dk.getAllExtendedDevkits());
      }
    }
  }