com.jalios.jstore
Class Stamp

java.lang.Object
  extended by com.jalios.jstore.Stamp
All Implemented Interfaces:
Comparable<Stamp>

public class Stamp
extends Object
implements Comparable<Stamp>

This class represents a stamp. A stamp contains two parts:
- a replica identifier (URID)
- a time value

Version:
$Revision: 30425 $
Author:
Olivier Dedieu

Field Summary
static String REVISION
           
static String STAMP_SEPARATOR
           
 
Constructor Summary
Stamp(String str)
          Create a new stamp from a string having the following format: urid[STAMP_SEPARATOR]time
Stamp(String urid, long time)
          Create a new stamp from an URID and a logical time
 
Method Summary
 int compareTo(Stamp stamp)
          Compares this stamp with the specified stamp for order.
 boolean equals(Object obj)
           
 long getTime()
          Get the value of time.
 String getUrid()
          Get the value of urid.
 int hashCode()
           
static Stamp max(Stamp s1, Stamp s2)
          Return the greater of two stamps
static Stamp min(Stamp s1, Stamp s2)
          Return the smaller of two stamps
 void setTime(long time)
          Set the value of time.
 void setUrid(String urid)
          Set the value of urid.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

STAMP_SEPARATOR

public static final String STAMP_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

Stamp

public Stamp(String urid,
             long time)
Create a new stamp from an URID and a logical time


Stamp

public Stamp(String str)
Create a new stamp from a string having the following format: urid[STAMP_SEPARATOR]time

Method Detail

getUrid

public String getUrid()
Get the value of urid.

Returns:
Value of urid.

setUrid

public void setUrid(String urid)
Set the value of urid.

Parameters:
urid - Value to assign to urid.

getTime

public long getTime()
Get the value of time.

Returns:
Value of time.

setTime

public void setTime(long time)
Set the value of time.

Parameters:
time - Value to assign to time.

compareTo

public int compareTo(Stamp stamp)
Compares this stamp with the specified stamp for order. Returns a negative integer, zero, or a positive integer as this stamp is less than, equal to, or greater than the specified stamp. The time stamps are first compared. If they are equals, the urids are compared.

Specified by:
compareTo in interface Comparable<Stamp>
Parameters:
stamp - the Stamp to be compared.
Returns:
a negative integer, zero, or a positive integer as this stamp is less than, equal to, or greater than the specified stamp.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

min

public static Stamp min(Stamp s1,
                        Stamp s2)
Return the smaller of two stamps

Parameters:
s1 - a stamp
s2 - a stamp
Returns:
the smaller of s1 and s2

max

public static Stamp max(Stamp s1,
                        Stamp s2)
Return the greater of two stamps

Parameters:
s1 - a stamp
s2 - a stamp
Returns:
the greater of s1 and s2

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2001-2010 Jalios SA. All Rights Reserved.