public class Membership
extends java.lang.Object
Constructor and Description |
---|
Membership()
Creates a member ship object with zero members
|
Membership(java.util.Collection<Address> initial_members)
Creates a Membership with a given initial members.
|
Modifier and Type | Method and Description |
---|---|
Membership |
add(Address... mbrs) |
Membership |
add(Address new_member)
Adds a new member to this membership.
|
Membership |
add(java.util.Collection<Address> v)
Adds a list of members to this membership
|
Membership |
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.
|
Membership |
merge(java.util.Collection<Address> new_mems,
java.util.Collection<Address> suspects)
Merges membership with the new members and removes suspects.
|
Membership |
remove(Address old_member)
Removes an member from the membership.
|
Membership |
remove(java.util.Collection<Address> v)
Removes all the members contained in v from this membership
|
Membership |
retainAll(java.util.Collection<Address> v) |
Membership |
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. |
Membership |
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
|
Membership |
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 Membership add(Address new_member)
public Membership add(Address... mbrs)
public Membership 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 Membership remove(Address old_member)
old_member
- - the member to be removedpublic Membership remove(java.util.Collection<Address> v)
v
- a list of all the members to be removedpublic Membership retainAll(java.util.Collection<Address> v)
public Membership clear()
public Membership 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 Membership set(Membership m)
clear
method.m
- - a membership containing all the members this membership will containpublic Membership 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 Membership 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
in class java.lang.Object
Copyright © 1998-2020 Red Hat. All Rights Reserved.