예제 #1
0
파일: Fat.java 프로젝트: wolfses/pmd_STANly
 private Map<String, Integer> getChilrenRelation(ElementNode ancestor, ElementNode node) {
   String[] ancSplit = ancestor.getFullName().split("\\.");
   String[] tarSplit = null;
   String[] srcSplit = null;
   Map<String, Integer> relations = new HashMap<String, Integer>();
   for (ElementNode child : node.getChildren()) {
     srcSplit = child.getFullName().split("\\.");
     for (DomainRelation rel : child.getRelationTargets()) {
       if (!rel.getTargetNode().isAncestor(ancestor)) continue;
       tarSplit = rel.getTargetNode().getFullName().split("\\.");
       if (ancSplit.length < srcSplit.length
           && ancSplit.length < tarSplit.length
           && !srcSplit[ancSplit.length].equals(tarSplit[ancSplit.length])) {
         String key = srcSplit[ancSplit.length] + ">" + tarSplit[ancSplit.length];
         Integer value = 0;
         if (relations.containsKey(key)) value = relations.get(key);
         value++;
         relations.put(key, value);
       }
     }
     if (child.getChildren().size() > 0) relations.putAll(getChilrenRelation(ancestor, child));
   }
   return relations;
 }
예제 #2
0
파일: Fat.java 프로젝트: wolfses/pmd_STANly
 private Map<String, Integer> getPackageRelation(ElementNode ancestor, ElementNode node) {
   Map<String, Integer> relations = new HashMap<String, Integer>();
   for (ElementNode child : node.getChildren()) {
     for (DomainRelation rel : child.getRelationTargets()) {
       if (!rel.getTargetNode().isAncestor(ancestor)) continue;
       if (!rel.getSourceNode().getPackageName().equals(rel.getTargetNode().getPackageName())) {
         String key =
             rel.getSourceNode().getPackageName() + ">" + rel.getTargetNode().getPackageName();
         Integer value = 0;
         if (relations.containsKey(key)) value = relations.get(key);
         value++;
         relations.put(key, value);
       }
     }
     if (child.getChildren().size() > 0) relations.putAll(getPackageRelation(ancestor, child));
   }
   return relations;
 }