public class LongGenerationed extends Object implements Generationed<Long>
Modifier and Type | Field and Description |
---|---|
protected AtomicLong |
generation |
Constructor and Description |
---|
LongGenerationed(long generation) |
Modifier and Type | Method and Description |
---|---|
int |
compareGeneration(Generationed<Long> other)
Compare the generation of this object with the other object.
|
int |
compareGeneration(Long generation)
Compare the generation of this object with the given generation.
|
Long |
generation()
Get the current generation.
|
void |
setGeneration(Long generation)
Set the generation.
|
protected final AtomicLong generation
public void setGeneration(Long generation)
Generationed
setGeneration
in interface Generationed<Long>
generation
- the new generation.public Long generation()
Generationed
generation
in interface Generationed<Long>
public int compareGeneration(Generationed<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<Long>
other
- another generationed object to compare the generation with.public int compareGeneration(Long generation)
Generationed
compareGeneration
in interface Generationed<Long>
generation
- the given generation.