public final class SizeEstimator extends Object
Jamaica Real-Time Specification for Java class SizeEstimator.
This class permits to estimate the memory required for the allocation of Java objects and arrays. It determines a lower bound for the memory required to allocate all instances and arrays function reserve() will be called for.
Constructor and Description |
---|
SizeEstimator()
Constructor to create estimate with no entries.
|
Modifier and Type | Method and Description |
---|---|
long |
getEstimate()
getEstimate returns the current estimate in number of bytes.
|
void |
reserve(Class<?> clazz,
int num)
reserve reserves space for num instances of class clazz.
|
void |
reserve(SizeEstimator size)
reserve reserves space for the memory reserved by SizeEstimator
size.
|
void |
reserve(SizeEstimator size,
int num)
reserve reserves space for the num times the memory reserved by
SizeEstimator size.
|
void |
reserveArray(int length)
reserveArray reserves space for an instance of a reference array
of given length.
|
void |
reserveArray(int length,
Class<?> type)
reserveArray reserves space for an of an array of primitive type
and length elements when estimating the size of the MemoryArea.
|
public SizeEstimator()
public long getEstimate()
public void reserve(Class<?> clazz, int num)
StaticIllegalArgumentException
- if clazz is null or num is
negative.clazz
- the class of the new instancesnum
- the number of instances.public void reserve(SizeEstimator size)
StaticIllegalArgumentException
- if size is null.size
- another SizeEstimator.public void reserve(SizeEstimator size, int num)
StaticIllegalArgumentException
- if size is null or num < 0.size
- another SizeEstimator.num
- factor to multiply the space from size with.public void reserveArray(int length)
StaticIllegalArgumentException
- if length < 0.length
- the length of the reference array we want to
reserve space for.public void reserveArray(int length, Class<?> type)
StaticIllegalArgumentException
- iff length is negative or type
is not a primitive element type.length
- the length of the primitive array we want to
reserve space for.type
- the primitive element type, must be one of
Boolean.TYPE, Byte.TYPE, Short.TYPE, Character.TYPE,
Integer.Type, Float.TYPE, Long.TYPE, or Double.TYPE.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.