|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.core.CursorAdapter | +--gishur.graph.core.GraphCursor | +--gishur.graph.core.TraverseAlgorithmCursor | +--gishur.graph.core.DFSCursor
An implementation of the well-known TraverseAlgorithmCursor
.
Field Summary | |
static byte |
BOTH_MODE
Mode-constant: use incoming and outgoing edges. |
static int |
DFS_COLOR_BLACK
|
static int |
DFS_COLOR_GRAY
|
static int |
DFS_COLOR_WHITE
|
static byte |
IN_MODE
Mode-constant: use only incoming edges. |
static byte |
OUT_MODE
Mode-constant: use only outgoing edges. |
Constructor Summary | |
DFSCursor(Graph graph,
Node start)
Constructs a DFSCursor on the given Graph starting at
the given Node . |
|
DFSCursor(Graph graph,
Node start,
byte mode)
Constructs a DFSCursor on the given Graph starting at
the given Node with the specified mode. |
|
DFSCursor(Graph graph,
Node start,
byte mode,
java.lang.String mark_prefix)
Constructs a DFSCursor on the given Graph starting at
the given Node with the specified mode. |
Method Summary | |
void |
addLocalFilter(Filter f)
Adds a Filter to the Filter -pipeline so that the
move of the Cursor will furthermore happen on only these elments
which are not filtered out by f and the other
registered Filters . |
protected void |
initStructures()
Initializes data structures. |
byte |
mode()
Returns the working mode of this BFSCursor (one constant of
{ ). |
void |
removeLocalFilter(Filter f)
Removes f from the Filter pipeline of this
GraphCursor . |
protected GraphElement |
selectFirst()
Selects the first GraphElement of the Graph according to the
traversal strategy. |
protected GraphElement |
selectNext(GraphElement e)
Selects the next GraphElement of the Graph after the given
according to the traversal strategie.
|
void |
set(GraphElement e)
Sets the DFSCursor to a new (start) element.
|
byte |
setMode(byte mode)
Sets the working mode of this BFSCursor . |
java.lang.String |
toString()
Overrides java.lang.Object.toString() . |
Methods inherited from class gishur.graph.core.TraverseAlgorithmCursor |
addFilter, bottom, cursorID, edges, element, execute, getBoolProperty, getDoubleProperty, getEdgeProperty, getFloatProperty, getGraphElementProperty, getIntProperty, getLongProperty, getNodeProperty, getProperty, getShortProperty, graph, graphElement, hasProperty, inEdges, inNodes, invalidate, length, nodes, outEdges, outNodes, relative, removeFilter, removeProperty, rollback, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, valid |
Methods inherited from class gishur.graph.core.GraphCursor |
edge, filter, isEdge, isNode, node, validElement |
Methods inherited from class gishur.core.CursorAdapter |
getBookmark, hasMoreElements, next, next, nextElement, prev, prev, set, set, top |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DFS_COLOR_WHITE
public static final int DFS_COLOR_GRAY
public static final int DFS_COLOR_BLACK
public static final byte OUT_MODE
public static final byte IN_MODE
public static final byte BOTH_MODE
Constructor Detail |
public DFSCursor(Graph graph, Node start, byte mode, java.lang.String mark_prefix)
DFSCursor
on the given Graph
starting at
the given Node
with the specified mode. The cursor position after
creation is invalid. If mark_prefix!=null
, the
cursor writes its results to the properties of the Nodes
and
Edges
it traverses, namely the following:
Properties Summary | |||
Key | Value Type | Values | Meaning |
mark_prefix.color | int | DFS_COLOR_WHITE , DFS_COLOR_GRAY or
DFS_COLOR_BLACK . |
White indicates an undiscovered
Node , gray a Node whose descendants have not
been visited completely, and black identifies a completely
visited Node . Edges can only be colored
black to indicate that they are part of the DFS-tree. |
mark_prefix.dtime | int | 1 - ... | The discovery time of a Node . Each discovery of a
Node and each finishing of a visit takes one time unit. |
mark_prefix.ftime | int | 2 - ... | The finishing time of a Node . A Node is 'discovered' when
all Nodes reachable from him has been visited. Each discovery of a
Node and each finishing of a visit takes one time unit. |
GraphElement
is discoverd again, its properties will be reset.graph
- Graph
to work onstart
- Node
to start frommode
- the mode (see setMode(byte)
)mark_prefix
- the prefix used to make DFS-markingpublic DFSCursor(Graph graph, Node start, byte mode)
DFSCursor
on the given Graph
starting at
the given Node
with the specified mode. The cursor position after
creation is the first element.graph
- Graph
to work onstart
- Node
to start frommode
- the mode (see setMode(byte)
)public DFSCursor(Graph graph, Node start)
DFSCursor
on the given Graph
starting at
the given Node
. The cursor position after creation is the
first element.graph
- Graph
to work onstart
- Node
to start fromMethod Detail |
public java.lang.String toString()
java.lang.Object.toString()
.toString
in class TraverseAlgorithmCursor
Object.toString()
public byte mode()
BFSCursor
(one constant of
{OUT_MODE
,IN_MODE
,BOTH_MODE
}
).BFSCursor
.public byte setMode(byte mode)
BFSCursor
. The given mode
constant defines, which edges the Breath-First-Search-Algorithm
takes. Setting the working mode invalidates the whole cursor
(see TraverseAlgorithmCursor.invalidate()
).mode
- working mode constant (one of {OUT_MODE
,
IN_MODE
,BOTH_MODE
}
)public void addLocalFilter(Filter f)
Filter
to the Filter
-pipeline so that the
move of the Cursor
will furthermore happen on only these elments
which are not filtered out by f
and the other
registered Filters
. If f==null
nothing
happens and the method returns.f
- the new Filter
to add to the pipelinepublic void removeLocalFilter(Filter f)
f
from the Filter
pipeline of this
GraphCursor
. If f==null
or f
is
not part of the Filter
pipe, the method returns
effectiveless.f
- the Filter
to removepublic void set(GraphElement e)
DFSCursor
to a new (start) element.
The method accepts only Nodes
, that must be contained by the
Graph
, where this
GraphCursor
works on.
Otherwise a IllegalArgumentException
will be thrown.set
in class TraverseAlgorithmCursor
e
- the new GraphElement
to set the cursor toprotected void initStructures()
initStructures
in class TraverseAlgorithmCursor
protected GraphElement selectFirst()
GraphElement
of the Graph
according to the
traversal strategy. Filtering will be done after this method.selectFirst
in class TraverseAlgorithmCursor
GraphElement
according to the travesal.protected GraphElement selectNext(GraphElement e)
GraphElement
of the Graph
after the given
according to the traversal strategie.
The given GraphElement
specifies the step/position to step from.
(This has nothing to do with the Cursor
position!)selectNext
in class TraverseAlgorithmCursor
e
- the actual GraphElement
GraphElement
according to the travesal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |