コード例 #1
0
 public DrillBuf replace(DrillBuf old, int newSize) {
   if (managedBuffers.remove(old.memoryAddress()) == null) {
     throw new IllegalStateException("Tried to remove unmanaged buffer.");
   }
   old.release(1);
   return getManagedBuffer(newSize);
 }
コード例 #2
0
 @Override
 public void close() {
   final Object[] mbuffers = ((LongObjectOpenHashMap<Object>) (Object) managedBuffers).values;
   for (int i = 0; i < mbuffers.length; i++) {
     if (managedBuffers.allocated[i]) {
       ((DrillBuf) mbuffers[i]).release(1);
     }
   }
   managedBuffers.clear();
 }
コード例 #3
0
ファイル: RelationCache.java プロジェクト: RandyWen/titan
 public RelationCache(
     final Direction direction,
     final long typeId,
     final long relationId,
     final Object other,
     final LongObjectOpenHashMap<Object> properties) {
   this.direction = direction;
   this.typeId = typeId;
   this.relationId = relationId;
   this.other = other;
   this.properties = (properties == null || properties.size() > 0) ? properties : EMPTY;
 }
    @Override
    public void onValue(int docId, long value) {
      valueScript.setNextDocId(docId);
      long time = tzRounding.calc(value);
      double scriptValue = valueScript.runAsDouble();

      InternalFullDateHistogramFacet.FullEntry entry = entries.get(time);
      if (entry == null) {
        entry =
            new InternalFullDateHistogramFacet.FullEntry(
                time, 1, scriptValue, scriptValue, 1, scriptValue);
        entries.put(time, entry);
      } else {
        entry.count++;
        entry.totalCount++;
        entry.total += scriptValue;
        if (scriptValue < entry.min) {
          entry.min = scriptValue;
        }
        if (scriptValue > entry.max) {
          entry.max = scriptValue;
        }
      }
    }
コード例 #5
0
 public DrillBuf getManagedBuffer(int size) {
   DrillBuf newBuf = allocator.buffer(size, this);
   managedBuffers.put(newBuf.memoryAddress(), newBuf);
   return newBuf;
 }
コード例 #6
0
ファイル: RelationCache.java プロジェクト: RandyWen/titan
 public Iterator<LongObjectCursor<Object>> propertyIterator() {
   return properties.iterator();
 }
コード例 #7
0
ファイル: RelationCache.java プロジェクト: RandyWen/titan
 public int numProperties() {
   return properties.size();
 }
コード例 #8
0
ファイル: RelationCache.java プロジェクト: RandyWen/titan
 @SuppressWarnings("unchecked")
 public <O> O get(long key) {
   return (O) properties.get(key);
 }