public class MetaObjectParametricArray extends MetaObjectParametric implements BinarySerializable
MetaObject
that stores a fixed array of encapsulated objects
with additional parameters
.
The metric distance function for this object is the absolute value of the
differences of locatorURI hash codes. For a more sophisticated distance function
use MetaObjectArrayWeightedSum
.
Note that the encapsulated object names are automatically generated by
getObjectName(int)
method. Normally, this method is overloaded
in a subclass to provide more appropriate names.
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
protected LocalAbstractObject[] |
objects
List of objects
|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
|
MetaObjectParametricArray(AbstractObjectKey objectKey,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectArray.
|
|
MetaObjectParametricArray(AbstractObjectKey objectKey,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String... objectNames)
Creates a new instance of MetaObjectArray that takes the objects from the given map.
|
protected |
MetaObjectParametricArray(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectFixed loaded from binary input.
|
|
MetaObjectParametricArray(java.io.BufferedReader stream)
Creates a new instance of MetaObjectArray from the given text stream with header.
|
|
MetaObjectParametricArray(java.io.BufferedReader stream,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectArray from the given text stream.
|
|
MetaObjectParametricArray(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
boolean readEmptyClassLine,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectArray from the given text stream.
|
|
MetaObjectParametricArray(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Creates a new instance of MetaObjectArray from the given text stream.
|
|
MetaObjectParametricArray(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
int objectCount,
java.lang.Class<? extends LocalAbstractObject> objectClass)
Creates a new instance of MetaObjectArray from the given text stream.
|
|
MetaObjectParametricArray(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectArray.
|
|
MetaObjectParametricArray(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Collection<? extends LocalAbstractObject> objects)
Creates a new instance of MetaObjectArray that takes the objects from the given collection.
|
|
MetaObjectParametricArray(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
LocalAbstractObject... objects)
Creates a new instance of MetaObjectArray.
|
|
MetaObjectParametricArray(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String... objectNames)
Creates a new instance of MetaObjectArray that takes the objects from the given map.
|
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
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(int index)
Returns the encapsulated object for given index.
|
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.
|
protected java.lang.String |
getObjectName(int index)
Returns the name of the fixed object with the given
index . |
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, clone, cloneRandomlyModify, 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 final LocalAbstractObject[] objects
public MetaObjectParametricArray(java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
additionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArray(AbstractObjectKey objectKey, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
objectKey
- the key to be associated with this objectadditionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArray(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, LocalAbstractObject... objects)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectadditionalParameters
- additional parameters for this meta objectobjects
- the encapsulated list of objectspublic MetaObjectParametricArray(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.util.Collection<? extends LocalAbstractObject> objects)
AbstractObjectKey
is
generated for the specified locatorURI
.locatorURI
- the locator URI for the new objectadditionalParameters
- additional parameters for this meta objectobjects
- the collection with objects to encapsulatepublic MetaObjectParametricArray(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.util.Map<java.lang.String,? extends LocalAbstractObject> objects, java.lang.String... objectNames)
objectNames
array. Note that if the object of a given
name is not in the map, null is inserted into the array.
A new unique object ID is generated and a new AbstractObjectKey
is
generated for the specified locatorURI
.locatorURI
- the locator URI for the new objectadditionalParameters
- additional parameters for this meta objectobjects
- the map with named objects to encapsulateobjectNames
- the names of the objects to take from the given objects
mappublic MetaObjectParametricArray(AbstractObjectKey objectKey, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.util.Map<java.lang.String,? extends LocalAbstractObject> objects, java.lang.String... objectNames)
objectNames
array. Note that if the object of a given
name is not in the map, null is inserted into the array.
A new unique object ID is generated and the given objectKey
is used for the object.objectKey
- the key to be associated with this objectadditionalParameters
- additional parameters for this meta objectobjects
- the map with named objects to encapsulateobjectNames
- the names of the objects to take from the given objects
mappublic MetaObjectParametricArray(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
stream
- the text stream to read the objects fromadditionalParameters
- additional parameters for this meta objectclasses
- the classes of the objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectParametricArray(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, boolean readEmptyClassLine, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
stream
- the text stream to read the objects fromadditionalParameters
- additional parameters for this meta objectreadEmptyClassLine
- flag whether to read a single line (that is ignored)
for a null class inside the classes array
classes
- the classes of the objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectParametricArray(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters, int objectCount, java.lang.Class<? extends LocalAbstractObject> objectClass) throws java.io.IOException
stream
- the text stream to read the objects fromadditionalParameters
- additional parameters for this meta objectobjectCount
- number of objects to readobjectClass
- the class of objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectParametricArray(java.io.BufferedReader stream, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
stream
- the text stream to read the objects fromclasses
- the classes of the objects to read from the streamjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.public MetaObjectParametricArray(java.io.BufferedReader stream) throws java.io.IOException
stream
- the text stream to read the objects fromjava.io.IOException
- when an error appears during reading from given stream,
EOFException is returned if end of the given stream is reached.MetaObject.readObjectsHeader(java.io.BufferedReader)
protected MetaObjectParametricArray(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the MetaObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferprotected java.lang.String getObjectName(int index)
index
.
By default, this implementation returns "ObjectX" where X is the given
index
. However, this method should be overridden to give
the real name of the object if appropriate (e.g. from a static array of names).index
- the fixed index of the object the name of which to getindex
th objectpublic int getObjectCount()
MetaObject
getObjectCount
in class MetaObject
public LocalAbstractObject getObject(java.lang.String name)
MetaObject
getObject
in class MetaObject
name
- the symbolic name of the object to returnpublic LocalAbstractObject getObject(int index)
index
- the index of the object to returnjava.lang.IndexOutOfBoundsException
- if the given index is not within [0;count
) intervalpublic java.util.Collection<java.lang.String> getObjectNames()
MetaObject
getObjectNames
in class MetaObject
public java.util.Collection<LocalAbstractObject> getObjects()
MetaObject
getObjects
in class MetaObject
public java.util.Map<java.lang.String,LocalAbstractObject> getObjectMap()
MetaObject
getObjectMap
in class MetaObject
protected 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 streamprotected 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
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