コード例 #1
0
  /**
   * Convert relations with all classes into UML query
   *
   * @param classList
   */
  public void convertUMLRelation(ArrayList<RealClass> classList) {
    if (relationList == null
        || relationList.getRelations() == null
        || relationList.getRelations().size() == 0) {
      return;
    }

    String umlTargetClassName = "";
    if (getRelationList() == null
        || getRelationList().getRelations() == null
        || getRelationList().getRelations().size() == 0
        || UMLClassName == "") {
      return;
    }
    for (ClassRelation classRelation : getRelationList().getRelations()) {
      umlTargetClassName = "[" + classRelation.getTargetClass() + "]";
      for (RealClass realClass : classList) {
        if (realClass.getClassName().contains(classRelation.getTargetClass())) {
          if (realClass.isInterface) {
            umlTargetClassName = "[%C2%ABInterface%C2%BB;" + realClass.getClassName() + "]";
          }
        }
      }

      setUMLClassRelation(
          getUMLClassRelation()
              + UMLClassName
              + classRelation.getRelationship()
              + umlTargetClassName
              + ",");
    }
  }
コード例 #2
0
  public void displayClass() {
    System.out.println("############################################");
    System.out.println("(" + this.getClassName() + ")");
    if (this.getExtendsFrom() != null && this.getExtendsFrom().size() != 0) {
      System.out.println("__________________");
      System.out.print("extends from ");
      for (String string : this.getExtendsFrom()) {
        System.out.println(string);
      }
    }
    if (this.getClassAttributes() != null && this.getClassAttributes().size() != 0) {
      System.out.println("________Attributes________");
      for (ClassAttribute attribute : this.getClassAttributes()) {
        System.out.println(
            attribute.getAccessModifier()
                + attribute.getAttributeName()
                + ":"
                + attribute.getAttributeType());
      }
    }
    if (this.getClassMethods() != null && this.getClassMethods().size() != 0) {
      System.out.println("_________Methods_________");
      String parameterStr = "";
      for (ClassMethod classMethod : this.getClassMethods()) {
        ArrayList<MethodParameter> parameters = classMethod.getRealParameters();
        if (parameters != null && parameters.size() != 0) {
          for (MethodParameter parameter : parameters) {
            parameterStr +=
                parameter.getParameterName() + ":" + parameter.getParameterType() + ", ";
          }
          parameterStr = parameterStr.substring(0, parameterStr.length() - 1 - 1);
        }

        System.out.println(
            classMethod.getMethodModifier()
                + classMethod.getMethodName()
                + " : "
                + classMethod.getMethodReturnType()
                + " ("
                + parameterStr
                + ")");
      }
    }
    if (this.getClassRelations() != null && this.getClassRelations().size() != 0) {
      System.out.println(
          "_________Relations__________" + this.getRelationList().getRelations().size());
      for (ClassRelation relation : this.getRelationList().getRelations()) {
        System.out.println(className + relation.getRelationship() + relation.getTargetClass());
      }
    }
  }