- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.yahoo.memory.WritableMemory.putLong()
方法的一些代码示例,展示了WritableMemory.putLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableMemory.putLong()
方法的具体详情如下:
包路径:com.yahoo.memory.WritableMemory
类名称:WritableMemory
方法名:putLong
[英]Puts the long value at the given offset
[中]将long值置于给定偏移量处
代码示例来源:origin: DataSketches/sketches-core
@Override
protected void setThetaLong(final long theta) {
theta_ = theta;
mem_.putLong(THETA_LONG, theta_);
}
代码示例来源:origin: DataSketches/sketches-core
static void insertUnionThetaLong(final WritableMemory wmem, final long unionThetaLong) {
wmem.putLong(UNION_THETA_LONG, unionThetaLong);
}
代码示例来源:origin: DataSketches/sketches-core
static void insertN(final WritableMemory wmem, final long value) {
wmem.putLong(N_LONG, value);
}
代码示例来源:origin: DataSketches/sketches-core
static void insertN(final WritableMemory wmem, final long totalSeen) {
wmem.putLong(ITEMS_SEEN_LONG, totalSeen);
}
代码示例来源:origin: DataSketches/sketches-core
static void insertOuterTauDenominator(final WritableMemory wmem, final long denom) {
wmem.putLong(OUTER_TAU_DENOM_LONG, denom);
}
代码示例来源:origin: DataSketches/sketches-core
static void insertThetaLong(final WritableMemory wmem, final long thetaLong) {
wmem.putLong(THETA_LONG, thetaLong);
}
代码示例来源:origin: DataSketches/sketches-core
@Override
void setThetaLong(final long theta) {
super.setThetaLong(theta);
mem_.putLong(THETA_LONG, theta);
}
代码示例来源:origin: DataSketches/sketches-core
@Override
void putN(final long n) {
assert (mem_.getCapacity() >= COMBINED_BUFFER);
mem_.putLong(N_LONG, n);
}
代码示例来源:origin: DataSketches/sketches-core
@Override
public byte[] serializeToByteArray(final Long[] items) {
final byte[] bytes = new byte[Long.BYTES * items.length];
final WritableMemory mem = WritableMemory.wrap(bytes);
long offsetBytes = 0;
for (int i = 0; i < items.length; i++) {
mem.putLong(offsetBytes, items[i]);
offsetBytes += Long.BYTES;
}
return bytes;
}
代码示例来源:origin: DataSketches/sketches-core
@Override
public byte[] toByteArray() {
final byte[] gadgetByteArr = gadget_.toByteArray();
final WritableMemory mem = WritableMemory.wrap(gadgetByteArr);
mem.putLong(UNION_THETA_LONG, unionThetaLong_); // union theta
return gadgetByteArr;
}
代码示例来源:origin: DataSketches/sketches-core
@Override
public void reset() {
if (mem_.getCapacity() >= COMBINED_BUFFER) {
mem_.putByte(FLAGS_BYTE, (byte) EMPTY_FLAG_MASK); //not compact, not ordered
mem_.putLong(N_LONG, 0L);
mem_.putDouble(MIN_DOUBLE, Double.NaN);
mem_.putDouble(MAX_DOUBLE, Double.NaN);
}
}
代码示例来源:origin: DataSketches/sketches-core
private void processVer1(final Memory skMem) {
final long thetaLongIn = skMem.getLong(THETA_LONG);
unionThetaLong_ = min(unionThetaLong_, thetaLongIn); //Theta rule
final int curCount = skMem.getInt(RETAINED_ENTRIES_INT);
final int preLongs = 3;
for (int i = 0; i < curCount; i++ ) {
final int offsetBytes = (preLongs + i) << 3;
final long hashIn = skMem.getLong(offsetBytes);
if (hashIn >= unionThetaLong_) { break; } // "early stop"
gadget_.hashUpdate(hashIn); //backdoor update, hash function is bypassed
}
unionThetaLong_ = min(unionThetaLong_, gadget_.getThetaLong());
if (gadget_.isDirect()) {
((WritableMemory)gadget_.getMemory()).putLong(UNION_THETA_LONG, unionThetaLong_);
}
}
代码示例来源: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: DataSketches/sketches-core
@Override
public void reset() {
if (!isEmpty_) {
isEmpty_ = true;
mem_.setBits(FLAGS_BYTE, (byte) (1 << Flags.IS_EMPTY.ordinal()));
}
final int lgResizeFactor = mem_.getByte(LG_RESIZE_FACTOR_BYTE);
final float samplingProbability = mem_.getFloat(SAMPLING_P_FLOAT);
final int startingCapacity = Util.getStartingCapacity(getNominalEntries(), lgResizeFactor);
theta_ = (long) (Long.MAX_VALUE * (double) samplingProbability);
mem_.putLong(THETA_LONG, theta_);
mem_.putByte(LG_CUR_CAPACITY_BYTE, (byte) Integer.numberOfTrailingZeros(startingCapacity));
mem_.putInt(RETAINED_ENTRIES_INT, 0);
keysOffset_ = ENTRIES_START;
valuesOffset_ = keysOffset_ + (SIZE_OF_KEY_BYTES * startingCapacity);
mem_.clear(keysOffset_, (long) SIZE_OF_KEY_BYTES * startingCapacity); // clear keys only
lgCurrentCapacity_ = Integer.numberOfTrailingZeros(startingCapacity);
setRebuildThreshold();
}
代码示例来源:origin: DataSketches/sketches-core
@Test
public void longArrChecks() {
long seed = 0;
int offset = 0;
int longs = 16;
int bytes = longs << 3;
long[] hash2 = new long[2];
for (int j = 1; j < longs; j++) {
long[] in = new long[longs];
WritableMemory wmem = WritableMemory.wrap(in);
for (int i = 0; i < j; i++) { wmem.putLong(i, i); }
long[] hash1 = MurmurHash3.hash(in, 0);
hash2 = MurmurHash3v2.hash(wmem, offset, bytes, seed, hash2);
long[] hash3 = MurmurHash3v2.hash(in, seed);
assertEquals(hash1, hash2);
assertEquals(hash1, hash3);
}
}
代码示例来源:origin: DataSketches/sketches-core
@Override
public void reset() {
//clear hash table
//hash table size and hashTableThreshold stays the same
//lgArrLongs stays the same
//thetaLongs resets to p
final int arrLongs = 1 << getLgArrLongs();
final int preambleLongs = mem_.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int preBytes = preambleLongs << 3;
mem_.clear(preBytes, arrLongs * 8L); //clear data array
//flags: bigEndian = readOnly = compact = ordered = false; empty = true.
mem_.putByte(FLAGS_BYTE, (byte) EMPTY_FLAG_MASK);
mem_.putInt(RETAINED_ENTRIES_INT, 0);
final float p = mem_.getFloat(P_FLOAT);
final long thetaLong = (long) (p * MAX_THETA_LONG_AS_DOUBLE);
mem_.putLong(THETA_LONG, thetaLong);
}
代码示例来源: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: DataSketches/sketches-core
@Test
public void checkSerVer2_32Bytes_1Value() {
byte[] byteArray = new byte[32];
WritableMemory mem = WritableMemory.wrap(byteArray);
mem.putByte(0, (byte) 3); //mdLongs, RF (RR) = 0
mem.putByte(1, (byte) 2); //SerVer
mem.putByte(2, (byte) 3); //SketchType = SetSketch
//byte 3 lgNomLongs not used w SetSketch
//byte 4 lgArrLongs not used w SetSketch
//byte 5 Flags: b0: BigEnd, b1: ReadOnly, b2: Empty, b3: NoRebuild, b4, Unordered
mem.putByte(5, (byte) 2); //Flags = ReadOnly
short seedHash = Util.computeSeedHash(Util.DEFAULT_UPDATE_SEED);
mem.putShort(6, seedHash);
mem.putInt(8, 0); //curCount = 0
mem.putLong(16, Long.MAX_VALUE);
Memory srcMem = Memory.wrap(byteArray);
Sketch sketch = Sketch.heapify(srcMem);
assertEquals(sketch.isEmpty(), false);
assertEquals(sketch.isEstimationMode(), false);
assertEquals(sketch.isDirect(), false);
assertEquals(sketch.isCompact(), true);
assertEquals(sketch.isOrdered(), true);
String name = sketch.getClass().getSimpleName();
assertEquals(name, "HeapCompactOrderedSketch");
}
代码示例来源:origin: DataSketches/sketches-core
/**
* @return a byte array representation of this object
*/
public byte[] toByteArray() {
final int sizeBytes = PREAMBLE_SIZE_BYTES + sketch_.getSerializedSizeBytes();
final byte[] byteArray = new byte[sizeBytes];
final WritableMemory mem = WritableMemory.wrap(byteArray);
mem.putByte(PREAMBLE_LONGS_BYTE, (byte) 1); // unused, always 1
mem.putByte(SERIAL_VERSION_BYTE, serialVersionUID);
mem.putByte(FAMILY_ID_BYTE, (byte) Family.TUPLE.getID());
mem.putByte(SKETCH_TYPE_BYTE, (byte) SerializerDeserializer.SketchType.ArrayOfDoublesUnion.ordinal());
mem.putLong(THETA_LONG, theta_);
sketch_.serializeInto(mem.writableRegion(PREAMBLE_SIZE_BYTES, mem.getCapacity() - PREAMBLE_SIZE_BYTES));
return byteArray;
}
代码示例来源:origin: DataSketches/sketches-core
@Test(expectedExceptions = SketchesArgumentException.class)
public void checkSerVer1_32Bytes_tooSmall() {
byte[] byteArray = new byte[32];
WritableMemory mem = WritableMemory.wrap(byteArray);
mem.putByte(0, (byte) 3); //mdLongs
mem.putByte(1, (byte) 1); //SerVer
mem.putByte(2, (byte) 3); //SketchType = SetSketch
//byte 3 lgNomLongs not used with SetSketch
//byte 4 lgArrLongs not used with SetSketch
//byte 5 lgRR not used with SetSketch
//byte 6: Flags: b0: BigEnd, b1: ReadOnly
mem.putByte(6, (byte) 2);
//byte 7 Not used
mem.putInt(8, 2); //curCount = 2
mem.putLong(16, Long.MAX_VALUE);
Memory srcMem = Memory.wrap(byteArray);
Sketch.heapify(srcMem);
}
本文整理了Java中com.yahoo.memory.WritableMemory.putByte()方法的一些代码示例,展示了WritableMemory.putByte()的具体用法。这些代码示例
本文整理了Java中com.yahoo.memory.WritableMemory.getDouble()方法的一些代码示例,展示了WritableMemory.getDouble()的具体用法。这些
本文整理了Java中com.yahoo.memory.WritableMemory.copyTo()方法的一些代码示例,展示了WritableMemory.copyTo()的具体用法。这些代码示例主要
本文整理了Java中com.yahoo.memory.WritableMemory.clear()方法的一些代码示例,展示了WritableMemory.clear()的具体用法。这些代码示例主要来源
本文整理了Java中com.yahoo.memory.WritableMemory.getCapacity()方法的一些代码示例,展示了WritableMemory.getCapacity()的具体用
本文整理了Java中com.yahoo.memory.WritableMemory.getLong()方法的一些代码示例,展示了WritableMemory.getLong()的具体用法。这些代码示例
本文整理了Java中com.yahoo.memory.WritableMemory.putDouble()方法的一些代码示例,展示了WritableMemory.putDouble()的具体用法。这些
本文整理了Java中com.yahoo.memory.WritableMemory.putByteArray()方法的一些代码示例,展示了WritableMemory.putByteArray()的具
本文整理了Java中com.yahoo.memory.WritableMemory.getByteArray()方法的一些代码示例,展示了WritableMemory.getByteArray()的具
本文整理了Java中com.yahoo.memory.WritableMemory.putShort()方法的一些代码示例,展示了WritableMemory.putShort()的具体用法。这些代码
本文整理了Java中com.yahoo.memory.WritableMemory.getArray()方法的一些代码示例,展示了WritableMemory.getArray()的具体用法。这些代码
本文整理了Java中com.yahoo.memory.WritableMemory.getByte()方法的一些代码示例,展示了WritableMemory.getByte()的具体用法。这些代码示例
本文整理了Java中com.yahoo.memory.WritableMemory.allocateDirect()方法的一些代码示例,展示了WritableMemory.allocateDirect
本文整理了Java中com.yahoo.memory.WritableMemory.clearBits()方法的一些代码示例,展示了WritableMemory.clearBits()的具体用法。这些
本文整理了Java中com.yahoo.memory.WritableMemory.getInt()方法的一些代码示例,展示了WritableMemory.getInt()的具体用法。这些代码示例主要
本文整理了Java中com.yahoo.memory.WritableMemory.writableRegion()方法的一些代码示例,展示了WritableMemory.writableRegion
本文整理了Java中com.yahoo.memory.WritableMemory.wrap()方法的一些代码示例,展示了WritableMemory.wrap()的具体用法。这些代码示例主要来源于G
本文整理了Java中com.yahoo.memory.WritableMemory.map()方法的一些代码示例,展示了WritableMemory.map()的具体用法。这些代码示例主要来源于Git
本文整理了Java中com.yahoo.memory.WritableMemory.putLong()方法的一些代码示例,展示了WritableMemory.putLong()的具体用法。这些代码示例
本文整理了Java中com.yahoo.memory.WritableMemory.allocate()方法的一些代码示例,展示了WritableMemory.allocate()的具体用法。这些代码
我是一名优秀的程序员,十分优秀!