org.eigenbase.util
Class CompoundClosableAllocation

java.lang.Object
  extended by org.eigenbase.util.CompoundClosableAllocation
All Implemented Interfaces:
ClosableAllocation, ClosableAllocationOwner
Direct Known Subclasses:
FarragoCompoundAllocation, FarragoSequenceAccessor

public class CompoundClosableAllocation
extends Object
implements ClosableAllocationOwner

CompoundClosableAllocation represents a collection of ClosableAllocations which share a common lifecycle. It guarantees that allocations are closed in the reverse order in which they were added.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/CompoundClosableAllocation.java#8 $
Author:
John V. Sichi

Field Summary
protected  List<ClosableAllocation> allocations
          List of owned ClosableAllocation objects.
 
Constructor Summary
CompoundClosableAllocation()
           
 
Method Summary
 void addAllocation(ClosableAllocation allocation)
          Assigns ownership of a ClosableAllocation to this owner.
 void closeAllocation()
          Closes this object.
 boolean forgetAllocation(ClosableAllocation allocation)
          Forgets an allocation without closing it.
 boolean hasAllocations()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allocations

protected List<ClosableAllocation> allocations
List of owned ClosableAllocation objects.

Constructor Detail

CompoundClosableAllocation

public CompoundClosableAllocation()
Method Detail

addAllocation

public void addAllocation(ClosableAllocation allocation)
Description copied from interface: ClosableAllocationOwner
Assigns ownership of a ClosableAllocation to this owner.

Specified by:
addAllocation in interface ClosableAllocationOwner
Parameters:
allocation - the ClosableAllocation to take over

closeAllocation

public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.

Specified by:
closeAllocation in interface ClosableAllocation

forgetAllocation

public boolean forgetAllocation(ClosableAllocation allocation)
Forgets an allocation without closing it.

Parameters:
allocation - the allocation to forget
Returns:
whether the allocation was known

hasAllocations

public boolean hasAllocations()
Returns:
whether any allocations remain unclosed