Class HopCount
- java.lang.Object
-
- org.drasyl.handler.remote.protocol.HopCount
-
- All Implemented Interfaces:
Comparable<HopCount>
public class HopCount extends Object implements Comparable<HopCount>
This is an immutable object.
-
-
Field Summary
Fields Modifier and Type Field Description static byte
MAX_HOP_COUNT
static byte
MIN_HOP_COUNT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(HopCount o)
boolean
equals(Object o)
byte
getByte()
int
hashCode()
HopCount
increment()
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.String
toString()
-
-
-
Field Detail
-
MIN_HOP_COUNT
public static final byte MIN_HOP_COUNT
- See Also:
- Constant Field Values
-
MAX_HOP_COUNT
public static final byte MAX_HOP_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getByte
public byte getByte()
-
increment
public HopCount increment()
- Throws:
IllegalStateException
- if incremented hop count is greater thenMAX_HOP_COUNT
-
compareTo
public int compareTo(HopCount o)
- Specified by:
compareTo
in interfaceComparable<HopCount>
-
of
public static HopCount of(byte value)
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is smaller thenMIN_HOP_COUNT
-
of
public static HopCount of(int value)
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is not betweenMIN_HOP_COUNT
andMAX_HOP_COUNT
-
of
public static HopCount of(short value)
Creates a new hop count value with given value.- Throws:
IllegalArgumentException
- ifvalue
is not betweenMIN_HOP_COUNT
andMAX_HOP_COUNT
-
of
public static HopCount of()
Creates a new minimal hop count value.
-
-