public DirectedGraph getReversedGraph() { DuctGraph reversedGraph = new DuctGraph(); Graphs.addGraphReversed( reversedGraph, ductGraph ); return reversedGraph; }
public int ordinalBetween( Duct lhs, Duct rhs ) { return ductGraph.getEdge( lhs, rhs ).getOrdinal(); }
public synchronized DuctGraph.Ordinal makeOrdinal( int ordinal ) { return ( (DuctOrdinalEdgeFactory) getEdgeFactory() ).makeOrdinal( ordinal ); } }
public void addPath( Duct lhs, int ordinal, Duct rhs ) { if( lhs == null && rhs == null ) throw new IllegalArgumentException( "both lhs and rhs may not be null" ); if( lhs == getTAIL() ) throw new IllegalStateException( "lhs may not be a TAIL" ); if( rhs == getHEAD() ) throw new IllegalStateException( "rhs may not be a HEAD" ); if( lhs == null ) lhs = getHEAD(); if( rhs == null ) rhs = getTAIL(); try { ductGraph.addVertex( lhs ); ductGraph.addVertex( rhs ); ductGraph.addEdge( lhs, rhs, ductGraph.makeOrdinal( ordinal ) ); } catch( RuntimeException exception ) { LOG.error( "unable to add path", exception ); printGraphError(); throw exception; } }
public Duct[] findAllNextFor( Duct current ) { Set<DuctGraph.Ordinal> outgoing = ductGraph.outgoingEdgesOf( current ); LinkedList<Duct> successors = new LinkedList<Duct>(); for( DuctGraph.Ordinal edge : outgoing ) { Duct successor = ductGraph.getEdgeTarget( edge ); if( successor == getHEAD() ) throw new IllegalStateException( "HEAD may not be next" ); if( successor == getTAIL() ) // tail is not included, its just a marker continue; successor = wrapWithOrdinal( edge, successor ); successors.add( successor ); } return successors.toArray( new Duct[ successors.size() ] ); }
public Collection<Duct> getAllDucts() { return ductGraph.vertexSet(); }
return null; Set<DuctGraph.Ordinal> edges = ductGraph.outgoingEdgesOf( current ); Duct next = ductGraph.getEdgeTarget( edge );