public class CircularInteger
extends java.lang.Object
implements java.lang.Iterable<java.lang.Integer>
Constructor and Description |
---|
CircularInteger(int size)
Initializes a new Circular Integer of the given size
|
Modifier and Type | Method and Description |
---|---|
int |
getSize()
Gets the current size
|
java.util.Iterator<java.lang.Integer> |
iterator()
Gets the Iterator of this Circular Integer
Note that iterating over a Circular Integer never ends |
int |
next()
Gets the next value from this Circular Integer sequence
|
boolean |
nextBool()
Gets the next integer value, and returns true if it is the first value
(0)
|
int |
previous()
Gets the previous value from this Circular Integer sequence
|
void |
setSize(int size)
Sets the new size
|
public CircularInteger(int size)
size
- to loop inpublic int getSize()
public void setSize(int size)
size
- to set topublic int next()
public int previous()
public boolean nextBool()
public java.util.Iterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>