示例#1
0
  public ArrayList<String> obtainCommonalities(String[] ecoreFiles) throws Exception {
    ArrayList<String> commonality = new ArrayList<String>();
    ArrayList<Language> languages = new ArrayList<Language>();
    for (String ecoreFile : ecoreFiles) {
      Metamodel metamodel = MelangeFactory.eINSTANCE.createMetamodel();
      metamodel.setEcoreUri(ecoreFile);
      Language language = MelangeFactory.eINSTANCE.createLanguage();
      language.setName(ecoreFile);
      language.setSyntax(metamodel);
      languages.add(language);
    }

    ConceptComparison comparisonOperator = new NamingConceptComparison();

    ArrayList<TupleConceptMember> conceptMemberList =
        FamiliesServices.getInstance().getConceptMemberMappingList(languages);
    ArrayList<TupleConceptMembers> conceptMemberGroupList =
        FamiliesServices.getInstance()
            .getConceptMemberGroupList(conceptMemberList, comparisonOperator);

    for (TupleConceptMembers conceptMembersGroupVO : conceptMemberGroupList) {
      if (this.commonality(conceptMembersGroupVO, languages)) {
        commonality.add(conceptMembersGroupVO.getConcept().getName());
      }
    }
    return commonality;
  }
示例#2
0
  private boolean commonality(
      TupleConceptMembers conceptMembersGroupVO, ArrayList<Language> languages) {
    boolean allContained = true;
    for (Language language : languages) {
      allContained =
          allContained
              && conceptMembersGroupVO.getMembers().contains(language.getSyntax().getEcoreUri());

      if (!allContained) continue;
    }
    return allContained && languages.size() == conceptMembersGroupVO.getMembers().size();
  }