Class HopCount
java.lang.Object
org.drasyl.handler.remote.protocol.HopCount
- All Implemented Interfaces:
Comparable<HopCount>
This is an immutable object.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
byte
getByte()
int
hashCode()
static HopCount
of()
Creates a new minimal hop count value.static HopCount
of
(byte value) Creates a new hop count value with given value.static HopCount
of
(int value) Creates a new hop count value with given value.static HopCount
of
(short value) Creates a new hop count value with given value.toString()
-
Field Details
-
MIN_HOP_COUNT
public static final byte MIN_HOP_COUNT- See Also:
-
MAX_HOP_COUNT
public static final byte MAX_HOP_COUNT- See Also:
-
-
Method Details
-
getByte
public byte getByte() -
increment
- Throws:
IllegalStateException
- if incremented hop count is greater thenMAX_HOP_COUNT
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<HopCount>
-
of
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is smaller thenMIN_HOP_COUNT
-
of
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is not betweenMIN_HOP_COUNT
andMAX_HOP_COUNT
-
of
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is not betweenMIN_HOP_COUNT
andMAX_HOP_COUNT
-
of
Creates a new minimal hop count value.
-