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

public abstract class NumericRange<I> extends Object

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:
  • Constructor Details

    • NumericRange

      protected NumericRange(I start, I step, I end, boolean inclusive)
      Construct the numeric range.
      Parameters:
      start - the lower bound of this range
      step - the step size of this range
      end - the upper bound of this range
      inclusive - whether to include the upper bound in the range
  • Method Details

    • registerWithConfigurationSerialization

      public static void registerWithConfigurationSerialization()
    • getStart

      public final I getStart()
      Get the lower bound of this range.
      Returns:
      the lower bound
    • getStep

      public final I getStep()
      Get the step size of this range.
      Returns:
      the step size
    • getEnd

      public final I 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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object