Class Shell.Range

java.lang.Object
com.csse3200.game.ui.terminal.Shell.Range
All Implemented Interfaces:
Iterator<Long>
Enclosing class:
Shell

public static class Shell.Range extends Object implements Iterator<Long>
Represents a numerical range that can be iterated over. This is intended for shell use only
  • Constructor Details

    • Range

      public Range(long start, long end)
      Creates a range with a step of 1.
      Parameters:
      start - The starting value (inclusive).
      end - The ending value (inclusive).
    • Range

      public Range(long start, long end, long step)
      Creates a range with a specified step.
      Parameters:
      start - The starting value (inclusive).
      end - The ending value (inclusive).
      step - The increment value.
  • Method Details

    • hasNext

      public boolean hasNext()
      Checks if the iteration has more elements.
      Specified by:
      hasNext in interface Iterator<Long>
      Returns:
      true if the current value is less than or equal to the end.
    • next

      public Long next()
      Returns the next element in the iteration.
      Specified by:
      next in interface Iterator<Long>
      Returns:
      The next long value in the range.