本文整理了Java中java.util.BitSet.size()
方法的一些代码示例,展示了BitSet.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.size()
方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:size
[英]Returns the capacity in bits of the array implementing this BitSet. This is unrelated to the length of the BitSet, and not generally useful. Use #nextSetBit to iterate, or #length to find the highest set bit.
[中]返回实现此位集的数组的容量(以位为单位)。这与位集的长度无关,通常不有用。使用#nextSetBit进行迭代,或使用#length查找最高的集合位。
代码示例来源:origin: apache/incubator-druid
@Override
public int getSizeInBytes()
{
// BitSet.size() returns the size in *bits*
return this.bitmap.size() / Byte.SIZE;
}
代码示例来源:origin: google/guava
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;
}
代码示例来源:origin: addthis/stream-lib
public int buckets() {
return filter_.size();
}
代码示例来源:origin: prestodb/presto
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;
}
代码示例来源:origin: commons-collections/commons-collections
/**
* 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;
}
代码示例来源:origin: google/j2objc
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;
}
代码示例来源:origin: hibernate/hibernate-orm
private boolean isGeometryArgument(int idx) {
return this.argumentIsGeometryTypeMask.size() > idx && this.argumentIsGeometryTypeMask.get( idx );
}
代码示例来源:origin: wildfly/wildfly
/**
* 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;
}
代码示例来源:origin: apache/hive
static boolean needsEscaping(char c) {
return c >= 0 && c < charToEscape.size() && charToEscape.get(c);
}
代码示例来源:origin: apache/hive
private static boolean needsEscaping(char c) {
return c >= 0 && c < charToEscape.size() && charToEscape.get(c);
}
代码示例来源:origin: org.apache.commons/commons-collections4
/**
* 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;
}
代码示例来源:origin: wildfly/wildfly
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;
}
代码示例来源:origin: apache/ignite
/** {@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);
}
代码示例来源:origin: Codecademy/EventHub
public boolean isPresent(String key) {
for (int bucketIndex : getHashBuckets(key.getBytes(), hashCount, bitSet.size())) {
if (!bitSet.get(bucketIndex)) {
return false;
}
}
return true;
}
代码示例来源:origin: Codecademy/EventHub
public void add(String key) {
for (int bucketIndex : getHashBuckets(key.getBytes(), hashCount, bitSet.size())) {
bitSet.set(bucketIndex);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void write(BitSet value) throws IOException {
if (value == null) {
write(NULL_OBJECT);
return;
}
write(value.size());
// TODO: MAKE THIS SMALLER
for (int x = 0, max = value.size(); x < max; x++)
write(value.get(x));
}
代码示例来源:origin: com.h2database/h2
/**
* Get the position of the last (infinite) free space.
*
* @return the position.
*/
public long getLastFree() {
return getPos(set.previousSetBit(set.size()-1) + 1);
}
代码示例来源:origin: OryxProject/oryx
@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);
}
代码示例来源:origin: mabe02/lanterna
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());
}
}
代码示例来源:origin: apache/kylin
@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));
}
内容来源于网络,如有侵权,请联系作者删除!