Package VASSAL.chat.node
Class Node
java.lang.Object
VASSAL.chat.node.Node
- All Implemented Interfaces:
MsgSender
- Direct Known Subclasses:
PlayerNode,ServerNode
public class Node extends Object implements MsgSender
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 descendents of the node.-
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidadd(Node child)static Nodebuild(Node base, String path)Constructs from a path name.NodebuildWithInfo(Node base, String pathAndInfo)Builds a Node from a pathAndInfo stringbooleanequals(Object o)NodegetChild(String id)return the child node with the given id, or null if no matchNode[]getChildren()NodegetDescendant(String path)Return the descendant node with the given path relative to this nodeStringgetId()StringgetInfo()StringgetInfoProperty(String propName)Node[]getLeafDescendants()NodegetParent()StringgetPath()StringgetPathAndInfo()Return a string in the format parentId=parentInfo/childId=childInfo/...inthashCode()booleanisLeaf()voidremove(Node child)voidsend(String msg)voidsetInfo(String info)voidsetParent(Node parent)StringtoString()
-
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-- Returns:
-
getDescendant
Return the descendant node with the given path relative to this node- Parameters:
path-- Returns:
-
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-- Returns:
-
buildWithInfo
Builds a Node from a pathAndInfo string- Parameters:
base-pathAndInfo-- Returns:
- See Also:
getPathAndInfo()
-
getPath
-
getPathAndInfo
Return a string in the format parentId=parentInfo/childId=childInfo/...- Returns:
-