public final class SizeEstimator
extends java.lang.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 |
|---|---|
void |
clear()
Restores the estimate value to zero for reuse.
|
long |
getEstimate()
getEstimate returns the current estimate in number of bytes.
|
void |
reserve(java.lang.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,
java.lang.Class<?> type)
reserveArray reserves space for an of an array of primitive type
and length elements when estimating the size of the MemoryArea.
|
void |
reserveLambda()
Determines the size of a lambda with no
closure and add it to this size estimator.
|
void |
reserveLambda(EnclosedType first)
Determines the size of a lambda with one variable in its
closure and add it to this size estimator.
|
void |
reserveLambda(EnclosedType first,
EnclosedType second)
Determines the size of a lambda with two variables in its
closure and add it to this size estimator.
|
void |
reserveLambda(EnclosedType first,
EnclosedType second,
EnclosedType... others)
Determines the size of a lambda with more than two variables in its
closure and add it to this size estimator.
|
public SizeEstimator()
public long getEstimate()
public void reserve(java.lang.Class<?> clazz,
int num)
clazz - the class of the new instancesnum - the number of instances.StaticIllegalArgumentException - if clazz is null or num is
negative.public void reserve(SizeEstimator size)
size - another SizeEstimator.StaticIllegalArgumentException - if size is null.public void reserve(SizeEstimator size, int num)
size - another SizeEstimator.num - factor to multiply the space from size with.StaticIllegalArgumentException - if size is null or num < 0.public void reserveArray(int length)
length - the length of the reference array we want to
reserve space for.StaticIllegalArgumentException - if length < 0.public void reserveArray(int length,
java.lang.Class<?> 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.StaticIllegalArgumentException - iff length is negative or type
is not a primitive element type.public void reserveLambda(EnclosedType first, EnclosedType second, EnclosedType... others)
first - Type of first variable in closure.second - Type of second variable in closure.others - Types of additional variables in closure.public void reserveLambda(EnclosedType first, EnclosedType second)
first - Type of first variable in closure.second - Type of second variable in closure.public void reserveLambda(EnclosedType first)
first - Type of first variable in closure.public void reserveLambda()
public void clear()
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.