public abstract class MetaObjectFixed extends MetaObject
MetaObject
that stores a fixed list of
encapsulated objects.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 |
---|---|
protected |
MetaObjectFixed()
Creates a new instance of MetaObjectFixed.
|
protected |
MetaObjectFixed(AbstractObjectKey objectKey)
Creates a new instance of MetaObjectFixed.
|
protected |
MetaObjectFixed(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectFixed loaded from binary input.
|
protected |
MetaObjectFixed(java.lang.String locatorURI)
Creates a new instance of MetaObjectFixed.
|
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 abstract LocalAbstractObject |
getObject(int index)
Returns the fixed object with the 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 abstract 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.
|
protected abstract int |
getObjectNamesCount()
Returns the fixed number of the potential encapsulated objects.
|
java.util.Collection<LocalAbstractObject> |
getObjects()
Returns a collection of all the encapsulated objects.
|
protected static LocalAbstractObject[] |
readObjects(java.io.BufferedReader stream,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Utility method for reading objects from a text stream.
|
protected LocalAbstractObject[] |
readObjectsBinary(BinaryInput input,
BinarySerializator serializator,
java.lang.Class<? extends LocalAbstractObject>[] classes)
Reads encapsulated objects from the binary input buffer.
|
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, 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, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
protected MetaObjectFixed()
protected MetaObjectFixed(AbstractObjectKey objectKey)
objectKey
- the key to be associated with this objectprotected MetaObjectFixed(java.lang.String locatorURI)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectprotected MetaObjectFixed(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 bufferreadObjectsBinary(messif.objects.nio.BinaryInput, messif.objects.nio.BinarySerializator, java.lang.Class<? extends messif.objects.LocalAbstractObject>[])
protected abstract int getObjectNamesCount()
protected abstract java.lang.String getObjectName(int index)
index
.index
- the fixed index of the object the name of which to getindex
th objectprotected abstract LocalAbstractObject getObject(int index)
index
.index
- the fixed index of the object 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 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 static LocalAbstractObject[] readObjects(java.io.BufferedReader stream, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
BufferedReader
constructor.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.protected 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 streamprotected final LocalAbstractObject[] readObjectsBinary(BinaryInput input, BinarySerializator serializator, java.lang.Class<? extends LocalAbstractObject>[] classes) throws java.io.IOException
input
- the buffer to read the encapsulated objects fromserializator
- the serializator used to write objectsclasses
- the classes of the objects to read from the binary inputjava.io.IOException
- if there was an I/O error reading from the bufferpublic int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
LocalAbstractObject
output
.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 class LocalAbstractObject
serializator
- the serializator used to write objects