java.util.BitSet.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中java.util.BitSet.toString()方法的一些代码示例,展示了BitSet.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.toString()方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:toString

BitSet.toString介绍

[英]Returns a string containing a concise, human-readable description of the receiver: a comma-delimited list of the indexes of all set bits. For example: "{0,1,8}"}.
[中]返回一个字符串,该字符串包含接收器的简明易读描述:所有集合位的索引的逗号分隔列表。例如:“{0,1,8}”}。

代码示例

代码示例来源:origin: apache/kylin

@Override
public String toString() {
  return set.toString();
}

代码示例来源:origin: addthis/stream-lib

public String toString() {
  return filter_.toString();
}

代码示例来源:origin: Codecademy/EventHub

@Override
public String toString() {
 return bitSet.toString();
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public String toString() {
 return bits.toString();
}

代码示例来源:origin: stackoverflow.com

public class To100 {
  public static void main(String[] args) {
    String set = new java.util.BitSet() {{ set(1, 100+1); }}.toString();
    System.out.append(set, 1, set.length()-1);
  }
}

代码示例来源:origin: redisson/redisson

@Override
public String toString() {
  return asBitSet().toString();
}

代码示例来源:origin: redisson/redisson

@Override
public String toString() {
  return asBitSet().toString();
}

代码示例来源:origin: apache/hive

private InputSplit[] pruneBuckets(MapWork work, InputSplit[] splits) {
 final BitSet buckets = work.getIncludedBuckets();
 final String bucketIn = buckets.toString();
 List<InputSplit> filteredSplits = new ArrayList<InputSplit>(splits.length / 2);
 for (InputSplit split : splits) {
  final int bucket = Utilities.parseSplitBucket(split);
  if (bucket < 0 || buckets.get(bucket)) {
   // match or UNKNOWN
   filteredSplits.add(split);
  } else {
   LOG.info("Pruning with IN ({}) - removing {}", bucketIn, split);
  }
 }
 if (filteredSplits.size() < splits.length) {
  // reallocate only if any filters pruned
  splits = filteredSplits.toArray(new InputSplit[filteredSplits.size()]);
 }
 return splits;
}

代码示例来源:origin: apache/drill

private InputSplit[] pruneBuckets(MapWork work, InputSplit[] splits) {
 final BitSet buckets = work.getIncludedBuckets();
 final String bucketIn = buckets.toString();
 List<InputSplit> filteredSplits = new ArrayList<InputSplit>(splits.length / 2);
 for (InputSplit split : splits) {
  final int bucket = Utilities.parseSplitBucket(split);
  if (bucket < 0 || buckets.get(bucket)) {
   // match or UNKNOWN
   filteredSplits.add(split);
  } else {
   LOG.info("Pruning with IN ({}) - removing {}", bucketIn, split);
  }
 }
 if (filteredSplits.size() < splits.length) {
  // reallocate only if any filters pruned
  splits = filteredSplits.toArray(new InputSplit[filteredSplits.size()]);
 }
 return splits;
}

代码示例来源:origin: klout/brickhouse

@Override
public String toString() {
  return bits.toString();
}

代码示例来源:origin: apache/accumulo

@Override
public String toString() {
 return bits.toString();
}

代码示例来源:origin: pentaho/pentaho-kettle

void testFindsCorrectly( long lookupValue, int expectedAmount ) {
 assertFalse( context.isEmpty() );
 index.applyRestrictionsTo( context, new ValueMetaInteger(), lookupValue );
 assertFalse( "Expected to find something", context.isEmpty() );
 BitSet actual = context.getCandidates();
 int cnt = expectedAmount;
 int lastSetBit = 0;
 while ( cnt > 0 ) {
  lastSetBit = actual.nextSetBit( lastSetBit );
  if ( lastSetBit < 0 ) {
   fail( "Expected to find " + expectedAmount + " values, but got: " + actual.toString() );
  }
  doAssertMatches( actual, lookupValue, rows[ lastSetBit ][ 0 ] );
  lastSetBit++;
  cnt--;
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

lastSetBit = actual.nextSetBit( lastSetBit );
if ( lastSetBit < 0 ) {
 fail( "Expected to find " + expectedAmount + " values, but got: " + actual.toString() );

代码示例来源:origin: Netflix/hollow

@Override
  public String toString() {
    return toBitSet().toString();
  }
}

代码示例来源:origin: Netflix/hollow

@Test
public void testToBitSet() {
  BitSet bSet = new BitSet();
  ThreadSafeBitSet tsbSet = new ThreadSafeBitSet();
  int[] ordinals = new int[] { 1, 5, 10 };
  // init
  for (int ordinal : ordinals) {
    bSet.set(ordinal);
    tsbSet.set(ordinal);
  }
  // validate content
  for (int ordinal : ordinals) {
    Assert.assertEquals(bSet.get(ordinal), tsbSet.get(ordinal));
  }
  Assert.assertEquals(bSet.cardinality(), tsbSet.cardinality());
  // compare toBitSet
  BitSet bSet2 = tsbSet.toBitSet();
  Assert.assertEquals(bSet, bSet2);
  // compare toString
  Assert.assertEquals(bSet.toString(), bSet.toString());
}

代码示例来源:origin: lucko/helper

/**
 * Returns a readable string representation of the map.
 *
 * <p>Consists of a list of the ordinals of the setting set to a true state.</p>
 *
 * @return a readable string representation of the map
 */
@Override
public String toString() {
  return this.bits.toString();
}

代码示例来源:origin: org.apache.accumulo/accumulo-core

@Override
public String toString() {
 return bits.toString();
}

代码示例来源:origin: org.teiid/teiid-engine

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < segments.length; i++) {
    sb.append(i).append(' ').append(segments[i].bitSet.toString());
    sb.append('\n');
  }
  return sb.toString();
}

代码示例来源:origin: net.sourceforge.owlapi/org.semanticweb.hermit

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append('[');
  String b = bits.toString();
  sb.append(b.substring(1, b.length() - 1));
  sb.append(']');
  return sb.toString();
}

代码示例来源:origin: de.jungblut.math/tjungblut-math

@Override
public String toString() {
 if (getLength() < 50) {
  return vector.toString();
 } else {
  return getDimension() + "x1";
 }
}

相关文章