public class MetaObjectParametricMap extends MetaObjectParametric implements BinarySerializable
MetaObjectParametric
that stores encapsulated
LocalAbstractObject
s in a map under their symbolic names (strings).
The metric distance function for this object is defined as a binary function returning
0
for identical objects (as of equals
on object's locator) and
1
for different objects.LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,LocalAbstractObject> |
objects
List of encapsulated objects
|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
protected |
MetaObjectParametricMap(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObject loaded from binary input buffer.
|
|
MetaObjectParametricMap(java.io.BufferedReader stream)
Creates a new instance of MetaObjectParametricMap from a text stream.
|
|
MetaObjectParametricMap(java.io.BufferedReader stream,
java.util.Set<java.lang.String> restrictNames)
Creates a new instance of MetaObjectParametricMap from a text stream.
|
|
MetaObjectParametricMap(java.io.BufferedReader stream,
java.util.Set<java.lang.String> restrictNames,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters)
Creates a new instance of MetaObjectParametricMap from a text stream.
|
|
MetaObjectParametricMap(java.io.BufferedReader stream,
java.lang.String[] restrictNames)
Creates a new instance of MetaObjectParametricMap from a text stream.
|
|
MetaObjectParametricMap(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,LocalAbstractObject> objects)
Creates a new instance of MetaObjectParametricMap from a collection of named objects.
|
|
MetaObjectParametricMap(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,LocalAbstractObject> objects)
Creates a new instance of MetaObjectParametricMap from a collection of named objects.
|
|
MetaObjectParametricMap(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,LocalAbstractObject> objects,
boolean cloneObjects)
Creates a new instance of MetaObjectParametricMap 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 |
writeDataImpl(java.io.OutputStream stream)
Store this object's data to a text stream.
|
clearSurplusData, containsParameter, getParameter, getParameter, getParameter, getParameterCount, getParameterMap, getParameterNames, getRequiredParameter, getRequiredParameter, parseObjectComment, removeParameter, setParameter, writeData
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, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
protected java.util.Map<java.lang.String,LocalAbstractObject> objects
public MetaObjectParametricMap(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.util.Map<java.lang.String,LocalAbstractObject> objects)
additionalParameters
- additional parameters for this meta objectobjects
- collection of objects with their symbolic namespublic MetaObjectParametricMap(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, 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 welladditionalParameters
- additional parameters for this meta objectobjects
- 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 MetaObjectParametricMap(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.util.Map<java.lang.String,LocalAbstractObject> objects)
locatorURI
- the locator URI for this object and all the provided objects will be set as welladditionalParameters
- additional parameters for this meta objectobjects
- collection of objects with their symbolic namespublic MetaObjectParametricMap(java.io.BufferedReader stream, java.util.Set<java.lang.String> restrictNames, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters) throws java.io.IOException
restrictNames
are added.
Parameters are set to the given map.stream
- the text stream to read an object fromrestrictNames
- if not null only the names specified in this collection are added to the objects tableadditionalParameters
- additional parameters for this meta objectjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectParametricMap(java.io.BufferedReader stream, java.util.Set<java.lang.String> restrictNames) throws java.io.IOException
restrictNames
are added.
Note that no additional parameters are set.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 MetaObjectParametricMap(java.io.BufferedReader stream, java.lang.String[] restrictNames) throws java.io.IOException
restrictNames
are added.
Note that no additional parameters are set.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 MetaObjectParametricMap(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 MetaObjectParametricMap(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 writeDataImpl(java.io.OutputStream stream) throws java.io.IOException
MetaObjectParametric
writeDataImpl
in class MetaObjectParametric
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()
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
and
returns 0
when locators are equal and 1
otherwise.
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(messif.objects.LocalAbstractObject)
public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
MetaObjectParametric
output
.binarySerialize
in interface BinarySerializable
binarySerialize
in class MetaObjectParametric
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)
MetaObjectParametric
getBinarySize
in interface BinarySerializable
getBinarySize
in class MetaObjectParametric
serializator
- the serializator used to write objects