it.unimi.dsi.fastutil.ints.IntSet类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(136)

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

IntSet介绍

[英]A type-specific Set; provides some additional methods that use polymorphism to avoid (un)boxing.

Additionally, this interface strengthens (again) #iterator().
[中]特定类型的集合;提供一些使用多态性避免(取消)装箱的附加方法。
此外,此接口(再次)增强了#iterator()。

代码示例

代码示例来源:origin: jtablesaw/tablesaw

@Override
public int countUnique() {
  IntSet ints = new IntOpenHashSet(size());
  for (int i = 0; i < size(); i++) {
    ints.add(data.getInt(i));
  }
  return ints.size();
}

代码示例来源:origin: apache/incubator-pinot

@Override
 public boolean applySV(int value) {
  return _matchingValues.contains(value);
 }
}

代码示例来源:origin: jtablesaw/tablesaw

@Override
public DateColumn unique() {
  IntSet ints = new IntOpenHashSet(data.size());
  for (int i = 0; i < size(); i++) {
    ints.add(data.getInt(i));
  }
  DateColumn copy = emptyCopy(ints.size());
  copy.setName(name() + " Unique values");
  copy.data = IntArrayList.wrap(ints.toIntArray());
  return copy;
}

代码示例来源:origin: apache/incubator-pinot

@Override
 public void seal() {
  sealed = true;
  sortedIntList = new int[rawIntSet.size()];
  rawIntSet.toArray(sortedIntList);

  Arrays.sort(sortedIntList);

  if (sortedIntList.length == 0) {
   min = null;
   max = null;
   return;
  }

  // Update min/max based on raw docs.
  min = sortedIntList[0];
  max = sortedIntList[sortedIntList.length - 1];

  // Merge the raw and aggregated docs, so stats for dictionary creation are collected correctly.
  int numAggregated = aggregatedIntSet.size();
  if (numAggregated > 0) {
   rawIntSet.addAll(aggregatedIntSet);
   sortedIntList = new int[rawIntSet.size()];
   rawIntSet.toArray(sortedIntList);
   Arrays.sort(sortedIntList);
  }
 }
}

代码示例来源:origin: apache/incubator-pinot

@Override
public byte[] serialize(IntSet intSet) {
 int size = intSet.size();
 byte[] bytes = new byte[Integer.BYTES + size * Integer.BYTES];
 ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
 byteBuffer.putInt(size);
 IntIterator iterator = intSet.iterator();
 while (iterator.hasNext()) {
  byteBuffer.putInt(iterator.nextInt());
 }
 return bytes;
}

代码示例来源:origin: apache/incubator-pinot

@Override
 public IntSet deserialize(ByteBuffer byteBuffer) {
  int size = byteBuffer.getInt();
  IntSet intSet = new IntOpenHashSet(size);
  for (int i = 0; i < size; i++) {
   intSet.add(byteBuffer.getInt());
  }
  return intSet;
 }
};

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

@Override
 public void readFields(DataInput in) throws IOException {
  long size = in.readLong();
  set.clear();
  trim(size);
  for (long i = 0; i < size; ++i) {
   set.add(in.readInt());
  }
 }
}

代码示例来源:origin: it.unimi.dsi/webgraph

if (currentNode != x) {
  final IntSet succSet = new IntOpenHashSet();
  succSet.clear();
    for(int d = g.outdegree(pseudoInverse[x]); d-- != 0;) succSet.add(map[i.nextInt()]);
      if (map[p = pseudoInverse[mid]] == x) {
        final LazyIntIterator i = g.successors(p);
        for(int d = g.outdegree(p); d-- != 0;) if ((t = map[i.nextInt()]) != -1) succSet.add(t);
      while (mid < remappedNodes && map[p = pseudoInverse[mid]] == x) {
        final LazyIntIterator i = g.successors(p);
        for(int d = g.outdegree(p); d-- != 0;) if ((t = map[i.nextInt()]) != -1) succSet.add(t);
        mid++;
  outdegree = succSet.size();
  currentNode = x;
  succ = succSet.toIntArray();
  if (outdegree > 0) IntArrays.quickSort(succ, 0, outdegree);

代码示例来源:origin: prestodb/presto

pagesToCompact.add(previousRow.getPageId());
  verify(!pagesToCompact.contains(newPageId));
  pagesToCompact.add(newPageId);
IntIterator iterator = pagesToCompact.iterator();
while (iterator.hasNext()) {
  int pageId = iterator.nextInt();

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

private final IntSet downKeys = new IntSet(20);
   downKeys.add(keycode);
   if (downKeys.size >= 2){
     onMultipleKeysDown(keycode);
   downKeys.remove(keycode);
   return true;
 if (downKeys.contains(Input.Keys.ALT_LEFT) || downKeys.contains(Input.Keys.ALT_RIGHT)){
   if (downKeys.size == 2 && mostRecentKeycode == Input.Keys.F4){
     Gdx.app.exit();
 downKeys.clear();
 Gdx.input.setInputProcessor(inputAdapter);

代码示例来源:origin: apache/incubator-pinot

if (matchingDictIds.isEmpty()) {
  return null;
int numMatchingDictIds = matchingDictIds.size();
int numChildren = starTreeNode.getNumChildren();
 while (childrenIterator.hasNext()) {
  StarTreeNode childNode = childrenIterator.next();
  if (matchingDictIds.contains(childNode.getDimensionValue())) {
   queue.add(
     new SearchEntry(childNode, newRemainingPredicateColumns, searchEntry._remainingGroupByColumns));
 IntIterator iterator = matchingDictIds.iterator();
 while (iterator.hasNext()) {
  int matchingDictId = iterator.nextInt();

代码示例来源:origin: apache/incubator-pinot

@Override
 public int[] getMatchingDictIds() {
  if (_matchingDictIds == null) {
   _matchingDictIds = _matchingDictIdSet.toIntArray();
  }
  return _matchingDictIds;
 }
}

代码示例来源:origin: apache/incubator-pinot

PredicateEvaluator firstPredicateEvaluator = predicateEvaluators.get(0);
for (int matchingDictId : firstPredicateEvaluator.getMatchingDictIds()) {
 matchingDictIds.add(matchingDictId);
for (int i = 1; i < numPredicateEvaluators; i++) {
 if (matchingDictIds.isEmpty()) {
  return matchingDictIds;
 IntIterator iterator = matchingDictIds.iterator();
 while (iterator.hasNext()) {
  if (!predicateEvaluator.applySV(iterator.nextInt())) {

代码示例来源:origin: apache/incubator-pinot

int value = _random.nextInt();
stringValues.add(Integer.toString(value));
valueSet.add(value);
Assert.assertEquals(inPredicateEvaluator.applySV(value), valueSet.contains(value));
Assert.assertEquals(notInPredicateEvaluator.applySV(value), !valueSet.contains(value));

代码示例来源:origin: padreati/rapaio

/**
 * Builds a new frame only with rows not specified in mapping.
 */
default Frame removeRows(Mapping mapping) {
  IntSet remove = new IntOpenHashSet(mapping.toList());
  IntList map = new IntArrayList(Math.min(0, rowCount() - remove.size()));
  for (int i = 0; i < rowCount(); i++) {
    if (!remove.contains(i)) {
      map.add(i);
    }
  }
  return mapRows(Mapping.wrap(map));
}

代码示例来源:origin: com.linkedin.zoie/zoie-core

public IntIterator iterator()
{
 return _set.iterator();
}

代码示例来源:origin: com.metsci.glimpse/glimpse-extras-dnc

for ( int i = 0; dBuffer.hasRemaining( ); i++ )
  dBuffer.put( hSet.contains( i ) ? TRUE : FALSE );
for ( IntIterator it = dSet.iterator( ); it.hasNext( ); )
  if ( !hSet.contains( index ) )
for ( IntIterator it = hSet.iterator( ); it.hasNext( ); )
dSet.clear( );
dSet.addAll( hSet );
hSetChanged = false;

代码示例来源:origin: jtablesaw/tablesaw

@Override
public TimeColumn unique() {
  IntSet ints = new IntOpenHashSet(data);
  TimeColumn column = emptyCopy(ints.size());
  column.data = IntArrayList.wrap(ints.toIntArray());
  column.setName(name() + " Unique values");
  return column;
}

代码示例来源:origin: org.datavec/datavec-dataframe

@Override
public DateColumn unique() {
  IntSet ints = new IntOpenHashSet(data.size());
  for (int i = 0; i < size(); i++) {
    ints.add(data.getInt(i));
  }
  return DateColumn.create(name() + " Unique values", IntArrayList.wrap(ints.toIntArray()));
}

代码示例来源:origin: emorynlp/nlp4j

protected void update(boolean sparse)
{
  IntSet s = sparse ? sparse_updated_indices : dense_updated_indices;
  MajorVector w = weight_vector.getMajorVector(sparse);
  MajorVector d = diagonals    .getMajorVector(sparse);
  MajorVector g = gradients    .getMajorVector(sparse);
  
  int[] indices = s.toIntArray();
  Arrays.sort(indices);
  
  updateDiagonals(d, g, indices);
  updateWeights  (w, g, indices, sparse);
  clearGraidents (g, indices);
  s.clear();
}

相关文章