Class NumericRange<I>
java.lang.Object
xyz.janboerman.scalaloader.configurationserializable.runtime.types.NumericRange<I>
- Type Parameters:
I
- the type of number. Must be integral! (e.g. Integer, Long, Short, Byte, BigInteger)
- Direct Known Subclasses:
NumericRange.OfBigInteger
,NumericRange.OfByte
,NumericRange.OfInteger
,NumericRange.OfLong
,NumericRange.OfShort
A Java implementation of Scala's NumericRange. Subclasses implement ConfigurationSerializable
.
Because this class' constructor is protected, you can implement your own subclass specialized for a certain number type. Keep in mind that the Number type I *must* be integral!
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NumericRange
(I start, I step, I end, boolean inclusive) Construct the numeric range. -
Method Summary
Modifier and TypeMethodDescriptionboolean
final I
getEnd()
Get the upper bound of this range.final I
getStart()
Get the lower bound of this range.final I
getStep()
Get the step size of this range.int
hashCode()
final boolean
Get whether the upper bound is included in this range.static void
toString()
-
Constructor Details
-
NumericRange
Construct the numeric range.- Parameters:
start
- the lower bound of this rangestep
- the step size of this rangeend
- the upper bound of this rangeinclusive
- whether to include the upper bound in the range
-
-
Method Details
-
registerWithConfigurationSerialization
public static void registerWithConfigurationSerialization() -
getStart
Get the lower bound of this range.- Returns:
- the lower bound
-
getStep
Get the step size of this range.- Returns:
- the step size
-
getEnd
Get the upper bound of this range.- Returns:
- the upper bound
-
isInclusive
public final boolean isInclusive()Get whether the upper bound is included in this range.- Returns:
- true if the upper bound is included, otherwise false
-
hashCode
public int hashCode() -
equals
-
toString
-