|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeer2me.group.Group
public class Group
A simple class for storing information
about a group and its nodes.
Can contain several instances of Node
.
Constructor Summary | |
---|---|
Group(java.lang.String name)
Creates a new instance of Group. |
|
Group(java.lang.String name,
Node[] nodes)
Creates a new instance of Group with a name and existing nodes |
Method Summary | |
---|---|
void |
addNode(Node node)
Adds a Node the group |
int |
getIndexOfNode(Node node)
Returns the index of a given Node . |
java.lang.String |
getName()
Gets the name of the group |
Node |
getNode(java.lang.String address)
Gets a Node with the specified address |
Node |
getNodeAt(int index)
Gets a Node at det specified index |
Node[] |
getNodes()
Gets an array of Node in the group |
int |
getNumberOfNodes()
Returns the number of nodes in the group. |
void |
removeAllNodes()
Removes all nodes from the group |
void |
removeNode(Node node)
Removes the specified Node |
void |
removeNode(java.lang.String address)
Removes a Node with the given address |
void |
removeNodeAt(int index)
Removes a Node at the specified index |
void |
setName(java.lang.String name)
Alters the name of the group |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Group(java.lang.String name)
name
- the name of the grouppublic Group(java.lang.String name, Node[] nodes)
name
- the name of the groupnodes
- an array of nodes to put in the groupMethod Detail |
---|
public void addNode(Node node)
Node
the group
node
- The node to addpublic Node[] getNodes()
Node
in the group
public Node getNodeAt(int index) throws NodeNotFoundException
Node
at det specified index
index
- inded of the node
NodeNotFoundException
public Node getNode(java.lang.String address) throws NodeNotFoundException
Node
with the specified address
address
- the address of the node
NodeNotFoundException
public int getIndexOfNode(Node node)
Node
. Useful when finding out if a node exists in this
group
node
- the node to find the index of
public int getNumberOfNodes()
public void removeNodeAt(int index) throws NodeNotFoundException
Node
at the specified index
index
- index of the node
NodeNotFoundException
public void removeNode(java.lang.String address) throws NodeNotFoundException
Node
with the given address
address
- the address of the node
NodeNotFoundException
public void removeNode(Node node)
Node
node
- the node to removepublic void removeAllNodes()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the new name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |