|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.lib.conceptmap.model.NodeModel
public class NodeModel
The NodeModel is the model for a node in the tree. Nodes are painted by their NodeView objects (1 per node). Connections between objects are handled through a vector of link models (with each link model having a link view for painting it).
Constructor Summary | |
---|---|
NodeModel(NodeModel inParent,
java.util.Vector contents)
Creates a node model using the parent node and the data for the rest of the tree passed in a vector of strings as arguments. |
Method Summary | |
---|---|
void |
addLink(LinkModel linkModel)
Adds the specified link as a child link. |
void |
addNode(NodeModel nodeModel)
Adds the specified node as a child node. |
void |
connect2StatusProvider(StatusProvider inStatusProvider)
Given a node (NodeModel) in ForestModel and the corresponding node (KnowledgeUnit) in student's KnowledgeModel, makes a StatusProvider reference from the NodeModel to the KnowledgeUnit. |
boolean |
getAreChildrenAnd()
Indicates if this node's children are AND or OR. |
NodeModel |
getChild(int index)
Returns the child at the specified position in this node's vector of children. |
LinkModel |
getChildLink(int index)
Returns the link at the specified position in this node's vector of child links. |
LinkModel |
getChildLinkTo(java.lang.String name)
Returns the link to the node model with the specified name. |
java.lang.String |
getDescription()
Returns this node's text description (to be displayed when the mouse is over it). |
int |
getIndex(java.lang.String childName)
Returns the index of the child node whose name is passed as argument. |
void |
getModelVector(java.util.Vector modelVector,
int depth)
Returns the vector passed as argument plus the name of this node. |
java.lang.String |
getName()
Returns this node's name. |
int |
getNumChildren()
Returns this node's number of children. |
NodeModel |
getParent()
Returns this node's parent. |
double |
getPercentCompletion()
Asks status provider to return the percent completion. |
static void |
main(java.lang.String[] args)
|
void |
print()
Outputs this node's name to the console and recursively outputs the names of all its descendants. |
void |
setAreChildernAndFlag(boolean inAreChildrenAnd)
Sets the status of the areChildrenAnd flag. |
void |
setParent(NodeModel inParent)
Sets the node model passed as argument as this node's parent. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NodeModel(NodeModel inParent, java.util.Vector contents)
inParent
- the parent nodecontents
- the vector holding the data for the rest of the treeMethod Detail |
---|
public double getPercentCompletion()
public NodeModel getChild(int index)
index
- an index into the vector of children
public LinkModel getChildLink(int index)
index
- an index into the vector of child links
public NodeModel getParent()
public java.lang.String getName()
public java.lang.String getDescription()
public boolean getAreChildrenAnd()
public int getNumChildren()
public int getIndex(java.lang.String childName)
the
- name of the child node whose index is returned
public LinkModel getChildLinkTo(java.lang.String name)
the
- name of the node model connected to its parent by the specified link
public void getModelVector(java.util.Vector modelVector, int depth)
modelVector
- the vector with the names of the nodes which
appeared before this node in the tree.this
- node's depth (level of indentation)public void addNode(NodeModel nodeModel)
nodeModel
- the node model to be added to the vector of childrenpublic void addLink(LinkModel linkModel)
linkModel
- the link model to be added to the vector of child linkspublic void setParent(NodeModel inParent)
inParent
- this node's parentpublic void setAreChildernAndFlag(boolean inAreChildrenAnd)
true
- if the children are AND (as opposed to OR), false otherwisepublic void connect2StatusProvider(StatusProvider inStatusProvider)
public void print()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |