public class View extends Object implements Comparable<View>, SizeStreamable, Iterable<Address>, Constructable<View>
Modifier and Type | Field and Description |
---|---|
protected Address[] |
members
An array containing all the members of the view.
|
protected static boolean |
suppress_view_size |
protected ViewId |
view_id
A view is uniquely identified by its ViewID.
|
Constructor and Description |
---|
View()
Creates an empty view, should not be used, only used by (de-)serialization
|
View(Address creator,
long id,
List<Address> members)
Creates a new view
|
View(ViewId view_id,
Address[] members)
Creates a new view.
|
View(ViewId view_id,
List<Address> members)
Creates a new view
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(View o) |
boolean |
containsMember(Address mbr)
Returns true if this view contains a certain member
|
boolean |
containsMembers(Address... mbrs)
Returns true if all mbrs are elements of this view, false otherwise
|
Supplier<? extends View> |
create()
Creates an instance of the class implementing this interface
|
static View |
create(Address coord,
long id,
Address... members) |
boolean |
deepEquals(View other) |
static Address[][] |
diff(View from,
View to)
Returns the difference between 2 views from and to.
|
boolean |
equals(Object obj) |
Address |
getCoord() |
Address |
getCreator()
Returns the creator of this view
if this view was created with the empty constructur, null will be returned
|
List<Address> |
getMembers()
Returns the member list
|
Address[] |
getMembersRaw()
Returns the underlying array.
|
ViewId |
getViewId()
Returns the view ID of this view
if this view was created with the empty constructur, null will be returned
|
int |
hashCode() |
Iterator<Address> |
iterator() |
static List<Address> |
leftMembers(View one,
View two)
Returns a list of members which left from view one to two
|
static List<Address> |
newMembers(View old,
View new_view) |
void |
readFrom(DataInput in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
static boolean |
sameMembers(View v1,
View v2)
Checks if two views have the same members regardless of order.
|
static boolean |
sameMembersOrdered(View v1,
View v2)
Checks if two views have the same members observing order.
|
static boolean |
sameViews(Collection<View> views) |
static boolean |
sameViews(View... views)
Returns true if all views are the same.
|
int |
serializedSize()
Returns the size (in bytes) of the marshalled object
|
int |
size()
Returns the number of members in this view
|
String |
toString() |
void |
writeTo(DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected ViewId view_id
protected Address[] members
protected static final boolean suppress_view_size
public View()
public View(ViewId view_id, List<Address> members)
view_id
- The view id of this view (can not be null)members
- Contains a list of all the members in the view, can be empty but not null.public View(ViewId view_id, Address[] members)
view_id
- The new view-idmembers
- The members. Note that the parameter is not copied.public Supplier<? extends View> create()
Constructable
create
in interface Constructable<View>
public ViewId getViewId()
public Address getCreator()
public Address getCoord()
public List<Address> getMembers()
public Address[] getMembersRaw()
public boolean containsMember(Address mbr)
mbr
- - the address of the member,public boolean containsMembers(Address... mbrs)
public int compareTo(View o)
compareTo
in interface Comparable<View>
public boolean deepEquals(View other)
public int size()
public void writeTo(DataOutput out) throws Exception
Streamable
writeTo
in interface Streamable
Exception
public void readFrom(DataInput in) throws Exception
Streamable
readFrom
in interface Streamable
Exception
public int serializedSize()
SizeStreamable
serializedSize
in interface SizeStreamable
public static List<Address> leftMembers(View one, View two)
one
- two
- public static Address[][] diff(View from, View to)
from
- The first viewto
- The second viewpublic static boolean sameViews(View... views)
public static boolean sameViews(Collection<View> views)
public static boolean sameMembers(View v1, View v2)
public static boolean sameMembersOrdered(View v1, View v2)
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.