protected static class DirectedAcyclicGraph.VisitedHashSetImpl extends Object implements DirectedAcyclicGraph.VisitedStrategy, DirectedAcyclicGraph.VisitedStrategyFactory
HashSet.
This implementation doesn't seem to perform as well, though I can imagine circumstances where it should shine (lots and lots of vertices). It also should have the lowest memory footprint as it only uses storage for indices that have been visited.
| Constructor and Description |
|---|
VisitedHashSetImpl()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearVisited(int index)
Clear the visited state of the given topological index.
|
boolean |
getVisited(int index)
Get if the given topological index has been visited.
|
DirectedAcyclicGraph.VisitedStrategy |
getVisitedStrategy(DirectedAcyclicGraph.Region affectedRegion)
Create a new instance of
DirectedAcyclicGraph.VisitedStrategy. |
void |
setVisited(int index)
Mark the given topological index as visited.
|
public DirectedAcyclicGraph.VisitedStrategy getVisitedStrategy(DirectedAcyclicGraph.Region affectedRegion)
DirectedAcyclicGraph.VisitedStrategyFactoryDirectedAcyclicGraph.VisitedStrategy.getVisitedStrategy in interface DirectedAcyclicGraph.VisitedStrategyFactoryaffectedRegion - the affected regionDirectedAcyclicGraph.VisitedStrategy for the affected regionpublic void setVisited(int index)
DirectedAcyclicGraph.VisitedStrategysetVisited in interface DirectedAcyclicGraph.VisitedStrategyindex - the topological indexpublic boolean getVisited(int index)
DirectedAcyclicGraph.VisitedStrategygetVisited in interface DirectedAcyclicGraph.VisitedStrategyindex - the topological indexpublic void clearVisited(int index)
throws UnsupportedOperationException
DirectedAcyclicGraph.VisitedStrategyclearVisited in interface DirectedAcyclicGraph.VisitedStrategyindex - the indexUnsupportedOperationException - if the implementation doesn't support (or doesn't
need) clearance. For example, if the factory creates a new instance every time,
it is a waste of cycles to reset the state after the search of the Affected
Region is done, so an UnsupportedOperationException *should* be thrown.Copyright © 2017. All rights reserved.