@Override public DBIDIter advance() { pos = BitsUtil.nextClearBit(bits, pos + 1); return this; }
/** * Constructor. */ protected InvDBIDItr() { this.pos = BitsUtil.nextClearBit(bits, 0); this.iter = data.iter(); }
/** * Find a mapping from package columns to database columns, eventually adding * new database columns when needed. * * @param pack Package to process * @return Column mapping */ protected Relation<?>[] alignColumns(ObjectBundle pack) { // align representations. Relation<?>[] targets = new Relation<?>[pack.metaLength()]; long[] used = BitsUtil.zero(relations.size()); for(int i = 0; i < targets.length; i++) { SimpleTypeInformation<?> meta = pack.meta(i); // TODO: aggressively try to match exact metas first? // Try to match unused representations only for(int j = BitsUtil.nextClearBit(used, 0); j >= 0 && j < relations.size(); j = BitsUtil.nextClearBit(used, j + 1)) { Relation<?> relation = relations.get(j); if(relation.getDataTypeInformation().isAssignableFromType(meta)) { targets[i] = relation; BitsUtil.setI(used, j); break; } } if(targets[i] == null) { targets[i] = addNewRelation(meta); BitsUtil.setI(used, relations.size() - 1); } } return targets; }
public List<Polygon> compute() { // Compute delaunay triangulation: delaunay = (new SweepHullDelaunay2D(points)).getDelaunay(); List<Polygon> polys = new ArrayList<>(); // Working data long[] used = BitsUtil.zero(delaunay.size()); List<Vector> cur = new ArrayList<>(); for(int i = 0 /* = used.nextClearBit(0) */; i < delaunay.size() && i >= 0; i = BitsUtil.nextClearBit(used, i + 1)) { if(!BitsUtil.get(used, i)) { BitsUtil.setI(used, i); SweepHullDelaunay2D.Triangle tri = delaunay.get(i); if(tri.r2 <= alpha2) { // Check neighbors processNeighbor(cur, used, i, tri.ab, tri.b); processNeighbor(cur, used, i, tri.bc, tri.c); processNeighbor(cur, used, i, tri.ca, tri.a); } if(cur.size() > 0) { polys.add(new Polygon(cur)); cur = new ArrayList<>(); } } } return polys; }
int end = BitsUtil.nextClearBit(marked, start + 1); end = (end == -1) ? dim : end; int[] signature = new int[dim << 1];
for(int pos = BitsUtil.nextClearBit(assigned, 0); pos < num; pos = BitsUtil.nextClearBit(assigned, pos + 1)) { BitsUtil.setI(assignment, pos); E best_i = null; boolean preferSecond = false; for(int pos = BitsUtil.nextClearBit(assigned, 0); pos < num; pos = BitsUtil.nextClearBit(assigned, pos + 1)) {
int remaining = num - 2; for(int next = BitsUtil.nextClearBit(assigned, 0); remaining > 0 && next < num; next = BitsUtil.nextClearBit(assigned, next + 1)) { for(; next < num; next = BitsUtil.nextClearBit(assigned, next + 1)) { BitsUtil.setI(assignment, next);