DirectedGraph<String, DefaultEdge> namespaceDAG = new DirectedMultigraph<>(DefaultEdge.class); extensionsUsedInApp.forEach(namespace -> fillDependencyGraph(namespaceDAG, namespace, allExtensionsByNamespace)); GraphIterator<String, DefaultEdge> graphIterator = new TopologicalOrderIterator<>(namespaceDAG);
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); }
public boolean hasClass(String className) { return inheritanceGraph.containsVertex(className); }
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 ); }
Set<Arc> arcs = graph.edgeSet(); Set<Node> nodes = graph.vertexSet(); GNodes.outArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; GNodes.inArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; GNodes.states[n.id] = n.state; int i; Set<Arc> outarc = graph.outgoingEdgesOf(n); if (!outarc.isEmpty()) { int[] out = new int[outarc.size()]; Set<Arc> inarc = graph.incomingEdgesOf(n); if (!inarc.isEmpty()) { int[] in = new int[inarc.size()];
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 Set<String> getAllClasses() { return inheritanceGraph.vertexSet(); }
public Map<ScopeExpression, Set<Scope>> getEdgeMapping( PlannerContext plannerContext, ElementGraph elementGraph, Map<ElementExpression, FlowElement> vertexMapping ) { Map<ScopeExpression, Set<Scope>> edgeMapping = new HashMap<>(); DirectedMultigraph<ElementExpression, ScopeExpression> delegate = matchExpression.getGraph(); for( ScopeExpression scopeExpression : delegate.edgeSet() ) { ElementExpression lhs = delegate.getEdgeSource( scopeExpression ); ElementExpression rhs = delegate.getEdgeTarget( scopeExpression ); FlowElement lhsElement = vertexMapping.get( lhs ); FlowElement rhsElement = vertexMapping.get( rhs ); Set<Scope> edges = elementGraph.getAllEdges( lhsElement, rhsElement ); if( edges != null ) edgeMapping.put( scopeExpression, edges ); } return edgeMapping; }
Set<Arc> arcs = graph.edgeSet(); Set<Node> nodes = graph.vertexSet(); GNodes.outArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; GNodes.inArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; GNodes.states[n.id] = n.state; int i; Set<Arc> outarc = graph.outgoingEdgesOf(n); if (!outarc.isEmpty()) { int[] out = new int[outarc.size()]; Set<Arc> inarc = graph.incomingEdgesOf(n); if (!inarc.isEmpty()) { int[] in = new int[inarc.size()];
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 int getNumClasses() { return inheritanceGraph.vertexSet().size(); }
ListenableDirectedMultigraph(Class<E> edgeClass) { super(new DirectedMultigraph<V, E>(edgeClass)); } }
graph = new DirectedMultigraph<>(null, null, false); ArrayList<HashSet<Arc>> tmp = new ArrayList<>(totalSizes); for (int i = 0; i < totalSizes; i++) graph.addVertex(tink); a = new Node(k, i, nid++); in[i * pi.getNbStates() + k] = a; graph.addVertex(a); b = new Node(qn, i + 1, nid++); in[(i + 1) * pi.getNbStates() + qn] = b; graph.addVertex(b); graph.addEdge(a, b, arc); tmp.get(idx).add(arc); mark.set(k); graph.addEdge(o, tink, a);
this.supports = new StoredIndexedBipartiteSetWithOffset[supportLength]; Set<Arc> arcs = graph.edgeSet(); Set<Node> nodes = graph.vertexSet(); GNodes.outArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; GNodes.inArcs = new StoredIndexedBipartiteSetWithOffset[nodes.size()]; Set<Arc> outarc = graph.outgoingEdgesOf(n); if (!outarc.isEmpty()) { int[] out = new int[outarc.size()]; Set<Arc> inarc = graph.incomingEdgesOf(n); if (!inarc.isEmpty()) { int[] in = new int[inarc.size()];
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); }
List<DataType> getSubVertexes(DataType vertex) { if (super.containsVertex(vertex)) { return asList(vertex); } return vertexSet().stream().filter(vertex::isCompatibleWith).collect(toList()); }
/** * No-arg constructor meant for JAXB. */ private SIGraph () { super(new DirectedMultigraph(Relation.class), true /* reuseEvents */); }
graph = new DirectedMultigraph<>(null, null, false); ArrayList<HashSet<Arc>> tmp = new ArrayList<>(totalSizes); for (int i = 0; i < totalSizes; i++) { graph.addVertex(tink); a = new Node(k, i, nid++); in[i * pi.getNbStates() + k] = a; graph.addVertex(a); b = new Node(qn, i + 1, nid++); in[(i + 1) * pi.getNbStates() + qn] = b; graph.addVertex(b); graph.addEdge(a, b, arc); tmp.get(idx).add(arc); graph.addEdge(o, tink, a);