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 void
add(Node child)
static Node
build(Node base, String path)
Constructs from a path name.Node
buildWithInfo(Node base, String pathAndInfo)
Builds a Node from a pathAndInfo stringboolean
equals(Object o)
Node
getChild(String id)
return the child node with the given id, or null if no matchNode[]
getChildren()
Node
getDescendant(String path)
Return the descendant node with the given path relative to this nodeString
getId()
String
getInfo()
String
getInfoProperty(String propName)
Node[]
getLeafDescendants()
Node
getParent()
String
getPath()
String
getPathAndInfo()
Return a string in the format parentId=parentInfo/childId=childInfo/...int
hashCode()
boolean
isLeaf()
void
remove(Node child)
void
send(String msg)
void
setInfo(String info)
void
setParent(Node parent)
String
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
-- 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:
-