org.apache.java.recycle
Class MinMaxController

java.lang.Object
  |
  +--org.apache.java.recycle.MinMaxController

public class MinMaxController
extends java.lang.Object
implements Controller

This level controller is based on a simpler variance method: the variance of the request frequency is obtained from the difference between the minimum and maximum value of the level. The stability of the system is not much, but it consumes a lot lesser time resources that GaussianController.

Version:
$Revision: 1.3 $ $Date: 1999/06/24 00:50:50 $

Field Summary
private static int BIAS
          This is the minimum value allowed to be reached.
private  int cursor
          The pointer in the circular array.
private  int level
          The current level.
private  int[] levels
          The array of levels.
private static int WINDOW
          This is the log2 value of the sampling window.
 
Constructor Summary
MinMaxController()
           
 
Method Summary
 void down()
          Writes on the memory of this controller decrementing the level.
private  int getLevel(int[] array)
          Returns the predicted correct level calculating the max variable amplitude in levels statistics.
 boolean isThereRoomFor(Recyclable object)
          Evaluates the room for the object to recycle basing this decision to the optimum level estrapolated from the level history.
 void up()
          Writes on the memory of this controller incrementing the level.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

WINDOW

private static final int WINDOW
This is the log2 value of the sampling window.

BIAS

private static final int BIAS
This is the minimum value allowed to be reached.

level

private int level
The current level.

levels

private int[] levels
The array of levels.

cursor

private int cursor
The pointer in the circular array.
Constructor Detail

MinMaxController

public MinMaxController()
Method Detail

up

public void up()
Writes on the memory of this controller incrementing the level.
Specified by:
up in interface Controller

down

public void down()
Writes on the memory of this controller decrementing the level.
Specified by:
down in interface Controller

isThereRoomFor

public boolean isThereRoomFor(Recyclable object)
Evaluates the room for the object to recycle basing this decision to the optimum level estrapolated from the level history.
Specified by:
isThereRoomFor in interface Controller

getLevel

private int getLevel(int[] array)
Returns the predicted correct level calculating the max variable amplitude in levels statistics.