org.objectweb.tribe.common
Class Group

java.lang.Object
  extended byorg.objectweb.tribe.common.Group
All Implemented Interfaces:
java.io.Serializable

public class Group
extends java.lang.Object
implements java.io.Serializable

This class defines a Group.

Note that the member list is always sorted in ascending order of member addresses.

Version:
1.0
Author:
Emmanuel Cecchet , Nicolas Modrzyk
See Also:
Serialized Form

Constructor Summary
Group(GroupIdentifier gid)
          Creates a new Group with the given group identifier and no members.
 
Method Summary
 void addMember(Member m)
          Adds a member to the group.
 GroupIdentifier getGroupIdentifier()
          Get the identifier of this group.
 java.util.ArrayList getMembers()
          The list of members in the group.
 java.lang.String getStringMembers()
          Return the list of members as a String.
 boolean hasMember(Member member)
          Tests if a member belongs to this group.
 boolean merge(Group other)
          Merge a group definition with another one
 boolean removeMember(Member member)
          Remove a member from this group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Group

public Group(GroupIdentifier gid)
Creates a new Group with the given group identifier and no members.

Method Detail

getGroupIdentifier

public GroupIdentifier getGroupIdentifier()
Get the identifier of this group.

Returns:
a GroupIdentifier.

getMembers

public java.util.ArrayList getMembers()
The list of members in the group. This is not a copy of the member list and so any modification to the list will implicitely modify the group composition.

Returns:
an ArrayList of Member.

addMember

public void addMember(Member m)
Adds a member to the group. This function does not look for duplicate group members.

Parameters:
m - the new group member

removeMember

public boolean removeMember(Member member)
Remove a member from this group.

Parameters:
member - Member object.
Returns:
true if the member was is the group, false otherwise.

hasMember

public boolean hasMember(Member member)
Tests if a member belongs to this group.

Parameters:
member - the member to look for
Returns:
true if the member is in the group, false otherwise

merge

public boolean merge(Group other)
Merge a group definition with another one

Parameters:
other - the other group to merge member with.
Returns:
true if the group composition has been modified, false otherwise

getStringMembers

public java.lang.String getStringMembers()
Return the list of members as a String.

Returns:
String containing member list


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.