Package com.jalios.jstore
Class Stamp
java.lang.Object
com.jalios.jstore.Stamp
- All Implemented Interfaces:
Comparable<Stamp>
This class represents a stamp. A stamp contains two parts:
- a replica identifier (URID)
- a time value
- a replica identifier (URID)
- a time value
- Author:
- Olivier Dedieu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares this stamp with the specified stamp for order.booleanlonggetTime()Get the value of time.getUrid()Get the value of urid.inthashCode()booleanisGreaterThan(Stamp stamp) booleanisLesserThan(Stamp stamp) static StampReturn the greater of two stampsstatic StampReturn the smaller of two stampsvoidsetTime(long time) Set the value of time.voidSet the value of urid.toString()
-
Field Details
-
STAMP_SEPARATOR
- See Also:
-
-
Constructor Details
-
Stamp
Create a new stamp from an URID and a logical time- Parameters:
urid- the urid.time- the logical time.
-
Stamp
Create a new stamp from a string having the following format:urid[STAMP_SEPARATOR]time- Parameters:
str- the string that contains the stamp.
-
-
Method Details
-
getUrid
Get the value of urid.- Returns:
- Value of urid.
-
setUrid
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
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:
compareToin interfaceComparable<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
-
isLesserThan
-
isGreaterThan
-
toString
-
min
Return the smaller of two stamps- Parameters:
s1- a stamps2- a stamp- Returns:
- the smaller of s1 and s2
-
max
Return the greater of two stamps- Parameters:
s1- a stamps2- a stamp- Returns:
- the greater of s1 and s2
-
hashCode
public int hashCode()
-