/** * 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 + ","); } }
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()); } } }
/** * Check relationList and classRelations both have the same relationships Eventually, relationList * must keep synchronous to classRelations Using two nested loop */ public void refreshRelationList() { if (classRelations == null || classRelations.size() == 0) { return; } if (relationList == null || relationList.getRelations() == null) { this.setRelationList(new RelationList(className, classRelations)); } else { for (ClassRelation classRelation : classRelations) { for (ClassRelation iterateRelation : relationList.getRelations()) { if (!classRelation.valueEquals(iterateRelation)) { relationList.getRelations().add(classRelation); } } } } }