com.jme.bounding
Class UsageTreeController

java.lang.Object
  extended by com.jme.bounding.UsageTreeController
All Implemented Interfaces:
CollisionTreeController

public class UsageTreeController
extends java.lang.Object
implements CollisionTreeController

UsageTreeController defines a CollisionTreeController implementation that removes cache elements based on the frequency of usage. By default, and implementation in the CollisionTreeManager, the cache's key set will be ordered with the first element being the oldest used. Therefore, UsageTreeController simply removes elements from the cache starting at the first key and working up until the deisred size is reached or we run out of elements.

Author:
Mark Powell

Constructor Summary
UsageTreeController()
           
 
Method Summary
 void clean(java.util.Map<TriMesh,CollisionTree> cache, java.util.List<TriMesh> protectedList, int desiredSize)
          removes elements from cache (that are not in the protectedList) until the desiredSize is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsageTreeController

public UsageTreeController()
Method Detail

clean

public void clean(java.util.Map<TriMesh,CollisionTree> cache,
                  java.util.List<TriMesh> protectedList,
                  int desiredSize)
removes elements from cache (that are not in the protectedList) until the desiredSize is reached. It removes elements from the keyset as they are ordered.

Specified by:
clean in interface CollisionTreeController
Parameters:
cache - the cache to clean.
protectedList - the list of elements to not remove.
desiredSize - the final size of the cache to attempt to reach.