javax.realtime
Class SizeEstimator

java.lang.Object
  |
  +--javax.realtime.SizeEstimator

public final class SizeEstimator
extends java.lang.Object

This is a convenient class to help people figure out how much memory the need. Instead of passing actual numbers to the MemoryArea constructors, one can pass SizeEstimator objects with which you can have a better feel of how big a memory area you require.


Field Summary
private  long estimate
          The estimated number of bytes neede to store all objects reserved.
 
Constructor Summary
SizeEstimator()
           
 
Method Summary
 long getEstimate()
          Gets an estimate of the number of bytes needed to store all the objects reserved.
static long objSize(java.lang.Class c)
           
 void reserve(java.lang.Class c, int n)
          Take into account additional n instances of Class c when estimating the size of the MemoryArea.
 void reserve(javax.realtime.SizeEstimator size)
          Take into account an additional instance of SizeEstimator s when estimating the size of the MemoryArea.
 void reserve(javax.realtime.SizeEstimator s, int n)
          Take into account additional n instances of SizeEstimator size 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
 

Field Detail

estimate

private long estimate
The estimated number of bytes neede to store all objects reserved.

Constructor Detail

SizeEstimator

public SizeEstimator()
Method Detail

getEstimate

public long getEstimate()
Gets an estimate of the number of bytes needed to store all the objects reserved.

Returns:
The estimate size in bytes.

reserve

public void reserve(java.lang.Class c,
                    int n)
Take into account additional n instances of Class c when estimating the size of the MemoryArea.

Parameters:
c - The class to take into account.
n - The number of instances of c to estimate.

reserve

public void reserve(javax.realtime.SizeEstimator size)
Take into account an additional instance of SizeEstimator s when estimating the size of the MemoryArea.

Parameters:
size - The given instance of SizeEstimator.

reserve

public void reserve(javax.realtime.SizeEstimator s,
                    int n)
Take into account additional n instances of SizeEstimator size when estimating the size of the MemoryArea.

Parameters:
n - The number of instances of size to estimate.

objSize

public static long objSize(java.lang.Class c)