public final class ImmutableObjectInstance extends OOMDPObjectInstance implements ObjectInstance, java.lang.Iterable<Value>
| Constructor and Description |
|---|
ImmutableObjectInstance(ObjectClass obClass,
java.lang.String name)
Initializes an object instance for a given object class and name.
|
ImmutableObjectInstance(ObjectClass obClass,
java.lang.String name,
com.google.common.collect.ImmutableList<Value> newValues,
int hashCode,
boolean identifierIndependent) |
ImmutableObjectInstance(ObjectInstance o)
Creates a new object instance that is a shallow copy of the specified object instance's values.
|
ImmutableObjectInstance(java.lang.String name,
ImmutableObjectInstance objectInstance) |
| Modifier and Type | Method and Description |
|---|---|
ImmutableObjectInstance |
addAllRelationalTargets(java.lang.String attName,
java.util.Collection<java.lang.String> targets)
Adds all relational targets to the attribute attName for this object instance.
|
ImmutableObjectInstance |
addRelationalTarget(java.lang.String attName,
java.lang.String target)
Sets the relational value of the attribute named attName for this object instance.
|
java.lang.StringBuilder |
buildObjectDescription(java.lang.StringBuilder builder) |
ImmutableObjectInstance |
clearRelationalTargets(java.lang.String attName)
Clears all the relational value targets of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
copy()
Creates and returns a new object instance that is a deep copy of this object instance's values.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<java.lang.String> |
getAllRelationalTargets(java.lang.String attName)
Returns the set of all relational targets to which the relational attribute named attName is set.
|
boolean |
getBooleanValForAttribute(java.lang.String attName)
Returns the boolean value of the attribute (only defined for boolean attributes, int, and disc values).
|
java.lang.String |
getClassName()
Returns the name of this object instance's object class
|
double[] |
getDoubleArrayValForAttribute(java.lang.String attName)
Returns the int array value of the attribute (only defined for int array attributes).
|
double[] |
getFeatureVec()
Returns a double vector of all the observable values in this object instance.
|
int[] |
getIntArrayValForAttribute(java.lang.String attName)
Returns the int array value of the attribute (only defined for int array attributes).
|
int |
getIntValForAttribute(java.lang.String attName)
Returns the int value assignment for the discrete-valued attribute named attName.
|
java.lang.String |
getName()
Returns the name identifier of this object instance
|
double[] |
getNormalizedFeatureVec()
Returns a normalized double vector of all the observable values in this object instance.
|
double |
getNumericValForAttribute(java.lang.String attName)
Returns the double value for the attribute named attType.
|
ObjectClass |
getObjectClass()
Returns this object instance's object class
|
java.lang.String |
getObjectDescriptionWithNullForUnsetAttributes()
Returns a string description of the object with the unset attribute values listed as null.
|
double |
getRealValForAttribute(java.lang.String attName)
Returns the double value assignment for the real-valued attribute named attName.
|
java.lang.String |
getStringValForAttribute(java.lang.String attName)
Returns the string value representation for the attribute named attName.
|
Value |
getValueForAttribute(java.lang.String attName)
Returns the Value object assignment for the attribute named attName
|
java.util.List<Value> |
getValues()
Returns the list of value object assignments to all of this object instance's attributes.
|
int |
hashCode() |
java.util.List<Value> |
initializeValueObjects()
Creates new value object assignments for each of this object instance class's attributes.
|
boolean |
isHashed() |
java.util.Iterator<Value> |
iterator() |
ImmutableObjectInstance |
removeRelationalTarget(java.lang.String attName,
java.lang.String target)
Removes an object target from the specified relational attribute.
|
ImmutableObjectInstance |
setHashCode(int code,
boolean identifierIndependent) |
ImmutableObjectInstance |
setName(java.lang.String name)
Sets the name of this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
boolean v)
Sets the value of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
double v)
Sets the value of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
double[] v)
Sets the value of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
int v)
Sets the value of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
int[] v)
Sets the value of the attribute named attName for this object instance.
|
ImmutableObjectInstance |
setValue(java.lang.String attName,
java.lang.String v)
Sets the value of the attribute named attName for this object instance.
|
java.lang.String |
toString() |
java.util.List<java.lang.String> |
unsetAttributes()
Returns a list of the names of
Attributes that have unset values |
boolean |
valueEquals(ObjectInstance obj)
Returns true if the value assignments in this object instance are the same as they are in the target object instance.
|
getObjectDescription, setValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetObjectDescription, setValuepublic ImmutableObjectInstance(ObjectClass obClass, java.lang.String name)
obClass - the object class to which this object belongsname - the name of the objectpublic ImmutableObjectInstance(ObjectInstance o)
o - the source object instance from which this will object will copy.public ImmutableObjectInstance(ObjectClass obClass, java.lang.String name, com.google.common.collect.ImmutableList<Value> newValues, int hashCode, boolean identifierIndependent)
public ImmutableObjectInstance(java.lang.String name,
ImmutableObjectInstance objectInstance)
public ImmutableObjectInstance copy()
copy in interface ObjectInstancepublic java.util.List<Value> initializeValueObjects()
public ImmutableObjectInstance setName(java.lang.String name)
setName in interface ObjectInstancename - the name for this object instance.public ImmutableObjectInstance setHashCode(int code, boolean identifierIndependent)
public ImmutableObjectInstance setValue(java.lang.String attName, java.lang.String v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the string rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance setValue(java.lang.String attName, double v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the double rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance setValue(java.lang.String attName, int v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the int rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance setValue(java.lang.String attName, boolean v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the int rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance setValue(java.lang.String attName, int[] v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the int array rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance setValue(java.lang.String attName, double[] v)
setValue in interface ObjectInstanceattName - the name of the attribute whose value is to be set.v - the double array rep value to which the attribute of this object instance should be set.public ImmutableObjectInstance addRelationalTarget(java.lang.String attName, java.lang.String target)
addRelationalTarget in interface ObjectInstanceattName - the name of the relational attribute that will have a relational target added/settarget - the name of the object reference that is to be added as a target.public ImmutableObjectInstance addAllRelationalTargets(java.lang.String attName, java.util.Collection<java.lang.String> targets)
addAllRelationalTargets in interface ObjectInstanceattName - the name of the relational attribute that will have a relational target added/settargets - the names of the object references that are to be added as a targets.public ImmutableObjectInstance clearRelationalTargets(java.lang.String attName)
clearRelationalTargets in interface ObjectInstanceattName - public ImmutableObjectInstance removeRelationalTarget(java.lang.String attName, java.lang.String target)
removeRelationalTarget in interface ObjectInstanceattName - the name of the relational attribute from which the target should be removed.target - the target to remove from the relational attribute value.public java.lang.String getName()
getName in interface ObjectInstancepublic ObjectClass getObjectClass()
getObjectClass in interface ObjectInstancepublic java.lang.String getClassName()
getClassName in interface ObjectInstancepublic Value getValueForAttribute(java.lang.String attName)
getValueForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic double getRealValForAttribute(java.lang.String attName)
getRealValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic double getNumericValForAttribute(java.lang.String attName)
getRealValForAttribute(String) method because it will cast the int
values for non real attributes to double values and will not throw an exception.
Note that if this method is called on relational attributes, it will return 0.,
where as attributes like Attribute.AttributeType.INT and Attribute.AttributeType.DISC
will cast their int values to doubles.getNumericValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic java.lang.String getStringValForAttribute(java.lang.String attName)
getStringValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic int getIntValForAttribute(java.lang.String attName)
getIntValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic java.util.Set<java.lang.String> getAllRelationalTargets(java.lang.String attName)
getAllRelationalTargets in interface ObjectInstanceattName - attName the name of the attribute whose value should be returnedpublic boolean getBooleanValForAttribute(java.lang.String attName)
getBooleanValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returnedpublic int[] getIntArrayValForAttribute(java.lang.String attName)
getIntArrayValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returned.public double[] getDoubleArrayValForAttribute(java.lang.String attName)
getDoubleArrayValForAttribute in interface ObjectInstanceattName - the name of the attribute whose value should be returned.public java.util.List<Value> getValues()
getValues in interface ObjectInstancepublic java.lang.StringBuilder buildObjectDescription(java.lang.StringBuilder builder)
buildObjectDescription in interface ObjectInstancepublic java.lang.String toString()
toString in class java.lang.Objectpublic double[] getFeatureVec()
getFeatureVec in interface ObjectInstancepublic double[] getNormalizedFeatureVec()
getNormalizedFeatureVec in interface ObjectInstancepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean valueEquals(ObjectInstance obj)
valueEquals in interface ObjectInstanceobj - the object instance against which this object instance should be compared.public boolean isHashed()
public int hashCode()
hashCode in class java.lang.Objectpublic java.util.List<java.lang.String> unsetAttributes()
ObjectInstanceAttributes that have unset valuesunsetAttributes in interface ObjectInstancepublic java.lang.String getObjectDescriptionWithNullForUnsetAttributes()
ObjectInstancegetObjectDescriptionWithNullForUnsetAttributes in interface ObjectInstance