/** * Enable or disable a number of bits. * * @param fromIndex the index of the first bit to enable or disable * @param toIndex one plus the index of the last bit to enable or disable * @param value the new value */ public void set(int fromIndex, int toIndex, boolean value) { // go backwards so that OutOfMemory happens // before some bytes are modified for (int i = toIndex - 1; i >= fromIndex; i--) { set(i, value); } if (value) { if (toIndex > maxLength) { maxLength = toIndex; } } else { if (toIndex >= maxLength) { maxLength = fromIndex; } } }
/** * Allocate a new object id. * * @return the id */ public synchronized int allocateObjectId() { int i = objectIds.nextClearBit(0); objectIds.set(i); return i; }
private void set(int i, boolean value) { if (value) { set(i); } else { clear(i); } }
private boolean shuffleTwo(TableFilter[] f) { int a = 0, b = 0, i = 0; for (; i < 20; i++) { a = random.nextInt(f.length); b = random.nextInt(f.length); if (a == b) { continue; } if (a < b) { int temp = a; a = b; b = temp; } int s = a * f.length + b; if (switched.get(s)) { continue; } switched.set(s); break; } if (i == 20) { return false; } TableFilter temp = f[a]; f[a] = f[b]; f[b] = temp; return true; }
private void registerOutParameter(int parameterIndex) throws SQLException { try { checkClosed(); if (outParameters == null) { maxOutParameters = Math.min( getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount()); outParameters = new BitField(); } checkIndexBounds(parameterIndex); ParameterInterface param = command.getParameters().get(--parameterIndex); if (!param.isValueSet()) { param.setValue(ValueNull.INSTANCE, false); } outParameters.set(parameterIndex); } catch (Exception e) { throw logAndConvert(e); } }