public class VersionVector extends Object
| Modifier and Type | Field and Description |
|---|---|
ConcurrentMap<ReplicaID,Integer> |
entries |
static pt.unl.fct.di.novasys.network.ISerializer<VersionVector> |
serializer
Static method to serialize (and deserialize) a version vector
|
| Constructor and Description |
|---|
VersionVector()
Creates a new, and empty, version vector.
|
VersionVector(ConcurrentMap<ReplicaID,Integer> entries)
Creates a version vector with a given set of entries
|
VersionVector(VersionVector vv)
Creates a version vector based on another passed as argument.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Timestamp ts)
Checks if a timestamp is cointained (i.e., if the counter is more recent) in
the version vector
|
VersionVector |
copy()
Creates a copy of this version vector
|
boolean |
equals(Object o) |
Integer |
getEntry(ReplicaID replicaID)
Gets the entry (the counter) of a specific replica
|
boolean |
isVVConcurrent(VersionVector vv)
Checks a version vector is concurrent (i.e., is not comparable due to
concurrent updates)
|
boolean |
isVVGreater(VersionVector vv)
Checks if a version vector is greater (all entries are bigger)
|
boolean |
isVVGreaterOrEquals(VersionVector vv)
Checks if a version vector is greater (all entries are bigger) or is
equal(all entries are equal) to this version vector
|
boolean |
isVVSmaller(VersionVector vv)
Checks if a version vector is smaller (all entries are smaller) to this
version vector
|
boolean |
isVVSmallerOrEquals(VersionVector vv)
Checks if a version vector is smaller (all entries are smaller) or is
equal(all entries are equal) to this version vector
|
Integer |
max()
Calculates the maximum entry (biggest counter) of the version vector.
|
String |
toString() |
void |
updateTs(Timestamp ts)
Updates the version vector with a given timestamp, if there is a valid entry
for the replica in question.
|
void |
updateVV(VersionVector vv)
Updates the version vector by performing the union if another version vector.
|
public ConcurrentMap<ReplicaID,Integer> entries
public static pt.unl.fct.di.novasys.network.ISerializer<VersionVector> serializer
public VersionVector()
public VersionVector(VersionVector vv)
vv - the version vector to initialize.public VersionVector(ConcurrentMap<ReplicaID,Integer> entries)
entries - entries of another version vectorpublic Integer getEntry(ReplicaID replicaID)
replicaID - replica identiferpublic Integer max()
public boolean contains(Timestamp ts)
ts - the timestamppublic void updateTs(Timestamp ts)
ts - a timestamppublic void updateVV(VersionVector vv)
vv - a version vectorpublic boolean isVVSmallerOrEquals(VersionVector vv)
vv - a version vectorpublic boolean isVVSmaller(VersionVector vv)
vv - a version vectorpublic boolean isVVGreaterOrEquals(VersionVector vv)
vv - a version vectorpublic boolean isVVGreater(VersionVector vv)
vv - a version vectorpublic boolean isVVConcurrent(VersionVector vv)
vv - a version vectorpublic VersionVector copy()
Copyright © 2024. All rights reserved.