public class DiscretizingMaskedHashableStateFactory extends MaskedHashableStateFactory
HashableState
objects that computes hash codes and tests
for State
equality by discretizing real-valued attributes and by masking (ignoring)
either Attribute
s and/or ObjectClass
es. For more information
on how discretization is performed, see the DiscretizingHashableStateFactory
class documentation and for more information on how Attribute
/ObjectClass
masking is performed see the MaskedHashableStateFactory
class
documentation.
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 hash their hash code or not. See the SimpleHashableStateFactory
class documentation for more information on those features.SimpleHashableStateFactory.AttClass, SimpleHashableStateFactory.SimpleCachedHashableState, SimpleHashableStateFactory.SimpleHashableState, SimpleHashableStateFactory.SimpleHashableStateInterface
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.Double> |
attributeWiseMultiples
The multiples to use for specific attributes
|
protected double |
defaultMultiple
The default multiple to use for any continuous attributes that have not been specifically set.
|
maskedAttributes, maskedObjectClasses
identifierIndependent, useCached
Constructor and Description |
---|
DiscretizingMaskedHashableStateFactory(boolean identifierIndependent,
boolean useCached,
double defaultMultiple)
Initializes.
|
DiscretizingMaskedHashableStateFactory(boolean identifierIndependent,
boolean useCached,
double defaultMultiple,
boolean maskNamesAreForAttributes,
java.lang.String... masks)
Initializes with a specified attribute or object class mask.
|
DiscretizingMaskedHashableStateFactory(boolean identifierIndependent,
double defaultMultiple)
Initializes with non hash code caching and object class or attribute masks
|
DiscretizingMaskedHashableStateFactory(double defaultMultiple)
Initializes with object identifier independence, no hash code caching and object class or attribute masks.
|
Modifier and Type | Method and Description |
---|---|
void |
addFloorDiscretizingMultipleFor(java.lang.String attributeName,
double nearestMultipleValue)
Sets the multiple to use for discretization for the attribute with the specified name.
|
protected void |
appendHashcodeForValue(org.apache.commons.lang3.builder.HashCodeBuilder hashCodeBuilder,
Value v)
Appends the hash code for the given
Value to the HashCodeBuilder |
protected static int |
intMultiples(double mult,
double num)
Returns int result of num / mult; that is, (int)(num / mult).
|
void |
setDefaultFloorDiscretizingMultiple(double defaultMultiple)
Sets the default multiple to use for continuous attributes that do not have specific multiples set
for them.
|
protected boolean |
valuesEqual(Value v1,
Value v2)
Returns whether two values are equal.
|
addAttributeMasks, addObjectClassMasks, clearAllAttributeMasks, clearAllObjectClassMasks, computeHashCode, computeHashCode, getMaskedAttributes, getMaskedObjectClasses, identifierDependentEquals, identifierIndependentEquals, objectValuesEqual, removeAttributeMasks, removeObjectClassMasks
getAttClass, hashState, objectIdentifierIndependent, statesEqual
protected java.util.Map<java.lang.String,java.lang.Double> attributeWiseMultiples
protected double defaultMultiple
public DiscretizingMaskedHashableStateFactory(double defaultMultiple)
defaultMultiple
- The default multiple to use for any continuous attributes that have not been specifically set. The default is 1.0, which
corresponds to integer floor discretization.public DiscretizingMaskedHashableStateFactory(boolean identifierIndependent, double defaultMultiple)
identifierIndependent
- if true then state evaluations are object identifier independent; if false then dependent.defaultMultiple
- The default multiple to use for any continuous attributes that have not been specifically set. The default is 1.0, which
corresponds to integer floor discretization.public DiscretizingMaskedHashableStateFactory(boolean identifierIndependent, boolean useCached, double defaultMultiple)
identifierIndependent
- if true then state evaluations are object identifier independent; if false then dependent.useCached
- if true then the hash code for each produced HashableState
will be cached; if false then they will not be cached.defaultMultiple
- The default multiple to use for any continuous attributes that have not been specifically set.
corresponds to integer floor discretization.public DiscretizingMaskedHashableStateFactory(boolean identifierIndependent, boolean useCached, double defaultMultiple, boolean maskNamesAreForAttributes, java.lang.String... masks)
identifierIndependent
- if true then state evaluations are object identifier independent; if false then dependent.useCached
- if true then the hash code for each produced HashableState
will be cached; if false then they will not be cached.defaultMultiple
- The default multiple to use for any continuous attributes that have not been specifically set.maskNamesAreForAttributes
- whether the specified masks are masks for attributes or object classes. True for attributes, false for object classes.masks
- the names of the Attribute
s or ObjectClass
that will be masks (ignored from state hashing and equality checks)public void addFloorDiscretizingMultipleFor(java.lang.String attributeName, double nearestMultipleValue)
attributeName
- the name of the attribute whose discretization multiple is being set.nearestMultipleValue
- the multiple to which values are floored.public void setDefaultFloorDiscretizingMultiple(double defaultMultiple)
defaultMultiple
- the default multiple to which values are flooredprotected void appendHashcodeForValue(org.apache.commons.lang3.builder.HashCodeBuilder hashCodeBuilder, Value v)
SimpleHashableStateFactory
Value
to the HashCodeBuilder
appendHashcodeForValue
in class SimpleHashableStateFactory
hashCodeBuilder
- the HashCodeBuilder
to which the value's hash code will be appendedv
- the Value
whose hash code should be appended.protected boolean valuesEqual(Value v1, Value v2)
valuesEqual
in class SimpleHashableStateFactory
v1
- the first value to comparev2
- the second value to compareprotected static int intMultiples(double mult, double num)
mult
- the multiplenum
- the number