Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.lang
Interface Range

All Superinterfaces:
  Collection, Iterable, List

All Known Implementing Classes:
  EmptyRange, IntRange, ObjectRange

    public interface Range

extends List

Represents the interface of a Range implementation which includes the from and to values.

Version:
  $Revision: 6817 $
Author:
  James Strachan

Method Summary
`boolean` | `containsWithinBounds(Object o)` Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value
`Comparable` | `getFrom()` Gets the lower value in the range.
`Comparable` | `getTo()` Gets the lower value in the range.
`String` | `inspect()`
`boolean` | `isReverse()` Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value
`List` | `step(int step)` Forms a list by stepping through the range by the indicated interval.
`void` | `step(int step, Closure closure)` Steps through the range, calling a closure for each number.

Methods inherited from interface java.util.List
`add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray`

Method Detail

### getFrom

    Comparable getFrom()

  Gets the lower value in the range.

  Returns:
    the lower value in the range.

### getTo

    Comparable getTo()

  Gets the lower value in the range.

  Returns:
    the upper value in the range

### isReverse

    boolean isReverse()

  Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value

  Returns:
    `true` if this is a reverse range

### containsWithinBounds

    boolean containsWithinBounds(Object o)

  Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value

  Parameters:
    `o` - the object to check against the boundaries of the range
  Returns:
    `true` if the object is between the from and to values

### step

    void step(int step,
              Closure closure)

  Steps through the range, calling a closure for each number.

  Parameters:
    `step` - the amount by which to step. If negative, steps through the range backwards.
    `closure` - the `Closure` to call

### step

    List step(int step)

  Forms a list by stepping through the range by the indicated interval.

  Parameters:
    `step` - the amount by which to step. If negative, steps through the range backwards.
  Returns:
    the list formed by stepping through the range by the indicated interval.

### inspect

    String inspect()

  Returns:
    the verbose `String` representation of this `Range` as would be typed into a console to create the `Range` instance

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2008 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD