public class LongGenerationed extends java.lang.Object implements Generationed<java.lang.Long>
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicLong |
_generation |
Constructor and Description |
---|
LongGenerationed(long generation) |
Modifier and Type | Method and Description |
---|---|
int |
compareGeneration(Generationed<java.lang.Long> other)
Compare the generation of this object with the other object.
|
int |
compareGeneration(java.lang.Long generation)
Compare the generation of this object with the given generation.
|
java.lang.Long |
generation()
Get the current generation.
|
void |
setGeneration(java.lang.Long generation)
Set the generation.
|
public void setGeneration(java.lang.Long generation)
Generationed
setGeneration
in interface Generationed<java.lang.Long>
generation
- the new generation.public java.lang.Long generation()
Generationed
generation
in interface Generationed<java.lang.Long>
public int compareGeneration(Generationed<java.lang.Long> other)
Comparable
but define our own method to avoid the case that users wants to
have a different comparing method along with the generation comparison.
When other is null, this LongGenerationed will be considered as a later generation.compareGeneration
in interface Generationed<java.lang.Long>
other
- another generationed object to compare the generation with.public int compareGeneration(java.lang.Long generation)
Generationed
compareGeneration
in interface Generationed<java.lang.Long>
generation
- the given generation.