Package VASSAL.chat.node
Class Node
java.lang.Object
VASSAL.chat.node.Node
- All Implemented Interfaces:
MsgSender
- Direct Known Subclasses:
PlayerNode
,ServerNode
Base class for the hierarchical server model.
Each node has a name, a list of children, and arbitrary extra information
encoded in the
getInfo()
string. Each node can be identified
globally by a path name. Messages sent to a node generally broadcast to
all descendants of the node.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
static Node
Constructs from a path name.buildWithInfo(Node base, String pathAndInfo)
Builds a Node from a pathAndInfo stringboolean
return the child node with the given id, or null if no matchNode[]
getDescendant(String path)
Return the descendant node with the given path relative to this nodegetId()
getInfo()
getInfoProperty(String propName)
Node[]
getPath()
Return a string in the format parentId=parentInfo/childId=childInfo/...int
hashCode()
boolean
isLeaf()
void
void
void
void
toString()
-
Constructor Details
-
Node
-
-
Method Details
-
getId
-
getInfo
-
getInfoProperty
-
setInfo
-
setParent
-
getParent
-
remove
-
add
-
equals
-
hashCode
public int hashCode() -
toString
-
getChild
return the child node with the given id, or null if no match- Parameters:
id
- id of node- Returns:
- node with that id
-
getDescendant
Return the descendant node with the given path relative to this node- Parameters:
path
- path- Returns:
- descendant node
-
send
-
getLeafDescendants
-
isLeaf
public boolean isLeaf() -
getChildren
-
build
Constructs from a path name. Instantiates parent nodes with appropriate names as necessary.- Parameters:
base
- the top-level ancestor of the node to be built. Its name is not included in the path namepath
- path- Returns:
- node
-
buildWithInfo
Builds a Node from a pathAndInfo string- Parameters:
base
- basepathAndInfo
- pathAndInfo- Returns:
- node
- See Also:
getPathAndInfo()
-
getPath
-
getPathAndInfo
Return a string in the format parentId=parentInfo/childId=childInfo/...- Returns:
- string
-