public int addWrittenObject (Object object) { int id = writtenObjects.size; writtenObjects.put(object, id); return id; }
private int getAndIncrementStash (K key, int defaultValue, int increment) { K[] keyTable = this.keyTable; for (int i = capacity, n = i + stashSize; i < n; i++) if (key == keyTable[i]) { int value = valueTable[i]; valueTable[i] = value + increment; return value; } put(key, defaultValue + increment); return defaultValue; }
private int getAndIncrementStash (K key, int defaultValue, int increment) { K[] keyTable = this.keyTable; for (int i = capacity, n = i + stashSize; i < n; i++) if (key == keyTable[i]) { int value = valueTable[i]; valueTable[i] = value + increment; return value; } put(key, defaultValue + increment); return defaultValue; }
public int addWrittenObject (Object object) { int id = writtenObjects.size; writtenObjects.put(object, id); return id; }
private int getAndIncrementStash (K key, int defaultValue, int increment) { K[] keyTable = this.keyTable; for (int i = capacity, n = i + stashSize; i < n; i++) if (key == keyTable[i]) { int value = valueTable[i]; valueTable[i] = value + increment; return value; } put(key, defaultValue + increment); return defaultValue; }
public int addWrittenObject (Object object) { int id = writtenObjects.size; writtenObjects.put(object, id); return id; }
private int getAndIncrementStash (K key, int defaultValue, int increment) { K[] keyTable = this.keyTable; for (int i = capacity, n = i + stashSize; i < n; i++) if (key == keyTable[i]) { int value = valueTable[i]; valueTable[i] = value + increment; return value; } put(key, defaultValue + increment); return defaultValue; }
public int addWrittenObject (Object object) { int id = writtenObjects.size; writtenObjects.put(object, id); return id; }
private void putStash (K key, int value) { if (stashSize == stashCapacity) { // Too many pushes occurred and the stash is full, increase the table size. resize(capacity << 1); put(key, value); return; } // Store key in the stash. int index = capacity + stashSize; keyTable[index] = key; valueTable[index] = value; stashSize++; size++; }
private void putStash (K key, int value) { if (stashSize == stashCapacity) { // Too many pushes occurred and the stash is full, increase the table size. resize(capacity << 1); put(key, value); return; } // Store key in the stash. int index = capacity + stashSize; keyTable[index] = key; valueTable[index] = value; stashSize++; size++; }
private void putStash (K key, int value) { if (stashSize == stashCapacity) { // Too many pushes occurred and the stash is full, increase the table size. resize(capacity << 1); put(key, value); return; } // Store key in the stash. int index = capacity + stashSize; keyTable[index] = key; valueTable[index] = value; stashSize++; size++; }
private void putStash (K key, int value) { if (stashSize == stashCapacity) { // Too many pushes occurred and the stash is full, increase the table size. resize(capacity << 1); put(key, value); return; } // Store key in the stash. int index = capacity + stashSize; keyTable[index] = key; valueTable[index] = value; stashSize++; size++; }
protected void writeName(final Output output, final Class type) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { final int nameId = classToNameId.get(type, -1); if (nameId != -1) { output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. final int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap<>(); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }
protected void writeName (Output output, Class type, Registration registration) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { int nameId = classToNameId.get(type, -1); if (nameId != -1) { if (TRACE) trace("kryo", "Write class name reference " + nameId + ": " + className(type)); output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. if (TRACE) trace("kryo", "Write class name: " + className(type)); int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap(); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }
protected void writeName (Output output, Class type, Registration registration) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { int nameId = classToNameId.get(type, -1); if (nameId != -1) { if (TRACE) trace("kryo", "Write class name reference " + nameId + ": " + className(type)); output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. if (TRACE) trace("kryo", "Write class name: " + className(type)); int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap(); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }
public void writeName(Output output, Class type, Registration registration) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { int nameId = classToNameId.get(type, -1); if (nameId != -1) { if (TRACE) trace("kryo", "Write class name reference " + nameId + ": " + className(type)); output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. if (TRACE) trace("kryo", "Write class name: " + className(type)); int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap<>(32, 0.5F); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }
protected void writeName (Output output, Class type, Registration registration) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { int nameId = classToNameId.get(type, -1); if (nameId != -1) { if (TRACE) trace("kryo", "Write class name reference " + nameId + ": " + className(type)); output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. if (TRACE) trace("kryo", "Write class name: " + className(type)); int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap(); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }
protected void writeName (Output output, Class type, Registration registration) { output.writeVarInt(NAME + 2, true); if (classToNameId != null) { int nameId = classToNameId.get(type, -1); if (nameId != -1) { if (TRACE) trace("kryo", "Write class name reference " + nameId + ": " + className(type)); output.writeVarInt(nameId, true); return; } } // Only write the class name the first time encountered in object graph. if (TRACE) trace("kryo", "Write class name: " + className(type)); int nameId = nextNameId++; if (classToNameId == null) classToNameId = new IdentityObjectIntMap(); classToNameId.put(type, nameId); output.writeVarInt(nameId, true); output.writeString(type.getName()); }