aicas logoJamaica 6.1 release 1

javax.realtime
Class SizeEstimator

java.lang.Object
  extended by javax.realtime.SizeEstimator

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 Summary
SizeEstimator()
          Constructor to create estimate with no entries.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeEstimator

public SizeEstimator()
Constructor to create estimate with no entries.

Method Detail

getEstimate

public long getEstimate()
getEstimate returns the current estimate in number of bytes.

Returns:
the current estimate.

reserve

public void reserve(java.lang.Class<?> clazz,
                    int num)
reserve reserves space for num instances of class clazz.

Parameters:
clazz - the class of the new instances
num - the number of instances.
Throws:
java.lang.IllegalArgumentException - if clazz is null or num is negative.

reserve

public void reserve(SizeEstimator size)
reserve reserves space for the memory reserved by SizeEstimator size.

Parameters:
size - another SizeEstimator.
Throws:
java.lang.IllegalArgumentException - if size is null.

reserve

public void reserve(SizeEstimator size,
                    int num)
reserve reserves space for the num times the memory reserved by SizeEstimator size.

Parameters:
size - another SizeEstimator.
num - factor to multiply the space from size with.
Throws:
java.lang.IllegalArgumentException - if size is null or num < 0.

reserveArray

public void reserveArray(int length)
reserveArray reserves space for an instance of a reference array of given length.

Parameters:
length - the length of the reference array we want to reserve space for.
Throws:
java.lang.IllegalArgumentException - if length < 0.
Since:
RTSJ V1.0.1

reserveArray

public 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.

Parameters:
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.
Throws:
java.lang.IllegalArgumentException - iff length is negative or type is not a primitive element type.
Since:
RTSJ V1.0.1

aicas logoJamaica 6.1 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2012 aicas GmbH. All Rights Reserved.