com.vividsolutions.jts.planargraph

Class GraphComponent

Known Direct Subclasses:
DirectedEdge, Edge, Node

public abstract class GraphComponent
extends java.lang.Object

The base class for all graph component classes. Maintains flags of use in generic graph algorithms. Provides two flags:
Version:
1.7

Field Summary

protected boolean
isMarked
protected boolean
isVisited

Constructor Summary

GraphComponent()

Method Summary

static GraphComponent
getComponentWithVisitedState(Iterator i, boolean visitedState)
Finds the first GraphComponent in a Iterator set which has the specified visited state.
Object
getContext()
Gets the user-defined data for this component.
Object
getData()
Gets the user-defined data for this component.
boolean
isMarked()
Tests if a component has been marked at some point during the processing involving this graph.
abstract boolean
isRemoved()
Tests whether this component has been removed from its containing graph
boolean
isVisited()
Tests if a component has been visited during the course of a graph algorithm
void
setContext(Object data)
Sets the user-defined data for this component.
void
setData(Object data)
Sets the user-defined data for this component.
static void
setMarked(Iterator i, boolean marked)
Sets the Marked state for all GraphComponents in an Iterator
void
setMarked(boolean isMarked)
Sets the marked flag for this component.
static void
setVisited(Iterator i, boolean visited)
Sets the Visited state for all GraphComponents in an Iterator
void
setVisited(boolean isVisited)
Sets the visited flag for this component.

Field Details

isMarked

protected boolean isMarked

isVisited

protected boolean isVisited

Constructor Details

GraphComponent

public GraphComponent()

Method Details

getComponentWithVisitedState

public static GraphComponent getComponentWithVisitedState(Iterator i,
                                                          boolean visitedState)
Finds the first GraphComponent in a Iterator set which has the specified visited state.
Parameters:
i - an Iterator of GraphComponents
visitedState - the visited state to test
Returns:
the first component found, or null if none found

getContext

public Object getContext()
Gets the user-defined data for this component.
Returns:
the user-defined data

getData

public Object getData()
Gets the user-defined data for this component.
Returns:
the user-defined data

isMarked

public boolean isMarked()
Tests if a component has been marked at some point during the processing involving this graph.
Returns:
true if the component has been marked

isRemoved

public abstract boolean isRemoved()
Tests whether this component has been removed from its containing graph
Returns:
true if this component is removed

isVisited

public boolean isVisited()
Tests if a component has been visited during the course of a graph algorithm
Returns:
true if the component has been visited

setContext

public void setContext(Object data)
Sets the user-defined data for this component.
Parameters:
data - an Object containing user-defined data

setData

public void setData(Object data)
Sets the user-defined data for this component.
Parameters:
data - an Object containing user-defined data

setMarked

public static void setMarked(Iterator i,
                             boolean marked)
Parameters:
i - the Iterator to scan
marked - the state to set the Marked flag to

setMarked

public void setMarked(boolean isMarked)
Sets the marked flag for this component.
Parameters:
isMarked - the desired value of the marked flag

setVisited

public static void setVisited(Iterator i,
                              boolean visited)
Parameters:
i - the Iterator to scan
visited - the state to set the visited flag to

setVisited

public void setVisited(boolean isVisited)
Sets the visited flag for this component.
Parameters:
isVisited - the desired value of the visited flag