Exemplo n.º 1
0
  public RefOntoUML.Association DealAssociationStereotype(org.eclipse.uml2.uml.Association a1) {
    System.out.print("<Association> ");
    RefOntoUML.Association a2 = null;

    if (a1.getAppliedStereotypes().size() == 1) {
      org.eclipse.uml2.uml.Stereotype s = a1.getAppliedStereotypes().get(0);

      System.out.print("<<" + s.getName() + ">> ");
      String stereoname = s.getName();

      if (stereoname.compareTo("Formal") == 0) {
        a2 = myfactory.createFormalAssociation();
      } else if (stereoname.compareTo("Material") == 0) {
        a2 = myfactory.createMaterialAssociation();
      } else if (stereoname.compareTo("Mediation") == 0) {
        a2 = myfactory.createMediation();
      } else if (stereoname.compareTo("Derivation") == 0) {
        a2 = myfactory.createDerivation();
      } else if (stereoname.compareTo("Characterization") == 0) {
        a2 = myfactory.createCharacterization();
      } else if (stereoname.compareTo("componentOf") == 0) {
        a2 = myfactory.createcomponentOf();
      } else if (stereoname.compareTo("memberOf") == 0) {
        a2 = myfactory.creatememberOf();
      } else if (stereoname.compareTo("subCollectionOf") == 0) {
        a2 = myfactory.createsubCollectionOf();
      } else if (stereoname.compareTo("subQuantityOf") == 0) {
        a2 = myfactory.createsubQuantityOf();
      }

      if (a2 instanceof RefOntoUML.Meronymic) {
        boolean isShareable = (Boolean) a1.getValue(s, "isShareable");
        boolean isEssential = (Boolean) a1.getValue(s, "isEssential");
        boolean isInseparable = (Boolean) a1.getValue(s, "isInseparable");
        boolean isImmutablePart = (Boolean) a1.getValue(s, "isImmutablePart");
        boolean isImmutableWhole = (Boolean) a1.getValue(s, "isImmutableWhole");

        ((RefOntoUML.Meronymic) a2).setIsShareable(isShareable);
        ((RefOntoUML.Meronymic) a2).setIsEssential(isEssential);
        ((RefOntoUML.Meronymic) a2).setIsInseparable(isInseparable);
        ((RefOntoUML.Meronymic) a2).setIsImmutablePart(isImmutablePart);
        ((RefOntoUML.Meronymic) a2).setIsImmutableWhole(isImmutableWhole);
      }
    } else if (a1.getAppliedStereotypes().size() == 0) {
      org.eclipse.uml2.uml.Property memberEnd2 = a1.getMemberEnds().get(1);
      org.eclipse.uml2.uml.AggregationKind ak = memberEnd2.getAggregation();

      if (ak.getValue() == org.eclipse.uml2.uml.AggregationKind.NONE) {
        a2 = myfactory.createAssociation();
      } else {
        a2 = myfactory.createcomponentOf();
      }
    }

    DealAssociation(a1, a2);
    return a2;
  }