|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--search.SearchNode
The SearchNode
class contains the label or name and the
state of a node in a SearchGraph
.
Field Summary | |
static int |
BACK
|
protected float |
cost
|
protected int |
depth
|
protected boolean |
expanded
|
static int |
FRONT
|
static int |
INSERT
|
protected java.lang.String |
label
|
protected java.util.Vector |
links
|
protected java.lang.Object |
oper
|
protected java.lang.Object |
state
|
protected boolean |
tested
|
Constructor Summary | |
(package private) |
SearchNode(java.lang.String label,
java.lang.Object state)
Creates a SearchNode with a given name and state. |
Method Summary | |
void |
addLink(SearchNode node)
Adds a link to another SearchNode in the graph. |
void |
addLinks(SearchNode[] nodes)
Adds links to a set of SearchNodes in the graph. |
void |
expand(java.util.Vector queue,
int position)
Expands the node and add to a queue at specified position. |
java.lang.Object |
getState()
Gets the Object that represents the state of the node. |
boolean |
isExpanded()
Indicates whether the node has been expanded or not. |
boolean |
isTested()
Indicates whether the node has been tested or not. |
boolean |
leaf()
Determines if the SearchNode is a leaf node in the graph. |
void |
reset()
Initializes the node for another search. |
void |
setDepth(int depth)
Sets the depth of this SearchNode in the graph. |
static void |
setDisplay(javax.swing.JTextArea textArea)
Sets the trace text area. |
void |
setExpanded()
Sets the SearchNode flag that indicates the node has
been expanded. |
void |
setExpanded(boolean state)
Sets the SearchNode flag that indicates whether the node
has been expanded. |
void |
setOperator(java.lang.Object oper)
Sets the operator of the SearchNode . |
void |
setTested()
Sets the SearchNode flag that indicates that the node
has been tested. |
void |
setTested(boolean state)
Sets the SearchNode flag that indicates whether the node
has been tested. |
void |
trace()
Writes a trace statement, using indentation to indicate depth within the graph. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.lang.String label
protected java.lang.Object state
protected java.lang.Object oper
protected java.util.Vector links
protected int depth
protected boolean expanded
protected boolean tested
protected float cost
public static final int FRONT
public static final int BACK
public static final int INSERT
Constructor Detail |
SearchNode(java.lang.String label, java.lang.Object state)
SearchNode
with a given name and state.label
- the String that represents the node namestate
- the Object the represents the state of the nodeMethod Detail |
public void addLink(SearchNode node)
SearchNode
in the graph.node
- the SearchNode to be linked topublic void addLinks(SearchNode[] nodes)
SearchNodes
in the graph.node
- the SearchNode array that contains the nodes to be linkednodes
- the SearchNode[] object that containspublic boolean leaf()
SearchNode
is a leaf node in the graph.true
if the node is a leaf. Otherwise,
returns false
.public void setDepth(int depth)
SearchNode
in the graph.depth
- the depth of the node in the graphpublic void setOperator(java.lang.Object oper)
SearchNode
.oper
- the Object that contains the definition of the operation
that created the state of the nodepublic void setExpanded()
SearchNode
flag that indicates the node has
been expanded.public void setExpanded(boolean state)
SearchNode
flag that indicates whether the node
has been expanded.state
- the boolean that indicates whether the node has been
expanded or notpublic boolean isExpanded()
true
if the node has been expanded. Otherwise,
returns false.
public void setTested()
SearchNode
flag that indicates that the node
has been tested.public void setTested(boolean state)
SearchNode
flag that indicates whether the node
has been tested.state
- the boolean that indicates whether the node has been
tested or notpublic boolean isTested()
true
if the node has been tested. Otherwise,
returns false.
public static void setDisplay(javax.swing.JTextArea textArea)
the
- JTextArea to be displayed in the trace text areatextArea
- the JTextArea object that containspublic java.lang.Object getState()
Object
that represents the state of the node.Object
the represents state of the nodepublic void reset()
public void trace()
public void expand(java.util.Vector queue, int position)
queue
- the Vector to which the node is addedposition
- where in the queue the node should be added;
0=front, 1=back, 2=base position on node cost
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |