public class MetaObjectMap extends MetaObject implements BinarySerializable
MetaObject
that stores encapsulated objects
in a hash table.
The metric distance function for this object is the absolute value of the
differences of locatorURI hash codes.LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
|
MetaObjectMap(AbstractObjectKey objectKey,
java.util.Map<java.lang.String,LocalAbstractObject> objects)
Creates a new instance of MetaObjectMap from a collection of named objects.
|
protected |
MetaObjectMap(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObject loaded from binary input buffer.
|
|
MetaObjectMap(java.io.BufferedReader stream)
Creates a new instance of MetaObjectMap from a text stream.
|
|
MetaObjectMap(java.io.BufferedReader stream,
java.util.Set<java.lang.String> restrictNames)
Creates a new instance of MetaObjectMap from a text stream.
|
|
MetaObjectMap(java.io.BufferedReader stream,
java.lang.String[] restrictNames)
Creates a new instance of MetaObjectMap from a text stream.
|
|
MetaObjectMap(java.lang.String locatorURI,
java.util.Map<java.lang.String,LocalAbstractObject> objects)
Creates a new instance of MetaObjectMap from a collection of named objects.
|
|
MetaObjectMap(java.lang.String locatorURI,
java.util.Map<java.lang.String,LocalAbstractObject> objects,
boolean cloneObjects)
Creates a new instance of MetaObjectMap from a collection of named objects.
|
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
LocalAbstractObject |
clone(boolean cloneFilterChain)
Creates and returns a copy of this object.
|
LocalAbstractObject |
cloneRandomlyModify(java.lang.Object... args)
Creates and returns a randomly modified copy of this object.
|
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float[] metaDistances,
float distThreshold)
The actual implementation of the metric function.
|
LocalAbstractObject |
getObject(java.lang.String name)
Returns the encapsulated object for given symbolic name.
|
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.
|
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.
|
protected void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream.
|
clearSurplusData, containsObject, createMetaDistancesHolder, createSearchMetaObject, dataEquals, dataHashCode, fillMetaDistances, fillMetaDistances, getDistanceImpl, getObjectFromMap, getSize, implementationGetDistance, readObject, readObject, readObjects, readObjects, readObjectsHeader, toString, writeObjects, writeObjectsHeader
clone, create, create, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getMaxDistance, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
public MetaObjectMap(java.lang.String locatorURI, java.util.Map<java.lang.String,LocalAbstractObject> objects, boolean cloneObjects) throws java.lang.CloneNotSupportedException
cloneObjects
is requested.locatorURI
- the locator URI for this object and all the provided objects will be set as wellobjects
- collection of objects with their symbolic namescloneObjects
- if true the provided objects
will be cloned and the
the locators of the provided objects
will be replaced by the specified onejava.lang.CloneNotSupportedException
- if the cloning of the objects
was unsuccessfulpublic MetaObjectMap(AbstractObjectKey objectKey, java.util.Map<java.lang.String,LocalAbstractObject> objects)
objectKey
- the key to be associated with this objectobjects
- collection of objects with their symbolic namespublic MetaObjectMap(java.lang.String locatorURI, java.util.Map<java.lang.String,LocalAbstractObject> objects)
locatorURI
- the locator URI for this object and all the provided objects will be set as wellobjects
- collection of objects with their symbolic namespublic MetaObjectMap(java.io.BufferedReader stream, java.util.Set<java.lang.String> restrictNames) throws java.io.IOException
restrictNames
are added.stream
- the text stream to read an object fromrestrictNames
- if not null only the names specified in this collection are added to the objects tablejava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectMap(java.io.BufferedReader stream, java.lang.String[] restrictNames) throws java.io.IOException
restrictNames
are added.stream
- the text stream to read an object fromrestrictNames
- if not null only the names specified in this collection are added to the objects tablejava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectMap(java.io.BufferedReader stream) throws java.io.IOException
stream
- the text stream to read an object fromjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.protected MetaObjectMap(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the buffer to read the MetaObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferpublic LocalAbstractObject clone(boolean cloneFilterChain) throws java.lang.CloneNotSupportedException
clone
in class LocalAbstractObject
cloneFilterChain
- the flag whether the filter chain must be cloned as well.java.lang.CloneNotSupportedException
- if the object's class does not support cloning or there was an errorpublic LocalAbstractObject cloneRandomlyModify(java.lang.Object... args) throws java.lang.CloneNotSupportedException
cloneRandomlyModify
in class LocalAbstractObject
args
- any parameters required by the subclass implementation - usually two objects with
the minimal and the maximal possible valuesjava.lang.CloneNotSupportedException
- if the object's class does not support cloning or there was an errorprotected void writeData(java.io.OutputStream stream) throws java.io.IOException
LocalAbstractObject
writeData
in class LocalAbstractObject
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streampublic java.util.Map<java.lang.String,LocalAbstractObject> getObjectMap()
MetaObject
getObjectMap
in class MetaObject
public LocalAbstractObject getObject(java.lang.String name)
MetaObject
getObject
in class MetaObject
name
- the symbolic name of the object to returnpublic java.util.Collection<java.lang.String> getObjectNames()
MetaObject
getObjectNames
in class MetaObject
public java.util.Collection<LocalAbstractObject> getObjects()
MetaObject
getObjects
in class MetaObject
public int getObjectCount()
MetaObject
getObjectCount
in class MetaObject
protected float getDistanceImpl(LocalAbstractObject obj, float[] metaDistances, float distThreshold)
obj
.
The array metaDistances
is ignored.getDistanceImpl
in class MetaObject
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 distanceLocalAbstractObject.getDistance
public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
LocalAbstractObject
output
.binarySerialize
in interface BinarySerializable
binarySerialize
in class LocalAbstractObject
output
- the output that this object is binary-serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serializationpublic int getBinarySize(BinarySerializator serializator)
LocalAbstractObject
getBinarySize
in interface BinarySerializable
getBinarySize
in class LocalAbstractObject
serializator
- the serializator used to write objects