/** Adds an integer to the filter. * * @param x an integer. */ public void add( final int x ) { int i = d; while( i-- != 0 ) bits.set( hash( x, i ) ); } }
/** Adds a new variable. * * @param variable a variable. * @return this equation. * @throws IllegalStateException if you try to add twice the same variable. */ public Modulo2Equation add(final int variable) { assert ! bitVector.getBoolean(variable); bitVector.set(variable); isEmpty = false; return this; }
/** Adds an integer to the filter. * * @param x an integer. */ public void add( final int x ) { int i = d; while( i-- != 0 ) bits.set( hash( x, i ) ); } }
/** Returns the bit vector indexed; since the bits are not stored in this data structure, * a copy is built on purpose and returned. * * @return a copy of the underlying bit vector. */ @Override public BitVector bitVector() { final LongArrayBitVector result = LongArrayBitVector.ofLength(n); for(long i = length; i-- != 0;) result.set(select(i)); return result; }
/** Returns the bit vector indexed; since the bits are not stored in this data structure, * a copy is built on purpose and returned. * * <p><strong>Warning</strong>: this method is very slow, as the only way to recover the original bit * array is to rank each position in the bit vector. * * @return a copy of the underlying bit vector. */ @Override public BitVector bitVector() { final LongArrayBitVector result = LongArrayBitVector.getInstance().length(n); long prev = 0, rank; for(long i = 1; i <= n; i++) { if ((rank = rank(i)) != prev) result.set(i - 1); prev = rank; } return result; } }
nodeStack.push(startNode); successorsStack.push(graph.successors(startNode)); if (computeBuckets && filteredOutdegree(startNode) == 0) nonBuckets.set(startNode); componentStack.push(s); successorsStack.push(graph.successors(s)); if (computeBuckets && filteredOutdegree(s) == 0) nonBuckets.set(s); continue main; if (successorStatus < status[currentNode]) { status[currentNode] = successorStatus; olderNodeFound.set(currentNode); else if (computeBuckets) nonBuckets.set(currentNode); if (currentNodeStatus < status[parentNode]) { status[parentNode] = currentNodeStatus; olderNodeFound.set(parentNode); if (computeBuckets && nonBuckets.getBoolean(currentNode)) nonBuckets.set(parentNode); if (computeBuckets && ! nodeStack.isEmpty()) nonBuckets.set(nodeStack.topInt()); final boolean notABucket = computeBuckets ? nonBuckets.getBoolean(currentNode) : false; numberOfComponents++; if (notABucket) nonBuckets.set(z); } while(z != currentNode);
@Override public void add(final long index, final boolean value) { if (CHECKS) ensureIndex(index); if (length == (long)bits.length << LOG2_BITS_PER_WORD) bits = LongArrays.grow(bits, numWords(length + 1)); length++; if (index == length - 1) set(index, value); else { final int word = word(index); final int bit = bit(index); boolean carry = (bits[word] & LAST_BIT_MASK) != 0, nextCarry; long t = bits[word]; if (bit == LAST_BIT) t &= ~LAST_BIT_MASK; else t = (t & - (1L << bit)) << 1 | t & (1L << bit) - 1; if (value) t |= 1L << bit; bits[word] = t; final int numWords = numWords(length); for(int i = word + 1; i < numWords; i++) { nextCarry = (bits[i] & LAST_BIT_MASK) != 0; bits[i] <<= 1; if (carry) bits[i] |= 1; carry = nextCarry; } } return; }
public void add( final long index, final boolean value ) { if ( CHECKS ) ensureIndex( index ); if ( length == bits.length << LOG2_BITS_PER_WORD ) bits = LongArrays.grow( bits, numWords( length + 1 ) ); length++; if ( index == length - 1 ) set( index, value ); else { final int word = word( index ); final int bit = bit( index ); boolean carry = ( bits[ word ] & LAST_BIT_MASK ) != 0, nextCarry; long t = bits[ word ]; if ( bit == LAST_BIT ) t &= ~LAST_BIT_MASK; else t = ( t & - ( 1L << bit ) ) << 1 | t & ( 1L << bit ) - 1; if ( value ) t |= 1L << bit; bits[ word ] = t; final int numWords = numWords( length ); for( int i = word + 1; i < numWords; i++ ) { nextCarry = ( bits[ i ] & LAST_BIT_MASK ) != 0; bits[ i ] <<= 1; if ( carry ) bits[ i ] |= 1; carry = nextCarry; } } return; }
public void add( final long index, final boolean value ) { if ( CHECKS ) ensureIndex( index ); if ( length == bits.length << LOG2_BITS_PER_WORD ) bits = LongArrays.grow( bits, numWords( length + 1 ) ); length++; if ( index == length - 1 ) set( index, value ); else { final int word = word( index ); final int bit = bit( index ); boolean carry = ( bits[ word ] & LAST_BIT_MASK ) != 0, nextCarry; long t = bits[ word ]; if ( bit == LAST_BIT ) t &= ~LAST_BIT_MASK; else t = ( t & - ( 1L << bit ) ) << 1 | t & ( 1L << bit ) - 1; if ( value ) t |= 1L << bit; bits[ word ] = t; final int numWords = numWords( length ); for( int i = word + 1; i < numWords; i++ ) { nextCarry = ( bits[ i ] & LAST_BIT_MASK ) != 0; bits[ i ] <<= 1; if ( carry ) bits[ i ] |= 1; carry = nextCarry; } } return; }
final long[] solution = solver.solution; data.length(solution.length); for (int j = 0; j < solution.length; j++) data.set(j, (int)solution[j]);
final long value = data.getLong(i); if (value != 0) { marker.set(j); newData.set(nonZero++, value);
final long[] solution = solver.solution; data.length(solution.length); for (int j = 0; j < solution.length; j++) data.set(j, (int)solution[j]);
successorsStack.push(graph.successors(startNode)); olderNodeFound.push(false); if (computeBuckets && graph.outdegree(startNode) == 0) nonBuckets.set(startNode); successorsStack.push(graph.successors(s)); olderNodeFound.push(false); if (computeBuckets && graph.outdegree(s) == 0) nonBuckets.set(s); continue main; else if (computeBuckets) nonBuckets.set(currentNode); if (computeBuckets && nonBuckets.getBoolean(currentNode)) nonBuckets.set(parentNode); if (computeBuckets && ! nodeStack.isEmpty()) nonBuckets.set(nodeStack.topInt()); final boolean notABucket = computeBuckets ? nonBuckets.getBoolean(currentNode) : false; numberOfComponents++; if (notABucket) nonBuckets.set(z); } while(z != currentNode);
emitted.set(r, true); falseFollowsValues.add(0); falseFollowsKeys.writeLong(p - 1, Long.SIZE);
final long value = data.getLong(i); if (value != 0) { marker.set(j); newData.set(nonZero++, value);
else { large.set(q++, value); marker.set(i);