@Override public int getSizeInBytes() { // BitSet.size() returns the size in *bits* return this.bitmap.size() / Byte.SIZE; }
private BitSetMatcher(BitSet table, String description) { super(description); if (table.length() + Long.SIZE < table.size()) { table = (BitSet) table.clone(); // If only we could actually call BitSet.trimToSize() ourselves... } this.table = table; }
public int buckets() { return filter_.size(); }
private BitSetMatcher(BitSet table, String description) { super(description); if (table.length() + Long.SIZE < table.size()) { table = (BitSet) table.clone(); // If only we could actually call BitSet.trimToSize() ourselves... } this.table = table; }
/** * Returns <code>true</code> iff any bit in the given set is * <code>true</code>. */ private boolean anyValueSet(BitSet set) { for (int i = 0; i < set.size(); i++) { if (set.get(i)) { return true; } } return false; }
private BitSetMatcher(BitSet table, String description) { super(description); if (table.length() + Long.SIZE < table.size()) { table = (BitSet) table.clone(); // If only we could actually call BitSet.trimToSize() ourselves... } this.table = table; }
private boolean isGeometryArgument(int idx) { return this.argumentIsGeometryTypeMask.size() > idx && this.argumentIsGeometryTypeMask.get( idx ); }
/** * Returns <code>true</code> iff any bit in the given set is * <code>true</code>. */ private boolean anyValueSet(BitSet set) { for (int i = 0; i < set.size(); i++) { if (set.get(i)) { return true; } } return false; }
static boolean needsEscaping(char c) { return c >= 0 && c < charToEscape.size() && charToEscape.get(c); }
private static boolean needsEscaping(char c) { return c >= 0 && c < charToEscape.size() && charToEscape.get(c); }
/** * Returns <code>true</code> iff any bit in the given set is * <code>true</code>. */ private boolean anyValueSet(final BitSet set) { for (int i = 0; i < set.size(); i++) { if (set.get(i)) { return true; } } return false; }
private BitSetMatcher(BitSet table, String description) { super(description); if (table.length() + Long.SIZE < table.size()) { table = (BitSet) table.clone(); // If only we could actually call BitSet.trimToSize() ourselves... } this.table = table; }
/** {@inheritDoc} */ @Override public boolean connectionAvailable(ClusterNode node1, ClusterNode node2) { BitSet nodeState = nodesState.get(node1.id()); if (nodeState == null) throw new IllegalArgumentException("Invalid node: " + node1); int nodeIdx = Collections.binarySearch(initialNodes, node2, NODE_ORDER_CMP); if (nodeIdx < 0) throw new IllegalArgumentException("Invalid node: " + node2); assert nodeIdx < nodeState.size() : nodeIdx; return nodeState.get(nodeIdx); }
public boolean isPresent(String key) { for (int bucketIndex : getHashBuckets(key.getBytes(), hashCount, bitSet.size())) { if (!bitSet.get(bucketIndex)) { return false; } } return true; }
public void add(String key) { for (int bucketIndex : getHashBuckets(key.getBytes(), hashCount, bitSet.size())) { bitSet.set(bucketIndex); } }
/** * Get the position of the last (infinite) free space. * * @return the position. */ public long getLastFree() { return getPos(set.previousSetBit(set.size()-1) + 1); }
@Override public boolean isPositive(Example example) { CategoricalFeature feature = (CategoricalFeature) example.getFeature(getFeatureNumber()); if (feature == null) { return defaultDecision; } int encoding = feature.getEncoding(); if (encoding >= activeCategoryEncodings.size()) { return defaultDecision; } return activeCategoryEncodings.get(encoding); }
void setDirty(TerminalPosition position) { if(position.getRow() < firstRowIndex || position.getRow() >= firstRowIndex + table.size()) { return; } BitSet tableRow = table.get(position.getRow() - firstRowIndex); if(position.getColumn() < tableRow.size()) { tableRow.set(position.getColumn()); } }
@Test public void basicTest() { BitSet a = BitSets.valueOf(new int[] { 1, 3, 10 }); Assert.assertEquals(3, a.cardinality()); Assert.assertTrue(10 < a.size()); Assert.assertTrue(a.get(3)); }