Class SequenceNumber
java.lang.Object
java.lang.Number
org.apache.qpid.protonj2.engine.util.SequenceNumber
- All Implemented Interfaces:
Serializable,Comparable<SequenceNumber>
A mutable sequence that represents an unsigned integer type underneath
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSequenceNumber(int startValue) Create a new sequence starting at the given value. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(int other) Compares the sequence number value to the primitiveIntegergiven.intCompares the sequence number value to theNumbergiven.intcompareTo(SequenceNumber other) Subtract one to the sequence value.doublebooleanequals(int other) Performs an unsigned comparison between the current sequence number and the integer value passed.booleanfloatSubtract one to the sequence value.Add one to the sequence value.inthashCode()Add one to the sequence value.intintValue()longtoString()Methods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
SequenceNumber
public SequenceNumber(int startValue) Create a new sequence starting at the given value.- Parameters:
startValue- The starting value of this unsigned integer sequence
-
-
Method Details
-
increment
Add one to the sequence value.- Returns:
- this sequence.
-
decrement
Subtract one to the sequence value.- Returns:
- this sequence.
-
getAndIncrement
Add one to the sequence value.- Returns:
- this sequence value prior to the increment.
-
getAndDecrement
Subtract one to the sequence value.- Returns:
- this sequence value prior to the decrement.
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
compareTo
- Specified by:
compareToin interfaceComparable<SequenceNumber>
-
compareTo
Compares the sequence number value to theNumbergiven. This method returns 0 if the tracked id is equal to the value provided, value less than 0 if the tracked id is less than the provided value; and a value greater than 0 if the tracked id is larger than the value provided.- Parameters:
other- TheNumberto compare the current sequence number with.- Returns:
- the result of comparing the current sequence number to the provided number.
-
compareTo
public int compareTo(int other) Compares the sequence number value to the primitiveIntegergiven. This method returns 0 if the tracked id is equal to the value provided, value less than 0 if the tracked id is less than the provided value; and a value greater than 0 if the tracked id is larger than the value provided.- Parameters:
other- TheNumberto compare the current sequence number with.- Returns:
- the result of comparing the current sequence number to the provided number.
-
equals
-
equals
public boolean equals(int other) Performs an unsigned comparison between the current sequence number and the integer value passed.- Parameters:
other- The value to compare to the currently sequence number.- Returns:
- true if the currently sequence value matches the integer value provided.
-
hashCode
public int hashCode() -
toString
-