javax.realtime
Class SizeEstimator

java.lang.Object
  extended byjavax.realtime.SizeEstimator

public final class SizeEstimator
extends Object

This is a convenient class to help people figure out how much memory they 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.

Author:
Angelo Corsaro

Field Summary
protected  int allocationNumber
           
protected  long estimate
           
 
Constructor Summary
SizeEstimator()
           
 
Method Summary
 int getAllocationNumber()
           
 long getEstimate()
          Returns an estimate of the number of bytes needed to store all the objects reserved.
 void reserve(Class c)
          Take into account one additional instance of Class c when estimating the size of the MemoryArea.
 void reserve(Class c, int n)
          Take into account additional n instances of Class c when estimating the size of the MemoryArea.
 void reserve(SizeEstimator s)
          Take into account an additional instance of SizeEstimator s when estimating the size of the MemoryArea.
 void reserve(SizeEstimator s, int n)
          Take into account additional n instances of SizeEstimator s 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

protected long estimate

allocationNumber

protected int allocationNumber
Constructor Detail

SizeEstimator

public SizeEstimator()
Method Detail

getEstimate

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

Returns:
the estimate.

reserve

public void reserve(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 be considered
n - the number of instances for which memory needs to be reserved.

reserve

public void reserve(Class c)
Take into account one additional instance of Class c when estimating the size of the MemoryArea.

Parameters:
c - the class to be considered

reserve

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

Parameters:
s - a SizeEstimator

reserve

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

Parameters:
s - a SizeEstimator value
n - the number of instances.

getAllocationNumber

public int getAllocationNumber()


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2005 Angelo Corsaro and Morgan Deters.