|
||||||||||
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
messif.objects.impl.MetaObjectMap
public class MetaObjectMap
Implementation of 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 hashcodes.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class messif.objects.LocalAbstractObject |
---|
LocalAbstractObject.DataEqualObject |
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,LocalAbstractObject> |
objects
List of encapsulated objects |
Fields inherited from class messif.objects.LocalAbstractObject |
---|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, UNKNOWN_DISTANCE |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
static MetaObjectMap |
create(java.io.File file)
Creates a meta object from the specified file. |
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 |
readObjects(java.io.BufferedReader stream,
java.util.Collection<java.lang.String> restrictNames)
Fills this instance of MetaObject from a text stream. |
protected void |
writeData(java.io.OutputStream stream)
Store this object to a text stream. |
Methods inherited from class messif.objects.MetaObject |
---|
clearSurplusData, containsObject, createMetaDistancesHolder, createSearchMetaObject, dataEquals, dataHashCode, fillMetaDistances, fillMetaDistances, getDistanceImpl, getSize, readObject, readObject, toString |
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 |
Field Detail |
---|
protected java.util.Map<java.lang.String,LocalAbstractObject> objects
Constructor Detail |
---|
public MetaObjectMap(java.lang.String locatorURI, java.util.Map<java.lang.String,LocalAbstractObject> objects, boolean cloneObjects) throws java.lang.CloneNotSupportedException
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, otherwise the
the locators of the provided objects
will be replaced by the specified one
java.lang.CloneNotSupportedException
- if the clonning of the objects
was unsuccessfulpublic 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 table
java.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 table
java.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 from
java.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 objects
java.io.IOException
- if there was an I/O error reading from the bufferMethod Detail |
---|
public static MetaObjectMap create(java.io.File file) throws java.io.IOException
BufferedReader
is used.
file
- the file to create the object from
java.io.IOException
- if there was an error reading from the specified filepublic LocalAbstractObject clone(boolean cloneFilterChain) throws java.lang.CloneNotSupportedException
clone
in class LocalAbstractObject
cloneFilterChain
- the flag wheter the filter chain must be cloned as well.
java.lang.CloneNotSupportedException
- if the object's class does not support clonning 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 miminal and the maximal possible values
java.lang.CloneNotSupportedException
- if the object's class does not support clonning or there was an errorprotected void readObjects(java.io.BufferedReader stream, java.util.Collection<java.lang.String> restrictNames) throws java.io.IOException
stream
- the text stream to read the objects fromrestrictNames
- if not null only the names specified in this collection are added to the objects table
java.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
writeData
in class LocalAbstractObject
stream
- the stream to store this object to
java.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 return
public 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
's locator hash-codes.
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 distance
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
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 objects
java.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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |