sleep.engine.types
Class OrderedHashContainer

java.lang.Object
  extended by sleep.engine.types.HashContainer
      extended by sleep.engine.types.OrderedHashContainer
All Implemented Interfaces:
java.io.Serializable, ScalarHash

public class OrderedHashContainer
extends HashContainer

See Also:
Serialized Form

Field Summary
protected  SleepClosure missPolicy
          policy function for what to do when a miss occurs
protected  SleepClosure removalPolicy
          policy function for what to do when a hit occurs
protected  boolean shouldClean
           
 
Fields inherited from class sleep.engine.types.HashContainer
values
 
Constructor Summary
OrderedHashContainer(int capacity, float loadfactor, boolean type)
          constructs an ordered hash container based on the specified items
 
Method Summary
 Scalar getAt(Scalar key)
          Retrieves a scalar from the hashtable.
 ScalarArray keys()
          Returns all of the keys within the scalar hash.
protected  boolean removeEldestEntryCheck(java.util.Map.Entry eldest)
           
 void setMissPolicy(SleepClosure policy)
          set the miss policy for this hash (determines default value of missed value)
 void setRemovalPolicy(SleepClosure policy)
          set the removal policy for this hash (decides if an entry should be removed or not
 
Methods inherited from class sleep.engine.types.HashContainer
getData, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shouldClean

protected boolean shouldClean

missPolicy

protected SleepClosure missPolicy
policy function for what to do when a miss occurs


removalPolicy

protected SleepClosure removalPolicy
policy function for what to do when a hit occurs

Constructor Detail

OrderedHashContainer

public OrderedHashContainer(int capacity,
                            float loadfactor,
                            boolean type)
constructs an ordered hash container based on the specified items

Method Detail

setRemovalPolicy

public void setRemovalPolicy(SleepClosure policy)
set the removal policy for this hash (decides if an entry should be removed or not


setMissPolicy

public void setMissPolicy(SleepClosure policy)
set the miss policy for this hash (determines default value of missed value)


removeEldestEntryCheck

protected boolean removeEldestEntryCheck(java.util.Map.Entry eldest)

keys

public ScalarArray keys()
Description copied from interface: ScalarHash
Returns all of the keys within the scalar hash. If a key has a $null (aka empty scalar) value the key should be removed from the scalar hash.

Specified by:
keys in interface ScalarHash
Overrides:
keys in class HashContainer

getAt

public Scalar getAt(Scalar key)
Description copied from interface: ScalarHash
Retrieves a scalar from the hashtable. If a scalar key does not exist then the key should be created with a value of $null. This $null or empty scalar value should be returned by the function. This is how values are added to Scalar hashes.

Specified by:
getAt in interface ScalarHash
Overrides:
getAt in class HashContainer