com.yahoo.memory.WritableMemory.getLong()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(122)

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

WritableMemory.getLong介绍

暂无

代码示例

代码示例来源:origin: DataSketches/sketches-core

@Override
public long getThetaLong() {
 return mem_.getLong(THETA_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
protected long getKey(final int index) {
 return mem_.getLong(keysOffset_ + ((long) SIZE_OF_KEY_BYTES * index));
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public long getN() {
 return (mem_.getCapacity() < COMBINED_BUFFER) ? 0 : mem_.getLong(N_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public long getN() {
 return (mem_.getCapacity() < COMBINED_BUFFER) ? 0 : mem_.getLong(N_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public double[][] getValues() {
 final int count = getRetainedEntries();
 final double[][] values = new double[count][];
 if (count > 0) {
  long keyOffset = keysOffset_;
  long valuesOffset = valuesOffset_;
  int i = 0;
  for (int j = 0; j < getCurrentCapacity(); j++) {
   if (mem_.getLong(keyOffset) != 0) {
    final double[] array = new double[numValues_];
    mem_.getDoubleArray(valuesOffset, array, 0, numValues_);
    values[i++] = array;
   }
   keyOffset += SIZE_OF_KEY_BYTES;
   valuesOffset += (long)SIZE_OF_VALUE_BYTES * numValues_;
  }
 }
 return values;
}

代码示例来源:origin: DataSketches/sketches-core

/**
 * Fast-wrap a Union object around a Union Memory object containing data.
 * This does NO validity checking of the given Memory.
 * @param srcMem The source Memory object.
 * <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
 * @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
 * @return this class
 */
static UnionImpl fastWrap(final WritableMemory srcMem, final long seed) {
 Family.UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
 final UpdateSketch gadget = DirectQuickSelectSketch.fastWritableWrap(srcMem, seed);
 final UnionImpl unionImpl = new UnionImpl(gadget, seed);
 unionImpl.unionThetaLong_ = srcMem.getLong(UNION_THETA_LONG);
 return unionImpl;
}

代码示例来源:origin: DataSketches/sketches-core

/**
 * Wrap a Union object around a Union Memory object containing data.
 * Called by SetOperation.
 * @param srcMem The source Memory object.
 * <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
 * @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
 * @return this class
 */
static UnionImpl wrapInstance(final WritableMemory srcMem, final long seed) {
 Family.UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
 final UpdateSketch gadget = DirectQuickSelectSketch.writableWrap(srcMem, seed);
 final UnionImpl unionImpl = new UnionImpl(gadget, seed);
 unionImpl.unionThetaLong_ = srcMem.getLong(UNION_THETA_LONG);
 return unionImpl;
}

代码示例来源:origin: DataSketches/sketches-core

do {
 final int curProbeOffsetBytes = (curProbe << 3) + memOffsetBytes;
 final long curArrayHash = wmem.getLong(curProbeOffsetBytes);
 if (curArrayHash == EMPTY) {
  wmem.putLong(curProbeOffsetBytes, hash);

代码示例来源:origin: DataSketches/sketches-core

do {
 final int curProbeOffsetBytes = (curProbe << 3) + memOffsetBytes;
 final long curArrayHash = wmem.getLong(curProbeOffsetBytes);
 if (curArrayHash == EMPTY) {
  wmem.putLong(curProbeOffsetBytes, hash);

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
protected long getKey(final int index) {
 return mem_.getLong(keysOffset_ + (SIZE_OF_KEY_BYTES * index));
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
long getThetaLong() {
 return mem_.getLong(THETA_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

theta_ = mem_.getLong(THETA_LONG);
isEmpty_ = (mem_.getByte(FLAGS_BYTE) & (1 << Flags.IS_EMPTY.ordinal())) != 0;
setRebuildThreshold();

代码示例来源:origin: DataSketches/sketches-core

@Test
public void checkMemExceptions() {
 ItemsSketch<Long> sk1 = new ItemsSketch<>(1 << LG_MIN_MAP_SIZE);
 sk1.update(Long.valueOf(1), 1);
 ArrayOfLongsSerDe serDe = new ArrayOfLongsSerDe();
 byte[] byteArr = sk1.toByteArray(serDe);
 WritableMemory mem = WritableMemory.wrap(byteArr);
 //FrequentItemsSketch<Long> sk2 = FrequentItemsSketch.getInstance(mem, serDe);
 //println(sk2.toString());
 long pre0 = mem.getLong(0); //The correct first 8 bytes.
 //Now start corrupting
 tryBadMem(mem, PREAMBLE_LONGS_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, SER_VER_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, FAMILY_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, FLAGS_BYTE, 4); //Corrupt to true
 mem.putLong(0, pre0); //restore
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public long getN() {
 return (mem_.getCapacity() < COMBINED_BUFFER) ? 0 : mem_.getLong(N_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

@Test
public void checkFreqLongsMemDeSerExceptions() {
 int minSize = 1 << LG_MIN_MAP_SIZE;
 LongsSketch sk1 = new LongsSketch(minSize);
 sk1.update(1L);
 byte[] bytearray0 = sk1.toByteArray();
 WritableMemory mem = WritableMemory.wrap(bytearray0);
 long pre0 = mem.getLong(0);
 tryBadMem(mem, PREAMBLE_LONGS_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, SER_VER_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, FAMILY_BYTE, 2); //Corrupt
 mem.putLong(0, pre0); //restore
 tryBadMem(mem, FLAGS_BYTE, 4); //Corrupt to true
 mem.putLong(0, pre0); //restore
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public long getN() {
 return (mem_.getCapacity() < COMBINED_BUFFER) ? 0 : mem_.getLong(N_LONG);
}

代码示例来源:origin: DataSketches/sketches-core

long pre0 = mem.getLong(0);
mem.putLong(0, pre0); //restore
final long origThetaLong = mem.getLong(THETA_LONG);
try {
 mem.putLong(THETA_LONG, Long.MAX_VALUE / 2); //Corrupt the theta value

代码示例来源:origin: DataSketches/sketches-core

long pre0 = mem.getLong(0);
mem.putLong(0, pre0); //restore
final long origThetaLong = mem.getLong(THETA_LONG);
try {
 mem.putLong(THETA_LONG, Long.MAX_VALUE / 2); //Corrupt the theta value

代码示例来源:origin: DataSketches/sketches-core

union = new DirectArrayOfDoublesUnionR(sketch, mem);
union.theta_ = mem.getLong(ArrayOfDoublesUnion.THETA_LONG);
return union;

代码示例来源:origin: com.yahoo.datasketches/sketches-core

/**
 * Wrap a Union object around a Union Memory object containing data.
 * Called by SetOperation.
 * @param srcMem The source Memory object.
 * <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a>
 * @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a>
 * @return this class
 */
static UnionImpl wrapInstance(final WritableMemory srcMem, final long seed) {
 Family.UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));
 final UpdateSketch gadget = DirectQuickSelectSketch.writableWrap(srcMem, seed);
 final UnionImpl unionImpl = new UnionImpl(gadget, seed);
 unionImpl.unionThetaLong_ = srcMem.getLong(UNION_THETA_LONG);
 return unionImpl;
}

相关文章