public class Membership extends Object implements Cloneable
Constructor and Description |
---|
Membership()
Public constructor
Creates a member ship object with zero members
|
Membership(Collection<Address> initial_members)
Creates a member ship object with the initial members.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Address... mbrs) |
void |
add(Address new_member)
Adds a new member to this membership.
|
void |
add(Collection<Address> v)
Adds a list of members to this membership
|
void |
clear()
removes all the members from this membership
|
Object |
clone() |
boolean |
contains(Address member)
Returns true if the provided member belongs to this membership
|
Membership |
copy()
returns a copy of this membership
|
Address |
elementAt(int index)
Returns the component at the specified index
|
Vector<Address> |
getMembers()
returns a copy (clone) of the members in this membership.
|
void |
merge(Collection<Address> new_mems,
Collection<Address> suspects)
merges membership with the new members and removes suspects
The Merge method will remove all the suspects and add in the new members.
|
void |
remove(Address old_member)
removes an member from the membership.
|
void |
remove(Collection<Address> v)
removes all the members contained in v from this membership
|
void |
set(Collection<Address> v)
Clear the membership and adds all members of v
This method will clear out all the old members of this membership by
invoking the
Clear method. |
void |
set(Membership m)
Clear the membership and adds all members of v
This method will clear out all the old members of this membership by
invoking the
Clear method. |
int |
size()
Returns the number of addresses in this membership
|
void |
sort() |
String |
toString() |
protected static final Log log
public Membership()
public Membership(Collection<Address> initial_members)
initial_members
- - a list of members that belong to this membershippublic Vector<Address> getMembers()
public void add(Address new_member)
public void add(Address... mbrs)
public final void add(Collection<Address> v)
v
- - a vector containing Address objectsClassCastException
- if v contains objects that don't implement the Address interfaceadd(org.jgroups.Address)
public void remove(Address old_member)
old_member
- - the member to be removedpublic void remove(Collection<Address> v)
v
- - a vector containing all the members to be removedpublic void clear()
public void set(Collection<Address> v)
Clear
method.
Then it will add all the all members provided in the vector vv
- - a vector containing all the members this membership will containpublic void set(Membership m)
Clear
method.
Then it will add all the all members provided in the vector vm
- - a membership containing all the members this membership will containpublic void merge(Collection<Address> new_mems, Collection<Address> suspects)
new_mems
- - a vector containing a list of members (Address) to be added to this membershipsuspects
- - a vector containing a list of members (Address) to be removed from this membershippublic boolean contains(Address member)
member
- public void sort()
public Membership copy()
public Object clone()
public int size()
public Address elementAt(int index)
index
- - 0..size()-1ArrayIndexOutOfBoundsException
- - if the index is negative or not less than the current size of this Membership object.Vector.elementAt(int)
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.