public ExpressionGraph arc( ElementExpression lhsMatcher, ScopeExpression scopeMatcher, ElementExpression rhsMatcher ) { graph.addVertex( lhsMatcher ); graph.addVertex( rhsMatcher ); // can never re-use edges, must be wrapped graph.addEdge( lhsMatcher, rhsMatcher, new DelegateScopeExpression( scopeMatcher ) ); return this; }
public ExpressionGraph arcs( ElementExpression... matchers ) { ElementExpression lhs = null; for( ElementExpression matcher : matchers ) { graph.addVertex( matcher ); if( lhs != null ) graph.addEdge( lhs, matcher ); lhs = matcher; } return this; }
public void addInterface(String className, String interfaceName) { String classNameWithDots = ResourceList.getClassNameFromResourcePath(className); String interfaceNameWithDots = ResourceList.getClassNameFromResourcePath(interfaceName); inheritanceGraph.addVertex(classNameWithDots); inheritanceGraph.addVertex(interfaceNameWithDots); inheritanceGraph.addEdge(interfaceNameWithDots, classNameWithDots); interfacesSet.add(interfaceNameWithDots); }
public void addSuperclass(String className, String superName, int access) { String classNameWithDots = ResourceList.getClassNameFromResourcePath(className); String superNameWithDots = ResourceList.getClassNameFromResourcePath(superName); if (inheritanceGraph == null) { inheritanceGraph = new DirectedMultigraph<>( DefaultEdge.class); } inheritanceGraph.addVertex(classNameWithDots); inheritanceGraph.addVertex(superNameWithDots); inheritanceGraph.addEdge(superNameWithDots, classNameWithDots); }
private void addNext( DirectedMultigraph graph, Duct previous ) { if( previous instanceof Fork ) { for( Duct next : ( (Fork) previous ).getAllNext() ) { if( next == null || next instanceof Extent ) continue; graph.addVertex( next ); if( graph.containsEdge( previous, next ) ) continue; graph.addEdge( previous, next ); addNext( graph, next ); } } else { Duct next = previous.getNext(); if( next == null || next instanceof Extent ) return; graph.addVertex( next ); if( graph.containsEdge( previous, next ) ) return; graph.addEdge( previous, next ); addNext( graph, next ); } } }
public void printBoundGraph( String filename ) { LOG.info( "writing stream bound graph to {}", filename ); DirectedMultigraph<Duct, Integer> graph = new DirectedMultigraph<>( new EdgeFactory<Duct, Integer>() { int count = 0; @Override public Integer createEdge( Duct sourceVertex, Duct targetVertex ) { return count++; } } ); TopologicalOrderIterator<Duct, Integer> iterator = getTopologicalOrderIterator(); while( iterator.hasNext() ) { Duct previous = iterator.next(); if( graph.containsVertex( previous ) || previous instanceof Extent ) continue; graph.addVertex( previous ); addNext( graph, previous ); } Util.printGraph( filename, graph ); }