public Object next() { if (hasNext) { long ret = next; try { next = Numbers.add(next, step); hasNext = ! boundsCheck.exceededBounds(next); } catch(ArithmeticException e) { hasNext = false; } return ret; } else { throw new NoSuchElementException(); } }
public Object next() { if (hasNext) { long ret = next; try { next = Numbers.add(next, step); hasNext = ! boundsCheck.exceededBounds(next); } catch(ArithmeticException e) { hasNext = false; } return ret; } else { throw new NoSuchElementException(); } }
long steppingCount(long start, long end, long step) { long count = 1; long s = start; while(count <= CHUNK_SIZE) { try { s = Numbers.add(s, step); if(boundsCheck.exceededBounds(s)) break; else count++; } catch(ArithmeticException e) { break; } } return count; }
public Object reduce(IFn f) { Object acc = start; long i = start + step; while(! boundsCheck.exceededBounds(i)) { acc = f.invoke(acc, i); if (acc instanceof Reduced) return ((Reduced)acc).deref(); i += step; } return acc; }
public Object reduce(IFn f, Object val) { Object acc = val; long i = start; do { acc = f.invoke(acc, i); if (RT.isReduced(acc)) return ((Reduced)acc).deref(); i += step; } while(! boundsCheck.exceededBounds(i)); return acc; }
long steppingCount(long start, long end, long step) { long count = 1; long s = start; while(count <= CHUNK_SIZE) { try { s = Numbers.add(s, step); if(boundsCheck.exceededBounds(s)) break; else count++; } catch(ArithmeticException e) { break; } } return count; }
public Object reduce(IFn f) { Object acc = start; long i = start + step; while(! boundsCheck.exceededBounds(i)) { acc = f.invoke(acc, i); if (acc instanceof Reduced) return ((Reduced)acc).deref(); i += step; } return acc; }
public Object reduce(IFn f, Object val) { Object acc = val; long i = start; do { acc = f.invoke(acc, i); if (RT.isReduced(acc)) return ((Reduced)acc).deref(); i += step; } while(! boundsCheck.exceededBounds(i)); return acc; }