spread
Class MembershipInfo

java.lang.Object
  |
  +--spread.MembershipInfo

public class MembershipInfo
extends java.lang.Object

A MembershipInfo object represents information stored in a membership message. To check if a message is a membership message, use SpreadMessage.isMembership():

 if(message.isMembership() == true)
     System.out.println("Membership message.");
 

To get the MembershipInfo object from a membership message, use SpreadMessage.getMembershipInfo():

 MembershipInfo membershipInfo = message.getMembershipInfo();
 

A MembershipInfo object can be used to get information on what caused the membership change (the is*() methods) and extra information about the change (the get*() methods). Which get*() methods are valid for a particular membership message depends on what caused the message.


Method Summary
 SpreadGroup getDisconnected()
          Gets the private group of the member who disconnected.
 SpreadGroup getGroup()
          Gets a SpreadGroup object representing the group that caused this message.
 GroupID getGroupID()
          Gets the GroupID for this group membership at this point in time.
 SpreadGroup getJoined()
          Gets the private group of the member who joined.
 SpreadGroup getLeft()
          Gets the private group of the member who left.
 SpreadGroup[] getMembers()
          Gets the private groups for all the members in the new group membership.
 SpreadGroup[] getStayed()
          Gets the private groups of the members who were not partitioned.
 boolean isCausedByDisconnect()
          Check if this message was caused by a disconnect.
 boolean isCausedByJoin()
          Check if this message was caused by a join.
 boolean isCausedByLeave()
          Check if this message was caused by a leave.
 boolean isCausedByNetwork()
          Check if this message was caused by a network partition.
 boolean isRegularMembership()
          Check if this is a regular membership message.
 boolean isSelfLeave()
          Check if this is a self-leave message.
 boolean isTransition()
          Check if this is a transition message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isRegularMembership

public boolean isRegularMembership()
Check if this is a regular membership message. If true, getGroup(), getGroupID(), and getMembers() are valid. One of getJoined(), getLeft(), getDisconnected(), or getStayed() are valid depending on the type of message.
Returns:
true if this is a regular membership message
See Also:
getGroup(), getGroupID(), getMembers(), getJoined(), getLeft(), getDisconnected(), getStayed()

isTransition

public boolean isTransition()
Check if this is a transition message. If true, getGroup() is the only valid get*() function.
Returns:
true if this is a transition message
See Also:
getGroup()

isCausedByJoin

public boolean isCausedByJoin()
Check if this message was caused by a join. If true, getJoined() can be used to get the group member who joined.
Returns:
true if this message was caused by a join
See Also:
getJoined()

isCausedByLeave

public boolean isCausedByLeave()
Check if this message was caused by a leave. If true, getLeft() can be used to get the group member who left.
Returns:
true if this message was caused by a leave
See Also:
getLeft()

isCausedByDisconnect

public boolean isCausedByDisconnect()
Check if this message was caused by a disconnect. If true, getDisconnected() can be used to get the group member who left.
Returns:
true if this message was caused by a disconnect
See Also:
getDisconnected()

isCausedByNetwork

public boolean isCausedByNetwork()
Check if this message was caused by a network partition. If true, getStayed() can be used to get the members who are still in the group.
Returns:
true if this message was caused by a network partition
See Also:
getStayed()

isSelfLeave

public boolean isSelfLeave()
Check if this is a self-leave message. If true, getGroup() is the only valid get*() function.
Returns:
true if this is a self-leave message
See Also:
getGroup()

getGroup

public SpreadGroup getGroup()
Gets a SpreadGroup object representing the group that caused this message.
Returns:
the group that caused this message

getGroupID

public GroupID getGroupID()
Gets the GroupID for this group membership at this point in time. This is only valid if isRegularMembership() is true. If it is not true, null is returned.
Returns:
the GroupID for this group memebership at this point in time

getMembers

public SpreadGroup[] getMembers()
Gets the private groups for all the members in the new group membership. This list will be in the same order everywhere it is received. This is only valid if isRegularMembership() is true. If it is not true, null is returned.
Returns:
the private groups for everyone in the new group membership

getJoined

public SpreadGroup getJoined()
Gets the private group of the member who joined. This is only valid if both isRegularMembership() and isCausedByJoin() are true. If either or both are false, null is returned.
Returns:
the private group of the member who joined
See Also:
isCausedByJoin()

getLeft

public SpreadGroup getLeft()
Gets the private group of the member who left. This is only valid if both isRegularMembership() and isCausedByLeave() are true. If either or both are false, null is returned.
Returns:
the private group of the member who left
See Also:
isCausedByLeave()

getDisconnected

public SpreadGroup getDisconnected()
Gets the private group of the member who disconnected. This is only valid if both isRegularMembership() and isCausedByDisconnect() are true. If either or both are false, null is returned.
Returns:
the private group of the member who disconnected
See Also:
isCausedByDisconnect()

getStayed

public SpreadGroup[] getStayed()
Gets the private groups of the members who were not partitioned. This is only valid if both isRegularMembership() and isCausedByNetwork() are true. If either or both are false, null is returned.
Returns:
the private groups of the members who were not partitioned
See Also:
isCausedByNetwork()