org.apache.java.recycle
Class LimitedContainer

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

public class LimitedContainer
extends java.lang.Object
implements RecycleBin

This class wraps around a container to limit its capacity.

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

Field Summary
private  int capacity
           
private  RecycleBin container
           
 
Constructor Summary
LimitedContainer(RecycleBin container, int capacity)
           
 
Method Summary
 Recyclable getRecyclable()
          This method is called to obtain a recyclable object from this recycle bin.
 int getSize()
          This method returns the actual number of recyclable objects contained in this recycle bin.
 void recycle(Recyclable object)
          This method is called to recycle a recyclable object into this container.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

container

private RecycleBin container

capacity

private int capacity
Constructor Detail

LimitedContainer

public LimitedContainer(RecycleBin container,
                        int capacity)
Method Detail

getRecyclable

public Recyclable getRecyclable()
Description copied from interface: RecycleBin
This method is called to obtain a recyclable object from this recycle bin.
Specified by:
getRecyclable in interface RecycleBin
Tags copied from interface: RecycleBin
Throws:
RecycleBinIsEmpty - when recycle bin is empty.

recycle

public void recycle(Recyclable object)
Description copied from interface: RecycleBin
This method is called to recycle a recyclable object into this container. The clean() method is guaranteed to be called by the RecycleBin implementation before the object is stored.
Specified by:
recycle in interface RecycleBin
Tags copied from interface: RecycleBin
Throws:
ObjectWasDestroyed - when object is destroied.

getSize

public int getSize()
Description copied from interface: RecycleBin
This method returns the actual number of recyclable objects contained in this recycle bin.
Specified by:
getSize in interface RecycleBin