|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgroup.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 MemberIds that are common to this
view and the provided member array. |
MemberId[] |
commonMembers(View view)
Returns an array of MemberIds 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 Views 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 MemberIds 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 MemberIds that are new to this
view; that is they were not in the previous view. |
MemberId[] |
oldMembers(View previousView)
Returns an array of MemberIds 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 Viewpublic long getVid()
getVid in interface Viewpublic int mergingViews()
mergingViews in interface Viewpublic MemberId[] getMembers()
MemberIds identifying the members
included in this view.
getMembers in interface Viewpublic MemberId getLeader()
ViewMemberId of the group leader (member in
position 0).
getLeader in interface Viewpublic boolean isLeader(MemberId member)
View
isLeader in interface Viewpublic MemberId[] commonMembers(MemberId[] otherMembers)
ViewMemberIds that are common to this
view and the provided member array.
commonMembers in interface Viewpublic MemberId[] commonMembers(View view)
ViewMemberIds that are common to this
view and the provided view.
commonMembers in interface Viewpublic MemberId[] newMembers(View previousView)
ViewMemberIds that are new to this
view; that is they were not in the previous view.
newMembers in interface Viewpublic MemberId[] oldMembers(View previousView)
ViewMemberIds 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 Viewpublic boolean contains(MemberId memberId)
View
contains in interface Viewpublic boolean containsAll(View view)
ViewThis is useful for checking if a new view is a contraction of the previous view, or if there are new members.
containsAll in interface Viewpublic 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 Viewpublic int size()
size in interface Viewpublic int getMemberPosition(MemberId id)
View
getMemberPosition in interface View
public boolean memberHasPosition(int pos,
MemberId member)
memberHasPosition in interface Viewpos - 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)
Views for content equality.
equals in class java.lang.Objectobj - 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.Externalizablein - 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.Externalizableout - the stream to be written
java.io.IOExceptionpublic java.lang.Object clone()
clone in interface Viewclone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||