T
- public class IteratorMask<T> extends java.lang.Object implements IterableIterator<T>
IteratorMask(Object[], long)
.Modifier and Type | Field and Description |
---|---|
private T[] |
array |
(package private) boolean |
bExecHasNext |
private T |
elem |
private java.util.Iterator<T> |
iterSrc |
private int |
ix |
private long |
mask |
Constructor and Description |
---|
IteratorMask(java.lang.Iterable<T> iterSrc,
long mask) |
IteratorMask(java.util.Iterator<T> iteratorSrc,
long mask)
Initializes with given mask.
|
IteratorMask(T[] array,
long mask) |
Modifier and Type | Method and Description |
---|---|
static int |
getNextAssocIx(int ix,
long mask)
Gets the next ix of a set bit in the mask starting from given
For example if the mask is 0x21 then the first call getNextAssocIx(-1) returns 0,
the next call getNextAssocIx(0) returns 5, and the last call getNextAssocIx(5) returns then -1.
|
boolean |
hasNext() |
java.util.Iterator<T> |
iterator() |
T |
next() |
private int ix
private final java.util.Iterator<T> iterSrc
private final T[] array
private T elem
private final long mask
boolean bExecHasNext
public IteratorMask(java.util.Iterator<T> iteratorSrc, long mask)
array
- Any array with proper typemask
- selection which elements should be returned 1-of-64public IteratorMask(java.lang.Iterable<T> iterSrc, long mask)
public IteratorMask(T[] array, long mask)
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public static int getNextAssocIx(int ix, long mask)
ix
- given ix, should start with -1 to detect 0 as first one