org.jgroups.protocols

Class VectorTime


public class VectorTime
extends java.lang.Object

Vector timestamp used in CAUSAL order protocol stack

Version:
$Revision: 1.2 $

Author:
Vladimir Blagojevic vladimir@cs.yorku.ca

Constructor Summary

VectorTime(Address owner)
Constructs VectorTime given an adress of a owning group member

Method Summary

Collection
getMembers()
Returns Collection containing addresses of other group members from this Vector clock
int
getOwnerIndex()
Returns owner index in this VectorTime clock
org.jgroups.protocols.TransportedVectorTime
getTransportedVectorTime()
Returns minimal lightweigth representation of this Vector Time suitable for network transport
int[]
getValues()
Returns Vector clock values of this Vector clock
java.util.Collection
getVectorValues()
Returns Vector clock values of this Vector clock
void
increment()
Incerements owners current vector value by 1
int
indexOf(Address member)
Returns index of the given member represented by it's Address
boolean
isCausallyNext(org.jgroups.protocols.TransportedVectorTime other)
Determines if the vector clock represented by TransportedVectorTime is causally next to this VectorTime
void
max(org.jgroups.protocols.TransportedVectorTime other)
Updates this VectorTime as follows:

for every k:1...n VT(pj)[k] == max(VT(mi)[k],VT(pj)[k])

void
merge(Vector newMembers)
Merges this VectorTime with new members of the group VectorTime can possibly either grow or shrink
void
reset()
Resets all the values in this vector clock to 0
String
toString()
return String representation of the VectorTime

Constructor Details

VectorTime

public VectorTime(Address owner)
Constructs VectorTime given an adress of a owning group member

Parameters:
owner - Address of the owner group member

Method Details

getMembers

public Collection getMembers()
Returns Collection containing addresses of other group members from this Vector clock

Returns:
Addresses of other group members


getOwnerIndex

public int getOwnerIndex()
Returns owner index in this VectorTime clock

Returns:
index of the owner of this VectorTime or -1 if not found


getTransportedVectorTime

public org.jgroups.protocols.TransportedVectorTime getTransportedVectorTime()
Returns minimal lightweigth representation of this Vector Time suitable for network transport

Returns:
lightweight representation of this VectorTime in the form of TransportedVectorTime object


getValues

public int[] getValues()
Returns Vector clock values of this Vector clock

Returns:
values of the Vector clock as an array


getVectorValues

public java.util.Collection getVectorValues()
Returns Vector clock values of this Vector clock

Returns:
values of the Vector clock


increment

public void increment()
Incerements owners current vector value by 1


indexOf

public int indexOf(Address member)
Returns index of the given member represented by it's Address

Parameters:
member - group member represented by this Address

Returns:
index of the group member or -1 if not found


isCausallyNext

public boolean isCausallyNext(org.jgroups.protocols.TransportedVectorTime other)
Determines if the vector clock represented by TransportedVectorTime is causally next to this VectorTime

Parameters:
other - TransportedVectorTime representation of vector clock

Returns:
true if the given TransportedVectorTime is the next causal to this VectorTime


max

public void max(org.jgroups.protocols.TransportedVectorTime other)
Updates this VectorTime as follows:

for every k:1...n VT(pj)[k] == max(VT(mi)[k],VT(pj)[k])

Parameters:
other - TrasnportedVectorTime that is max-ed with this VectorTime


merge

public void merge(Vector newMembers)
Merges this VectorTime with new members of the group VectorTime can possibly either grow or shrink

Parameters:
newMembers - members of this group


reset

public void reset()
Resets all the values in this vector clock to 0


toString

public String toString()
return String representation of the VectorTime


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.