/** * 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 + ","); } }
/** * 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); } } } } }