public class Membership
extends java.lang.Object
构造器和说明 |
---|
Membership()
Creates a member ship object with zero members
|
Membership(java.util.Collection<Address> initial_members)
Creates a Membership with a given initial members.
|
限定符和类型 | 方法和说明 |
---|---|
void |
add(Address... mbrs) |
void |
add(Address new_member)
Adds a new member to this membership.
|
void |
add(java.util.Collection<Address> v)
Adds a list of members to this membership
|
void |
clear()
Removes all the members from this membership
|
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
|
java.util.List<Address> |
getMembers()
Returns a copy (clone) of the members in this membership.
|
void |
merge(java.util.Collection<Address> new_mems,
java.util.Collection<Address> suspects)
Merges membership with the new members and removes suspects.
|
void |
remove(Address old_member)
Removes an member from the membership.
|
void |
remove(java.util.Collection<Address> v)
Removes all the members contained in v from this membership
|
void |
retainAll(java.util.Collection<Address> v) |
void |
set(java.util.Collection<Address> v)
Clears 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)
Clears the membership and adds all members of a given membership parameter.
|
int |
size()
Returns the number of addresses in this membership
|
void |
sort() |
java.lang.String |
toString() |
public Membership()
public Membership(java.util.Collection<Address> initial_members)
initial_members
- - a list of members that belong to this membershippublic java.util.List<Address> getMembers()
public void add(Address new_member)
public void add(Address... mbrs)
public final void add(java.util.Collection<Address> v)
v
- - a vector containing Address objectsjava.lang.ClassCastException
- if v contains objects that don't implement the Address interfacepublic void remove(Address old_member)
old_member
- - the member to be removedpublic void remove(java.util.Collection<Address> v)
v
- a list of all the members to be removedpublic void retainAll(java.util.Collection<Address> v)
public void clear()
public void set(java.util.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.m
- - a membership containing all the members this membership will containpublic void merge(java.util.Collection<Address> new_mems, java.util.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 int size()
public Address elementAt(int index)
index
- - 0..size()-1java.lang.ArrayIndexOutOfBoundsException
- - if the index is negative or not less than the current size of this Membership
object.public java.lang.String toString()
toString
在类中 java.lang.Object