Package sleep.engine.types
Class OrderedHashContainer
- java.lang.Object
-
- sleep.engine.types.HashContainer
-
- sleep.engine.types.OrderedHashContainer
-
- All Implemented Interfaces:
java.io.Serializable
,ScalarHash
public class OrderedHashContainer extends HashContainer
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SleepClosure
missPolicy
policy function for what to do when a miss occursprotected SleepClosure
removalPolicy
policy function for what to do when a hit occursprotected boolean
shouldClean
-
Fields inherited from class sleep.engine.types.HashContainer
values
-
-
Constructor Summary
Constructors Constructor Description OrderedHashContainer(int capacity, float loadfactor, boolean type)
constructs an ordered hash container based on the specified items
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Field Detail
-
shouldClean
protected boolean shouldClean
-
missPolicy
protected transient SleepClosure missPolicy
policy function for what to do when a miss occurs
-
removalPolicy
protected transient SleepClosure removalPolicy
policy function for what to do when a hit occurs
-
-
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 interfaceScalarHash
- Overrides:
keys
in classHashContainer
-
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 interfaceScalarHash
- Overrides:
getAt
in classHashContainer
-
-