|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.xtext.xbase.lib.IntegerRange
public class IntegerRange
A sequence of integers starting from start up to end with an increment of step.
The value of start is always included.
The value of end is included only if the difference between end-start is a multiple of step.
The step can be positive or negative, but never 0. It must have the same signum as of end-start.
| Constructor Summary | |
|---|---|
IntegerRange(int start,
int end)
Constructs a new IntegerRange object. |
|
IntegerRange(int start,
int end,
int step)
Constructs a new IntegerRange object. |
|
| Method Summary | |
|---|---|
boolean |
contains(int number)
Checks whether this contains the given number, i.e. |
int |
getEnd()
|
int |
getSize()
Returns the number of elements in this IntegerRange. |
int |
getStart()
|
int |
getStep()
|
ListIterator<Integer> |
iterator()
|
IntegerRange |
withStep(int step)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IntegerRange(int start,
int end)
start - the start value (inclusive)end - the end value (inclusive)
public IntegerRange(int start,
int end,
int step)
start - the start value (inclusive)end - the end value (inclusive if end-start%step == 0)step - the increment| Method Detail |
|---|
public ListIterator<Integer> iterator()
iterator in interface Iterable<Integer>ListIterator for this.public int getStart()
public int getStep()
public int getEnd()
public int getSize()
(end-start)/step + 1.
public IntegerRange withStep(int step)
step - the step of the new range.
public boolean contains(int number)
0..2.by(2) will not contain 1.
number - the number to be checked for containment.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||