コード例 #1
0
 @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);
 }