Exemplo n.º 1
0
  private void replaceVertex(JavaClass newClass) {
    List<JavaClass> incomingEdges = getParents(newClass);

    graph.removeVertex(newClass);
    graph.addVertex(newClass);
    for (JavaClass each : incomingEdges) {
      graph.addEdge(each, newClass);
    }
  }
Exemplo n.º 2
0
 private void updateParentReferences(JavaClass parentClass) {
   for (String child : parentClass.getImports()) {
     JavaClass childClass = findJavaClass(child);
     if ((childClass != null) && !childClass.equals(parentClass)) {
       if (graph.containsVertex(childClass)) {
         graph.addEdge(parentClass, childClass);
       }
     }
   }
 }
Exemplo n.º 3
0
 private JavaClass findClass(String classname) {
   for (JavaClass jClass : graph.vertexSet()) {
     if (jClass.getName().equals(classname)) {
       return jClass;
     }
   }
   return null;
 }
Exemplo n.º 4
0
 public Set<String> getIndexedClasses() {
   Set<String> classes = newHashSet();
   Set<JavaClass> vertexSet = graph.vertexSet();
   for (JavaClass each : vertexSet) {
     classes.add(each.getName());
   }
   return classes;
 }
Exemplo n.º 5
0
 private void addToGraph(JavaClass newClass) {
   if (!graph.addVertex(newClass)) {
     replaceVertex(newClass);
   }
 }