ubiware.util
Class Range

java.lang.Object
  extended by ubiware.util.Range
All Implemented Interfaces:
java.lang.Iterable<java.lang.Integer>

public class Range
extends java.lang.Object
implements java.lang.Iterable<java.lang.Integer>

Implementation which mimics the Python range class. It offers an iterable object which returns integers Use as follows:

 for (Integer i : new Range(start, end, step){
                //do something  with the integer
 }
 
24.6.2010

Author:
Michael Cochez for UBIWARE project

Constructor Summary
Range(int end)
          Same as Range(int, int, int) with start set to 0 and step set to 1
Range(int start, int end)
          Same as Range(int, int, int) with start set to start and step set to 1
Range(int start, int end, int step)
          Create an Iterable which returns an Iterator which produces a series of integers where the first element = start then n-th element = n-1 th element + step The iteration stops before the integer would become greater as end.
 
Method Summary
 java.util.Iterator<java.lang.Integer> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Range

public Range(int end)
Same as Range(int, int, int) with start set to 0 and step set to 1

Parameters:
end -

Range

public Range(int start,
             int end)
Same as Range(int, int, int) with start set to start and step set to 1

Parameters:
end -

Range

public Range(int start,
             int end,
             int step)
Create an Iterable which returns an Iterator which produces a series of integers where
Method Detail

iterator

public java.util.Iterator<java.lang.Integer> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.lang.Integer>