@Override
 public void write(DataOutput out) throws IOException {
   out.writeInt(neighbors.size());
   IntIterator neighborsIt = neighbors.iterator();
   while (neighborsIt.hasNext()) {
     out.writeInt(neighborsIt.nextInt());
   }
 }
Пример #2
0
 @Override
 public void hashValues(DimensionSelector dimSelector, HyperLogLogCollector collector) {
   for (IntIterator rowIt = dimSelector.getRow().iterator(); rowIt.hasNext(); ) {
     int index = rowIt.nextInt();
     final String value = dimSelector.lookupName(index);
     collector.add(
         CardinalityAggregator.hashFn.hashUnencodedChars(nullToSpecial(value)).asBytes());
   }
 }
Пример #3
0
 @Override
 @Nonnull
 public VectorEntry next() {
   int pos = iter.nextInt();
   boolean isSet = state == VectorEntry.State.SET || keys.indexIsActive(pos);
   double v = isSet ? values[pos] : Double.NaN;
   entry.set(pos, keys.getKey(pos), v, isSet);
   return entry;
 }
Пример #4
0
 /**
  * Get the collection of values of this vector.
  *
  * @return The collection of all values in this vector.
  */
 public DoubleCollection values() {
   DoubleArrayList lst = new DoubleArrayList(size());
   IntIterator iter = keys.activeIndexIterator(false);
   while (iter.hasNext()) {
     int idx = iter.nextInt();
     lst.add(values[idx]);
   }
   return lst;
 }
Пример #5
0
 @Override
 @Nonnull
 public VectorEntry next() {
   int pos = iter.nextInt();
   return new VectorEntry(SparseVector.this, pos, keys.getKey(pos), values[pos], true);
 }