Class LongRange

java.lang.Object
org.apache.commons.functor.generator.BaseGenerator<Long>
org.apache.commons.functor.generator.util.LongRange
All Implemented Interfaces:
Generator<Long>

public final class LongRange extends BaseGenerator<Long>
A generator for the range from (inclusive) to to (exclusive).
Since:
1.0
Version:
$Revision$ $Date$
  • Field Details

    • from

      private final long from
      The start index.
    • to

      private final long to
      The end index.
    • step

      private final long step
      The increment counter.
  • Constructor Details

    • LongRange

      public LongRange(Number from, Number to)
      Create a new LongRange.
      Parameters:
      from - start
      to - end
    • LongRange

      public LongRange(Number from, Number to, Number step)
      Create a new LongRange.
      Parameters:
      from - start
      to - end
      step - increment
    • LongRange

      public LongRange(long from, long to)
      Create a new LongRange.
      Parameters:
      from - start
      to - end
    • LongRange

      public LongRange(long from, long to, long step)
      Create a new LongRange.
      Parameters:
      from - start
      to - end
      step - increment
  • Method Details

    • run

      public void run(UnaryProcedure<? super Long> proc)
      Generators must implement this method.
      Parameters:
      proc - UnaryProcedure to run
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • signOf

      private static long signOf(long value)
      Get value/|value| (0L when value == 0L).
      Parameters:
      value - to test
      Returns:
      long
    • defaultStep

      private static long defaultStep(long from, long to)
      Calculate default step to get from from to to.
      Parameters:
      from - start
      to - end
      Returns:
      long