/** * {@inheritDoc} */ @Override public long getSizeOfCustomWeakReference() { long size = this.getSizeOfObjectHeader(); size += this.getPrimitiveTypesSize(4, 0, 0, 0, 1, 0); return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfCharacterObject() { long size = this.getSizeOfObjectHeader() + CHAR_SIZE; return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public boolean isAnalyzed() { return bufferElementState.compareTo(BufferElementState.ANALYZED) >= 0; }
/** * Returns size of the Counter object used in the high scale lib NonBlockingHashMapLong. * * @return Size in bytes. */ private long getSizeOfHighScaleLibCounter() { long size = this.getSizeOfObjectHeader(); size += this.getPrimitiveTypesSize(1, 0, 0, 0, 0, 0); size = alignTo8Bytes(size); size += this.getSizeOfHighScaleLibCAT(); return size; }
/** * Returns size of the CAT object used in the high scale lib Counter. * * @return Size in bytes. */ private long getSizeOfHighScaleLibCAT() { long size = this.getSizeOfObjectHeader(); size += this.getPrimitiveTypesSize(2, 0, 0, 0, 4, 0); size = alignTo8Bytes(size); // always has an array of 4 longs attached size += this.getSizeOfPrimitiveArray(4, LONG_SIZE); return size; }
/** * {@inheritDoc} */ @Override public long getSizeOf(List<?> arrayList) { return this.getSizeOf(arrayList, ARRAY_LIST_INITIAL_CAPACITY); }
/** * {@inheritDoc} */ @Override public long getSizeOfHashSet(int hashSetSize) { return this.getSizeOfHashSet(hashSetSize, MAP_INITIAL_CAPACITY); }
/** * {@inheritDoc} */ @Override public long getSizeOfHashMap(int hashMapSize) { return this.getSizeOfHashMap(hashMapSize, MAP_INITIAL_CAPACITY); }
/** * {@inheritDoc} */ @Override public long getPrimitiveTypesSize(int referenceCount, int booleanCount, int intCount, int floatCount, int longCount, int doubleCount) { // note that the size of the booleans must be aligned to the int size // thus 1 boolean is in 4 bytes, but are also 2, 3 and 4 booleans in an object packed to int long booleanSize = 0; if (booleanCount > 0) { booleanSize = ((booleanCount * BOOLEAN_SIZE) + INT_SIZE) - ((booleanCount * BOOLEAN_SIZE) % INT_SIZE); } return booleanSize + (referenceCount * getReferenceSize()) + (intCount * INT_SIZE) + (floatCount * FLOAT_SIZE) + (longCount * LONG_SIZE) + (doubleCount * DOUBLE_SIZE); }
/** * @return Size of concurrent hash map node in java 8. */ private long getSizeOfConcurrentHashMapNode() { long size = this.getSizeOfObjectHeader() + this.getPrimitiveTypesSize(3, 0, 1, 0, 0, 0); return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfIntegerObject() { long size = this.getSizeOfObjectHeader() + INT_SIZE; return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public boolean isEvicted() { return bufferElementState.compareTo(BufferElementState.EVICTED) >= 0; }
/** * Returns size of HashMap's inner Key or Entry set classes. * * @return Returns size of HashMap's inner Key or Entry set classes. */ @Override public long getSizeOfHashMapKeyEntrySet() { // since these are inner classes, one reference to enclosing class is needed long size = this.getSizeOfObjectHeader() + this.getPrimitiveTypesSize(1, 0, 0, 0, 0, 0); return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfObjectObject() { return alignTo8Bytes(this.getSizeOfObjectHeader()); }
/** * {@inheritDoc} */ @Override public boolean isIndexed() { return bufferElementState.compareTo(BufferElementState.INDEXED) >= 0; }
/** * Calculates the size of the array with out objects in the array - <b> Can only be used on * non-primitive arrays </b>. * * @param arraySize * Size of array (length). * @return Size in bytes. */ @Override public long getSizeOfArray(int arraySize) { long size = this.getSizeOfObjectHeader(); size += this.getPrimitiveTypesSize(arraySize, 0, 1, 0, 0, 0); return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfShortObject() { long size = this.getSizeOfObjectHeader() + SHORT_SIZE; return alignTo8Bytes(size); }
/** * Returns the size of a HashMap entry. Not that the key and value objects are not in this size. * If HashSet is used the HashMapEntry value object will be a simple Object, thus this size has * to be added to the HashSet. * * @return Returns the size of a HashMap entry. Not that the key and value objects are not in * this size. If HashSet is used the HashMapEntry value object will be a simple Object, * thus this size has to be added to the HashSet. */ private long getSizeOfHashMapEntry() { long size = this.getSizeOfObjectHeader(); size += this.getPrimitiveTypesSize(3, 0, 1, 0, 0, 0); return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfLongObject() { long size = this.getSizeOfObjectHeader() + LONG_SIZE; return alignTo8Bytes(size); }
/** * {@inheritDoc} */ @Override public long getSizeOfBooleanObject() { long size = this.getSizeOfObjectHeader() + BOOLEAN_SIZE; return alignTo8Bytes(size); }