public class CSN extends Object implements Serializable, Comparable<CSN>
Modifier and Type | Field and Description |
---|---|
static int |
BYTE_ENCODING_LENGTH
The number of bytes used by the byte string representation of a change
number.
|
static CSN |
MAX_CSN_VALUE
The maximum possible value for a CSN.
|
static int |
STRING_ENCODING_LENGTH
The number of characters used by the string representation of a change
number.
|
Constructor and Description |
---|
CSN(long timeStamp,
int seqNum,
int serverId)
Create a new
CSN . |
CSN(String str)
Create a new
CSN from a String. |
Modifier and Type | Method and Description |
---|---|
static int |
compare(CSN csn1,
CSN csn2)
Compares this CSN with the provided CSN for order and returns a negative
number if
csn1 is older than csn2 , zero if they have the
same age, or a positive number if csn1 is newer than csn2 . |
int |
compareTo(CSN csn)
Compares this CSN with the provided CSN for order and returns a negative
number if this CSN is older than
csn , zero if they have the same
age, or a positive number if this CSN is newer than csn . |
static int |
diffSeqNum(CSN csn1,
CSN csn2)
Computes the difference in number of changes between 2 CSNs.
|
boolean |
equals(Object obj) |
int |
getSeqnum()
Getter for the sequence number.
|
int |
getServerId()
Getter for the server ID.
|
long |
getTime()
Getter for the time.
|
long |
getTimeSec()
Get the timestamp associated to this
CSN in seconds. |
int |
hashCode() |
boolean |
isNewerThan(CSN csn)
Returns
true if this CSN is newer than the provided CSN. |
boolean |
isNewerThanOrEqualTo(CSN csn)
Returns
true if this CSN is newer than or equal to the provided
CSN. |
boolean |
isOlderThan(CSN csn)
Returns
true if this CSN is older than the provided CSN. |
boolean |
isOlderThanOrEqualTo(CSN csn)
Returns
true if this CSN is older than or equal to the provided
CSN. |
org.forgerock.opendj.ldap.ByteString |
toByteString()
Encodes this CSN as a byte string.
|
void |
toByteString(org.forgerock.opendj.ldap.ByteStringBuilder builder)
Encodes this CSN into the provided byte string builder.
|
String |
toString()
Convert the
CSN to a printable String. |
String |
toStringUI()
Convert the
CSN to a printable String with a user friendly format. |
static CSN |
valueOf(org.forgerock.opendj.ldap.ByteSequence bs)
Decodes the provided
toByteString() representation of a change
number. |
static CSN |
valueOf(String s)
Parses the provided
toString() representation of a CSN. |
public static final int BYTE_ENCODING_LENGTH
public static final int STRING_ENCODING_LENGTH
valueOf(String)
,
toString()
,
Constant Field Valuespublic static final CSN MAX_CSN_VALUE
public CSN(String str)
CSN
from a String.str
- the string from which to create a CSN
public static CSN valueOf(String s)
toString()
representation of a CSN.s
- The string to be parsed.toString()
public static CSN valueOf(org.forgerock.opendj.ldap.ByteSequence bs)
toByteString()
representation of a change
number.bs
- The byte sequence to be parsed.toByteString()
public long getTime()
public long getTimeSec()
CSN
in seconds.CSN
in secondspublic int getSeqnum()
public int getServerId()
public org.forgerock.opendj.ldap.ByteString toByteString()
NOTE: this representation must not be modified otherwise interop with earlier protocol versions will be broken.
valueOf(ByteSequence)
public void toByteString(org.forgerock.opendj.ldap.ByteStringBuilder builder)
NOTE: this representation must not be modified otherwise interop with earlier protocol versions will be broken.
builder
- The byte string builder.valueOf(ByteSequence)
public String toString()
CSN
to a printable String.
NOTE: this representation must not be modified otherwise interop with earlier protocol versions will be broken.
public String toStringUI()
CSN
to a printable String with a user friendly format.public static int compare(CSN csn1, CSN csn2)
csn1
is older than csn2
, zero if they have the
same age, or a positive number if csn1
is newer than csn2
.csn1
- The first CSN to be compared, which may be null
.csn2
- The second CSN to be compared, which may be null
.csn1
is older than csn2
, zero
if they have the same age, or a positive number if csn1
is
newer than csn2
.public static int diffSeqNum(CSN csn1, CSN csn2)
public boolean isOlderThan(CSN csn)
true
if this CSN is older than the provided CSN.csn
- The CSN to be compared.true
if this CSN is older than the provided CSN.public boolean isOlderThanOrEqualTo(CSN csn)
true
if this CSN is older than or equal to the provided
CSN.csn
- The CSN to be compared.true
if this CSN is older than or equal to the provided
CSN.public boolean isNewerThanOrEqualTo(CSN csn)
true
if this CSN is newer than or equal to the provided
CSN.csn
- The CSN to be compared.true
if this CSN is newer than or equal to the provided
CSN.public boolean isNewerThan(CSN csn)
true
if this CSN is newer than the provided CSN.csn
- The CSN to be compared.true
if this CSN is newer than the provided CSN.public int compareTo(CSN csn)
csn
, zero if they have the same
age, or a positive number if this CSN is newer than csn
.compareTo
in interface Comparable<CSN>
csn
- The CSN to be compared.csn
, zero if
they have the same age, or a positive number if this CSN is newer
than csn
.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.