public class MaskedHashableStateFactory extends SimpleHashableStateFactory
HashableState instances in which the hash code and equality
of the states masks (ignores) specified state variables. For OOStates,
this class can also be specified to mask entire OO-MDP objects belonging to specified OO-MDP classes.
If masks are specified for variables, and the state is an OOState then the
variables names specified for the masks are assumed to be on the object-level. Therefore, if two different objects
have the same set of variables keys, a single mask for the variable name key will mask variable values for all objects
that have that key.
This class extends SimpleHashableStateFactory, which means it can be toggled to
to be object identifier/name independent or dependent and can be set to use HashableState
instances that cache their hash code or not. See the SimpleHashableStateFactory
class documentation for more information on those features.
| Modifier and Type | Field and Description |
|---|---|
protected MaskedConfig |
config |
identifierIndependent| Constructor and Description |
|---|
MaskedHashableStateFactory()
Default constructor: object identifier independent, no hash code caching, and no object class or attribute masks.
|
MaskedHashableStateFactory(boolean identifierIndependent)
Initializes with no hash code caching and no object class or attribute masks.
|
MaskedHashableStateFactory(boolean identifierIndependent,
boolean maskNamesAreForVariables,
java.lang.String... masks)
Initializes with a specified variable or object class mask.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addObjectClassMasks(java.lang.String... masks)
Adds masks for entire OO-MDP objects that belong to the specified OO-MDP object class.
|
void |
addVariableMasks(java.lang.Object... masks)
Adds masks for specific state variables.
|
void |
clearAllAttributeMasks()
Clears all state variable masks.
|
void |
clearAllObjectClassMasks()
Clears all object class masks.
|
MaskedConfig |
getConfig() |
HashableState |
hashState(State s)
Turns
State s into a HashableState |
void |
removeAttributeMasks(java.lang.Object... masks)
Removes variable masks.
|
void |
removeObjectClassMasks(java.lang.String... masks)
Removes masks for OO-MDP object classes
|
void |
setConfig(MaskedConfig config) |
objectIdentifierIndependentprotected MaskedConfig config
public MaskedHashableStateFactory()
public MaskedHashableStateFactory(boolean identifierIndependent)
identifierIndependent - if true then state evaluations are object identifier independent; if false then dependent.public MaskedHashableStateFactory(boolean identifierIndependent,
boolean maskNamesAreForVariables,
java.lang.String... masks)
identifierIndependent - if true then state evaluations are object identifier independent; if false then dependent.maskNamesAreForVariables - whether the specified masks are masks for state variables or object classes. True for variables, false for object classes.masks - the names of the state variables or OO-MDP object class that will be masked (ignored from state hashing and equality checks)public void addVariableMasks(java.lang.Object... masks)
State.variableKeys() method.masks - keys of the state variables to maskpublic void addObjectClassMasks(java.lang.String... masks)
masks - the names of the object classes to mask.public void removeAttributeMasks(java.lang.Object... masks)
masks - variable keys for which masks should be removedpublic void removeObjectClassMasks(java.lang.String... masks)
masks - the names object classes that will no longer be masked.public void clearAllAttributeMasks()
public void clearAllObjectClassMasks()
public MaskedConfig getConfig()
public void setConfig(MaskedConfig config)
public HashableState hashState(State s)
HashableStateFactoryState s into a HashableStatehashState in interface HashableStateFactoryhashState in class SimpleHashableStateFactorys - the input State to transform.HashableState.