Package com.jalios.jstore
Class StampTable
java.lang.Object
com.jalios.jstore.StampTable
- All Implemented Interfaces:
Cloneable
This class contains a set of stamp (one per urid). It is typically
used to maintain progress tables. A progress table represents the
advancement of a replica according the other replica of the group.
- Author:
- Olivier Dedieu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intcompareLogEntry(LogEntry logEntry) Compares the given stamp of the logEntry with the ones in the table.intcompareStamp(Stamp stamp) Compares the given stamp with the ones in the table.booleanGets the most behind stamp of this StampTable according the given StampTable.getBehindStamp(StampTable st, boolean useRealStamp) Gets the most behind stamp of this StampTable according the given StampTable.getGreatestBehindStamp(Stamp stamp) getMap()Returns the highest stamp contains in this StampTableReturns the smallest stamp contains in this StampTableBuild a new StampTable for this one and the given one.getRealStamp(String urid) Returns the stamp to which this StampTable maps the specified urid.Returns the stamps to which this StampTable maps the specified urid.booleanisGreaterThan(Stamp stamp, boolean isStrict) Check if this StampTable contains at least one stamp greater than the given stamp.booleanisGreaterThan(StampTable other, boolean isStrict) Checks if this StampTable is greater than the given one.booleanisGreaterThan(StampTable other, boolean isStrict, String uridToIgnore) Checks if this StampTable is greater than the given one.booleanisGreaterThanStamp(Stamp other, boolean isStrict) Checks if this StampTable contains a stamp greater than the given one.booleanisLesserThan(Stamp stamp, boolean isStrict) Check if all the stamps of this StampTable are lesser than the given stamp.booleanisLesserThan(StampTable other, boolean isStrict) Checks if this StampTable is lesser than the given one.booleanisLesserThan(StampTable other, boolean isStrict, String uridToIgnore) Checks if this StampTable is lesser than the given one.booleanisLesserThanStamp(Stamp other, boolean isStrict) Checks if this StampTable contains a stamp lesser than the given one.booleanisPartiallyGreaterThan(StampTable other) Checks if this StampTable is partially greater than the given one.voidPuts this stamp in the StampTabletoString()
-
Constructor Details
-
StampTable
public StampTable() -
StampTable
-
StampTable
-
-
Method Details
-
getMap
- Returns:
- the map (urid, stamp)
- Since:
- jcms-4.1
-
clone
-
putStamp
Puts this stamp in the StampTable- Parameters:
stamp- the stamp to be added- Since:
- jcms-4.1
-
getStamp
Returns the stamps to which this StampTable maps the specified urid. Returns null if the StampTable contains no mapping for this urid.- Parameters:
urid- urid whose associated stamp is to be returned.- Returns:
- the stamp associated to the given urid.
- Since:
- jcms-4.1
-
getRealStamp
Returns the stamp to which this StampTable maps the specified urid. Returns the zero-stamp (i.e. Stamp(urid, 0)) if the StampTable contains no mapping for this- Parameters:
urid- urid whose associated stamp is to be returned.- Returns:
- the stamp to which this StampTable maps the specified urid
- Since:
- jcms-4.1
-
compareStamp
Compares the given stamp with the ones in the table.- Parameters:
stamp- the stamp to be compared- Returns:
- a negative integer, zero, or a positive integer as the stamp of the table is less than, equal to, or greater than the specified stamp.
- Since:
- jcms-4.1
-
compareLogEntry
Compares the given stamp of the logEntry with the ones in the table.- Parameters:
logEntry- the logEntry to be compared- Returns:
- a negative integer, zero, or a positive integer as the stamp of the table is less than, equal to, or greater than the specified stamp.
- Since:
- jcms-4.1
- See Also:
-
equals
-
isGreaterThan
Checks if this StampTable is greater than the given one.- Parameters:
other- the other table to be comparedisStrict- true if strict comparison- Returns:
- true if this StampTable is greater than the given one
- Since:
- jcms-4.1
- See Also:
-
isGreaterThan
Checks if this StampTable is greater than the given one.
ST1 is greater than ST2 if ST1 not equals to ST2 and foreach urid in ST2, there exists a stamp in ST1 greater or equals than the one in ST2.
ST1 is stricly greater than ST2 if foreach urid in ST2, there exists a stamp in ST1 strictly greater than the one in ST2.- Parameters:
other- the other table to be comparedisStrict- true if strict comparisonuridToIgnore- this urid will be ignored for the comparison (can be null)- Returns:
- true if this StampTable is greater than the given one
- Since:
- jcms-4.1
-
isLesserThan
Checks if this StampTable is lesser than the given one.- Parameters:
other- the other table to be comparedisStrict- true if strict comparison- Returns:
- true if this StampTable is lesser than the given one
- Since:
- jcms-4.1
- See Also:
-
isLesserThan
Checks if this StampTable is lesser than the given one.- Parameters:
other- the other table to be comparedisStrict- true if strict comparisonuridToIgnore- this urid will be ignored for the comparison (can be null)- Returns:
- true if this StampTable is lesser than the given one
- Since:
- jcms-4.1
- See Also:
-
isGreaterThan
Check if this StampTable contains at least one stamp greater than the given stamp.- Parameters:
stamp- the stamp to be comparedisStrict- true if strict comparison- Returns:
- true if this StampTable contains at least one stamp greater than the given stamp.
- Since:
- jcms-5.0.0
- See Also:
-
isLesserThan
Check if all the stamps of this StampTable are lesser than the given stamp.- Parameters:
stamp- the stamp to be comparedisStrict- true if strict comparison- Returns:
- true if all the stamps of this StampTable are lesser than the given stamp.
- Since:
- jcms-5.0.0
- See Also:
-
isPartiallyGreaterThan
Checks if this StampTable is partially greater than the given one.
ST1 is partially greater than ST2 if at least one stamp of ST1 is greater than the one in ST2.- Parameters:
other- the other table to be compared- Returns:
- true if this StampTable is partially greater than the given one
- Since:
- jcms-5.0.1
-
isGreaterThanStamp
Checks if this StampTable contains a stamp greater than the given one.- Parameters:
other- the stamp to be comparedisStrict- true if strict comparison- Returns:
- true if this StampTable contains a stamp greater than the given one.
- Since:
- jcms-5.0.2
- See Also:
-
isLesserThanStamp
Checks if this StampTable contains a stamp lesser than the given one.- Parameters:
other- the stamp to be comparedisStrict- true if strict comparison- Returns:
- true if this StampTable contains a stamp lesser than the given one.
- Since:
- jcms-5.0.2
- See Also:
-
getMinStamp
Returns the smallest stamp contains in this StampTable- Returns:
- the smallest stamp
- Since:
- jcms-4.1
- See Also:
-
getMaxStamp
Returns the highest stamp contains in this StampTable- Returns:
- the smallest stamp
- Since:
- jcms-5.0.5
- See Also:
-
getBehindStamp
Gets the most behind stamp of this StampTable according the given StampTable. This stamp may be null if all stamps of the given StampTable are lesser or equals to ones of the this StampTable. May return a fake stamp (urid, 0), if the given StampTable has got a stamp.urid unknown for this StampTable.- Parameters:
st- the StampTable to compare with- Returns:
- a most behind stamp.
- Since:
- jcms-4.1
-
getBehindStamp
Gets the most behind stamp of this StampTable according the given StampTable. This stamp may be null if all stamps of the given StampTable are lesser or equals to ones of the this StampTable. If useRealStamp is true, missing stamp are considered as fake stamp (urid, 0). So, it may return a fake stamp (urid, 0), if the given StampTable has got a stamp.urid unknown for this StampTable.- Parameters:
st- the StampTable to compare withuseRealStamp- if true, considere missing stamp as (urid, 0)- Returns:
- a most behind stamp.
- Since:
- jcms-4.1
-
getMinTable
Build a new StampTable for this one and the given one. For each urid contains in these 2 tables, the new StampTable contains the smallest real stamp. If an urid is missing in one the two tables, the zero-stamp is added.- Parameters:
st- the StampTable to used- Returns:
- a StampTable
- Since:
- jcms-4.1
- See Also:
-
toString
-
getGreatestBehindStamp
- Parameters:
stamp- the stamp for which we are looking for the closer stamp below it.- Returns:
- the stamp of this StampTable that is the greatest table stamp lesser than the given stamp.
- Since:
- jcms-10.0.8
-