コード例 #1
0
 public String getClassSemantics(EClass eClass) {
   String semantics =
       getLatexDocAnnotation(
           eClass, prefs.getPreferenceString(PreferenceConstants.P_SEMANTICS_KEY));
   if (semantics != null) {
     StringBuilder sb = new StringBuilder();
     sb.append("\\subsubsection*{Semantics} ~\\\\\n");
     sb.append(semantics);
     return sb.toString();
   }
   return "\\subsubsection*{Semantics} ~\\\\ No additional description";
 }
コード例 #2
0
 public String getClassDescription(EClass eClass) {
   String description =
       getLatexDocAnnotation(
           eClass, prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY));
   if (description != null) {
     StringBuilder sb = new StringBuilder();
     sb.append("\\subsubsection*{Description} ~\\\\\n");
     sb.append(description);
     return sb.toString();
   }
   return "\\subsubsection*{Description} ~\\\\ No additional description";
 }
コード例 #3
0
 public String getClassAttributes(EClass eClass) {
   // if attributes exist
   if (eClass.getEAttributes().size() > 0) {
     StringBuilder sb = new StringBuilder();
     sb.append("\\subsubsection*{Attributes}\n");
     sb.append("\\begin{itemize}\n");
     // for each attribute
     for (EAttribute eAttribute : eClass.getEAttributes()) {
       sb.append("\\item ");
       // Name
       sb.append(eAttribute.getName()).append(": ");
       // Type
       if (eAttribute.getEAttributeType().getInstanceClass() != null) {
         sb.append(eAttribute.getEAttributeType().getInstanceClass().getSimpleName()).append(" ");
       } else {
         sb.append("\\nameref{").append(eAttribute.getEAttributeType().getName()).append("} ");
       }
       // Mult
       sb.append(getMultiplicity(eAttribute)).append(" ");
       // Default Value
       if (eAttribute.getDefaultValue() != null) {
         sb.append(" \\textit{~=~").append(eAttribute.getDefaultValue()).append("} ");
       }
       // Description
       if (getLatexDocAnnotation(
               eAttribute, prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY))
           != null) {
         sb.append("\\newline\n")
             .append(
                 getLatexDocAnnotation(
                     eAttribute,
                     prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY)));
       }
       sb.append("\n");
     } // for each attribute
     sb.append("\\end{itemize}");
     return sb.toString();
   }
   return "\\subsubsection*{Attributes} ~\\\\ No additional attributes";
 }
コード例 #4
0
 public String getClassAssociations(EClass eClass) {
   // if associations exist
   if (eClass.getEReferences().size() > 0) {
     StringBuilder sb = new StringBuilder();
     sb.append("\\subsubsection*{Associations}\n");
     sb.append("\\begin{itemize}\n");
     for (EReference eReference : eClass.getEReferences()) {
       sb.append("\\item ");
       // Name
       sb.append(eReference.getName()).append(": ");
       // Type
       // Works only for internal
       sb.append("\\nameref{").append(eReference.getEReferenceType().getName()).append("} ");
       // Mult
       sb.append(getMultiplicity(eReference)).append(" ");
       // Containement
       if (eReference.isContainment()) {
         sb.append("(containment) ");
       }
       // Description
       if (getLatexDocAnnotation(
               eReference, prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY))
           != null) {
         sb.append("\\newline\n")
             .append(
                 getLatexDocAnnotation(
                     eReference,
                     prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY)));
       }
       sb.append("\n");
     }
     sb.append("\\end{itemize}");
     return sb.toString();
   }
   return "\\subsubsection*{Associations} ~\\\\ No additional associations";
 }
コード例 #5
0
 public String getPackageDescription(EPackage ePackage) {
   String description =
       getLatexDocAnnotation(
           ePackage, prefs.getPreferenceString(PreferenceConstants.P_DESCRIPTION_KEY));
   return (description != null) ? description : "";
 }
コード例 #6
0
 public String getLatexDocAnnotation(EModelElement eModelElement, String key) {
   EAnnotation annotation =
       eModelElement.getEAnnotation(prefs.getPreferenceString(PreferenceConstants.P_NAMESPACE));
   return (annotation != null) ? annotation.getDetails().get(key) : null;
 }