|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.UniqueID
messif.objects.AbstractObject
messif.objects.LocalAbstractObject
messif.objects.MetaObject
public abstract class MetaObject
Represents a collection of LocalAbstractObjects encapsulated as one object. All the encapsulated objects share the same locator URI.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class messif.objects.LocalAbstractObject |
---|
LocalAbstractObject.DataEqualObject |
Field Summary |
---|
Fields inherited from class messif.objects.LocalAbstractObject |
---|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, UNKNOWN_DISTANCE |
Constructor Summary | |
---|---|
protected |
MetaObject()
Creates a new instance of MetaObject. |
protected |
MetaObject(AbstractObjectKey objectKey)
Creates a new instance of MetaObject. |
protected |
MetaObject(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObject loaded from binary input. |
protected |
MetaObject(java.lang.String locatorURI)
Creates a new instance of MetaObject. |
Method Summary | ||
---|---|---|
void |
clearSurplusData()
Clear non-messif data stored in this object and all its subobjects. |
|
boolean |
containsObject(java.lang.String name)
Returns true if there is an encapsulated object for given symbolic name. |
|
float[] |
createMetaDistancesHolder()
Returns the array that can hold distances to the respective encapsulated objects. |
|
static MetaObject |
createSearchMetaObject(java.lang.String locatorURI)
Create a new instance of a simple MetaObject wihout any encapsulated objects. |
|
boolean |
dataEquals(java.lang.Object obj)
Indicates whether some other object has the same data as this one. |
|
int |
dataHashCode()
Returns sum of hash code values for all the encapsulated objects' data. |
|
protected int |
fillMetaDistances(MetaObject obj,
float distThreshold,
float[] metaDistances)
Convenience method that fills the given metaDistances array with distances. |
|
protected int |
fillMetaDistances(MetaObject obj,
float distThreshold,
float[] metaDistances,
java.lang.String[] objectNames,
float unknownDistance)
Convenience method that fills the given metaDistances array with distances. |
|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
The actual implementation of the metric function. |
|
protected abstract float |
getDistanceImpl(LocalAbstractObject obj,
float[] metaDistances,
float distThreshold)
The actual implementation of the metric function. |
|
abstract LocalAbstractObject |
getObject(java.lang.String name)
Returns the encapsulated object for given symbolic name. |
|
abstract int |
getObjectCount()
Returns the number of encapsulated objects. |
|
java.util.Map<java.lang.String,LocalAbstractObject> |
getObjectMap()
Returns a collection of all the encapsulated objects associated with their symbolic names. |
|
abstract java.util.Collection<java.lang.String> |
getObjectNames()
Returns a set of symbolic names of the encapsulated objects. |
|
java.util.Collection<LocalAbstractObject> |
getObjects()
Returns a collection of all the encapsulated objects. |
|
int |
getSize()
Returns the size of this object in bytes. |
|
protected
|
readObject(java.io.BufferedReader stream,
java.lang.Class<E> objectClass)
Reads one object with the specified class name from the stream. |
|
protected LocalAbstractObject |
readObject(java.io.BufferedReader stream,
java.lang.String className)
Reads one object with the specified class name from the stream. |
|
java.lang.String |
toString()
Returns a string representation of this metaobject. |
Methods inherited from class messif.objects.LocalAbstractObject |
---|
binarySerialize, chainDestroy, chainFilter, clone, clone, cloneRandomlyModify, create, create, excludeUsingPrecompDist, getBinarySize, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceUpperBound, getMaxDistance, getNormDistance, getRandomChar, getRandomNormal, includeUsingPrecompDist, readObjectComments, unchainFilter, write, write, writeData |
Methods inherited from class messif.objects.AbstractObject |
---|
clone, getLocatorURI, getNoDataObject, getObjectID, getObjectKey, setObjectKey |
Methods inherited from class messif.objects.UniqueID |
---|
compareTo, equals, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected MetaObject()
protected MetaObject(AbstractObjectKey objectKey)
objectKey
- the key to be associated with this objectprotected MetaObject(java.lang.String locatorURI)
AbstractObjectKey
is generated for
the specified locatorURI
.
locatorURI
- the locator URI for the new objectprotected MetaObject(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the MetaObject fromserializator
- the serializator used to write objects
java.io.IOException
- if there was an I/O error reading from the bufferMethod Detail |
---|
public static MetaObject createSearchMetaObject(java.lang.String locatorURI)
locatorURI
- the locator URI for the new object
public abstract int getObjectCount()
public abstract java.util.Collection<java.lang.String> getObjectNames()
public abstract LocalAbstractObject getObject(java.lang.String name)
name
- the symbolic name of the object to return
public boolean containsObject(java.lang.String name)
name
- the symbolic name of the object to return
public java.util.Collection<LocalAbstractObject> getObjects()
public java.util.Map<java.lang.String,LocalAbstractObject> getObjectMap()
protected LocalAbstractObject readObject(java.io.BufferedReader stream, java.lang.String className) throws java.io.IOException
LocalAbstractObject
.
Then, a constructor with BufferedReader
argument is used to load the object up.
stream
- the text stream to read the object fromclassName
- the name of the class for the object
java.io.IOException
- if there was an error resolving the specified class or its constuctor or a problem
occurred while reading from the streamprotected <E> E readObject(java.io.BufferedReader stream, java.lang.Class<E> objectClass) throws java.io.IOException
LocalAbstractObject
.
Then, a constructor with BufferedReader
argument is used to load the object up.
E
- the class of the object that is read from the streamstream
- the text stream to read the object fromobjectClass
- the class of the object that is read from the stream
java.io.IOException
- if there was an error resolving the specified class or its constuctor or a problem
occurred while reading from the streampublic boolean dataEquals(java.lang.Object obj)
dataEquals
in class LocalAbstractObject
obj
- the reference object with which to compare (if it is not MetaObject, this method will return false
)
true
if this object is the same as the obj
argument; false
otherwise.public int dataHashCode()
dataHashCode
in class LocalAbstractObject
protected final float getDistanceImpl(LocalAbstractObject obj, float distThreshold)
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject, float[], float)
is called with null meta distances array in order to compute the
actual distance.
getDistanceImpl
in class LocalAbstractObject
obj
- the object to compute distance todistThreshold
- the threshold value on the distance
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
protected abstract float getDistanceImpl(LocalAbstractObject obj, float[] metaDistances, float distThreshold)
metaDistances
parameter is not null, it should be filled
with the distances to the respective encapsulated objects (method
fillMetaDistances
can be used).
obj
- the object to compute distance tometaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nulldistThreshold
- the threshold value on the distance
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
public float[] createMetaDistancesHolder()
MetaObject
,
otherwise null is returned.
createMetaDistancesHolder
in class LocalAbstractObject
protected final int fillMetaDistances(MetaObject obj, float distThreshold, float[] metaDistances, java.lang.String[] objectNames, float unknownDistance)
metaDistances
array with distances.
Every item of the array is filled with the distance between
the encapsulated object stored in this metaobject under the name given in the
respective item of objectNames
and the encapsulated object stored
in obj
metaobject under the same name. If any of the two objects
are null, the value of unknownDistance
parameter is filled.
obj
- the object to compute distance todistThreshold
- the threshold value on the distancemetaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nullobjectNames
- the list of names of encapsulated objects to retrieve
from this and obj
(must have the same number of items as metaDistances
unknownDistance
- the distance to fill if either this or obj's encapsulated object is null
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
protected final int fillMetaDistances(MetaObject obj, float distThreshold, float[] metaDistances)
metaDistances
array with distances.
Every item of the array is filled with the distance between
all the encapsulated objects stored in this metaobject and the respective
(using the same name) encapsulated object in obj
. If any of the two objects
are null, the value of LocalAbstractObject.UNKNOWN_DISTANCE
is filled.
obj
- the object to compute distance todistThreshold
- the threshold value on the distancemetaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not null
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
public int getSize()
getSize
in class LocalAbstractObject
public void clearSurplusData()
clearSurplusData
in interface Clearable
clearSurplusData
in class LocalAbstractObject
public java.lang.String toString()
toString
in class AbstractObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |