|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jgroup.relacs.types.ViewImpl
public class ViewImpl
This class implements the jgroup.core.View
interface.
Constructor Summary | |
---|---|
ViewImpl()
Default constructor for externalization |
|
ViewImpl(int gid)
Creates a view that contains no members; this kind of view is used only to detect group failures (failure of a single last member). |
|
ViewImpl(int gid,
long vid,
int mergingViews,
MemberId[] members)
Creates a view composed by a set of hosts and members; used to create new view after receiving view messages. |
|
ViewImpl(int gid,
long vid,
MemberId me)
Creates a view composed by a single member and a single host; used to initialize members joining to a group. |
|
ViewImpl(View v)
Clones a view. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
MemberId[] |
commonMembers(MemberId[] otherMembers)
Returns an array of MemberId s that are common to this
view and the provided member array. |
MemberId[] |
commonMembers(View view)
Returns an array of MemberId s that are common to this
view and the provided view. |
boolean |
contains(MemberId memberId)
Returns true if the given member is contained in the current view. |
boolean |
containsAll(View view)
Returns true if this view contains all members of the provided view. |
boolean |
equals(java.lang.Object obj)
Compares two View s for content equality. |
int |
getGid()
Returns the identifier of the group for which this view has been generated. |
MemberId |
getLeader()
Return the MemberId of the group leader (member in
position 0). |
int |
getMemberPosition(MemberId id)
Returns the position of the given member in this view. |
MemberId[] |
getMembers()
Returns an array of MemberId s identifying the members
included in this view. |
long |
getVid()
Returns the identifier of this view |
boolean |
hasSameMembers(View prevView)
Returns true if this view has exactly the same members are the provided view. |
boolean |
isLeader(MemberId member)
Returns true if the given member is the group leader. |
boolean |
memberHasPosition(int pos,
MemberId member)
Returns true if the specified member is the member at the given position; otherwise false is returned. |
int |
mergingViews()
Returns the number of views (or partitions) merging into this view. |
MemberId[] |
newMembers(View previousView)
Returns an array of MemberId s that are new to this
view; that is they were not in the previous view. |
MemberId[] |
oldMembers(View previousView)
Returns an array of MemberId s that are not longer
part of this view; that is they were members of the previous view
but are no longer members of the this view. |
void |
readExternal(java.io.ObjectInput in)
Restores the content of this object from the marshalled data contained in the specified input stream. |
int |
size()
Returns the number of members in this view. |
java.lang.String |
toString()
Prints the content of this view. |
void |
writeExternal(java.io.ObjectOutput out)
Marshals the content of this object to the specified output stream. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ViewImpl()
public ViewImpl(int gid)
public ViewImpl(int gid, long vid, MemberId me)
public ViewImpl(int gid, long vid, int mergingViews, MemberId[] members)
mergingViews
- The number of views merging into this one.public ViewImpl(View v)
Method Detail |
---|
public int getGid()
getGid
in interface View
public long getVid()
getVid
in interface View
public int mergingViews()
mergingViews
in interface View
public MemberId[] getMembers()
MemberId
s identifying the members
included in this view.
getMembers
in interface View
public MemberId getLeader()
View
MemberId
of the group leader (member in
position 0).
getLeader
in interface View
public boolean isLeader(MemberId member)
View
isLeader
in interface View
public MemberId[] commonMembers(MemberId[] otherMembers)
View
MemberId
s that are common to this
view and the provided member array.
commonMembers
in interface View
public MemberId[] commonMembers(View view)
View
MemberId
s that are common to this
view and the provided view.
commonMembers
in interface View
public MemberId[] newMembers(View previousView)
View
MemberId
s that are new to this
view; that is they were not in the previous view.
newMembers
in interface View
public MemberId[] oldMembers(View previousView)
View
MemberId
s that are not longer
part of this view; that is they were members of the previous view
but are no longer members of the this view.
oldMembers
in interface View
public boolean contains(MemberId memberId)
View
contains
in interface View
public boolean containsAll(View view)
View
This is useful for checking if a new view is a contraction of the previous view, or if there are new members.
containsAll
in interface View
public boolean hasSameMembers(View prevView)
View
Note that this is different from using Object.equals()
, since
this method will not check that the view identifiers are the same.
hasSameMembers
in interface View
public int size()
size
in interface View
public int getMemberPosition(MemberId id)
View
getMemberPosition
in interface View
public boolean memberHasPosition(int pos, MemberId member)
memberHasPosition
in interface View
pos
- The position in the view to check for equality with the given
member. A negative position value is considered to indicate
a position from the end of the view array, while a positive
value indicate a position from the beginning of the view
array. A position value outside the range of the view, will
always return false.member
- The member whose position to check.
public boolean equals(java.lang.Object obj)
View
s for content equality.
equals
in class java.lang.Object
obj
- the Object to compare with
public java.lang.String toString()
toString
in class java.lang.Object
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- the stream to be read
java.io.IOException
java.lang.ClassNotFoundException
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the stream to be written
java.io.IOException
public java.lang.Object clone()
clone
in interface View
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |