peer2me.domain
Class Group

java.lang.Object
  extended bypeer2me.domain.Group

public class Group
extends java.lang.Object

This class represents a group of nodes running the same service (MIDlet). All connected nodes in the ad hoc network are participants in the group. Participants can be added and removed, and a list of all the participants can be retreived.

Author:
Torbjørn Vatn & Steinar A. Hestnes

Constructor Summary
Group()
          Constructor.
 
Method Summary
 void addParticipant(Node node)
          This method adds a node to the group as a participant.
 Node getNode(java.lang.String address)
          This method returns a node with the address specified as input
 java.util.Hashtable getParticipatingNodeNames(FrameworkFrontEnd frameworkFrontEnd)
          This method returns a list containg the names (as keys) of the nodes participating in this group.
 java.util.Hashtable getParticipatingNodes()
          This method returns a list containing the nodes participating in this group.
 void removeAllParticipants()
          This method removes all participating nodes.
 void removeParticipant(java.lang.String address)
          This method removes a participating node.
 void shutdownGroup()
          This method closes the NodeConnection of all the participating nodes, and removes all nodes from the group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group()
Constructor. Creates a new Group. A group is created in FrameworkFrontEnd.initFramework().

Method Detail

shutdownGroup

public void shutdownGroup()
This method closes the NodeConnection of all the participating nodes, and removes all nodes from the group. It is called from the MIDlet via FrameworkFrontEnd.shutdownFramework() when all network connections should be closed.


addParticipant

public void addParticipant(Node node)
This method adds a node to the group as a participant.

Parameters:
node - The node to add as a participant.

removeParticipant

public void removeParticipant(java.lang.String address)
This method removes a participating node.

Parameters:
address - The address of the node to remove from this group

removeAllParticipants

public void removeAllParticipants()
This method removes all participating nodes. It is used to clear the group before it is updated by a groupSyncPackage received from a remote node.


getParticipatingNodes

public java.util.Hashtable getParticipatingNodes()
This method returns a list containing the nodes participating in this group. The address is the key to find the Node.

Returns:
A list containing the nodes participating in this group. The address is the key and the node name is the value

getParticipatingNodeNames

public java.util.Hashtable getParticipatingNodeNames(FrameworkFrontEnd frameworkFrontEnd)
This method returns a list containg the names (as keys) of the nodes participating in this group. The addresses are stored as values. It is called from FrameworkFrontEnd.notifyAboutParticipants().

Returns:
A list containing the nodes participating in this group. The node name is the key and the address is the value

getNode

public Node getNode(java.lang.String address)
This method returns a node with the address specified as input

Parameters:
address - The address of the node to get
Returns:
A node with the address specified as input