public abstract class ObjectFeatureSet extends LocalAbstractObject implements BinarySerializable, java.lang.Iterable<ObjectFeature>, Parametric, StringDataProvider
All the encapsulated objects share the same locator URI.
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ObjectFeature> |
objects
List of encapsulated objects
|
static java.lang.String |
QUANTIZED_FEATURES_SPLIT_CHARACTER |
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
|
ObjectFeatureSet()
Creates a new instance of ObjectFeatureSet with empty list of objects.
|
protected |
ObjectFeatureSet(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of ObjectFeatureSet loaded from binary input.
|
|
ObjectFeatureSet(java.io.BufferedReader stream)
Creates a new instance of ObjectFeatureSet from a text stream.
|
|
ObjectFeatureSet(java.io.BufferedReader stream,
java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters)
Creates a new instance of ObjectFeatureSet from a text stream.
|
|
ObjectFeatureSet(ObjectFeatureSet superSet) |
|
ObjectFeatureSet(ObjectFeatureSet supSet,
float minX,
float maxX,
float minY,
float maxY)
Creates a new instance of ObjectFeatureSet as a subset of an existing ObjectFeatureSet.
|
|
ObjectFeatureSet(java.lang.String locatorURI,
java.util.Collection<? extends ObjectFeature> objects)
Creates a new instance of ObjectFeatureSet for the given locatorURI and encapsulated objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(ObjectFeature obj)
Adds the object to the internal list of objects (to the end of the list)
|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
void |
clearSurplusData()
Clear non-messif data stored in this object and all its subobjects.
|
LocalAbstractObject |
clone(boolean cloneFilterChain)
Creates and returns a copy of this object.
|
ObjectFeatureSet |
clone(float minX,
float minY,
float maxX,
float maxY)
Creates and returns a copy of this object with the feature filtered with the passed region limits.
|
LocalAbstractObject |
cloneRandomlyModify(java.lang.Object... args)
Creates and returns a randomly modified copy of this object.
|
boolean |
containsParameter(java.lang.String name)
Returns whether a parameter with the given
name exists in this parametric object. |
boolean |
dataEquals(java.lang.Object obj)
Indicates whether some other object has the same data as this one.
|
int |
dataHashCode()
Returns sum of hash code values for all the encapsulated objects data.
|
void |
filterFeatures(float minX,
float minY,
float maxX,
float maxY)
Deletes the features that are not within the passed bounds from this feature set.
|
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
LocalAbstractObject |
getObject(int index)
Returns the encapsulated object for given index.
|
int |
getObjectCount()
Returns the number of encapsulated objects.
|
java.lang.Object |
getParameter(java.lang.String name)
Returns an additional parameter with the given
name . |
<T> T |
getParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass)
Returns an additional parameter with the given
name . |
<T> T |
getParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass,
T defaultValue)
Returns an additional parameter with the given
name . |
int |
getParameterCount()
Returns the number of additional parameters.
|
java.util.Map<java.lang.String,? extends java.lang.Object> |
getParameterMap()
Returns the map of all additional parameters.
|
java.util.Collection<java.lang.String> |
getParameterNames()
Returns a set of additional parameter names present in this object.
|
java.lang.Object |
getRequiredParameter(java.lang.String name)
Returns an additional parameter with the given
name . |
<T> T |
getRequiredParameter(java.lang.String name,
java.lang.Class<? extends T> parameterClass)
Returns an additional parameter with the given
name . |
protected java.lang.String |
getSaveObjectsClass()
Returns the class of the encapsulated objects.
|
int |
getSize()
Returns the size of this object in bytes.
|
java.lang.String |
getStringData()
Returns the textual data provided by this object.
|
java.util.Iterator<ObjectFeature> |
iterator()
Returns iterator over all features.
|
protected <E> E |
readObject(java.io.BufferedReader stream,
java.lang.Class<E> objectClass)
Reads one object with the specified class name from the stream.
|
protected LocalAbstractObject |
readObject(java.io.BufferedReader stream,
java.lang.String className)
Reads one object with the specified class name from the stream.
|
java.lang.String |
toString()
Returns a string representation of this ObjectFeatureSet.
|
void |
writeData(java.io.OutputStream stream)
Store this object to a text stream.
|
clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceImpl, 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 java.util.List<ObjectFeature> objects
public static final java.lang.String QUANTIZED_FEATURES_SPLIT_CHARACTER
public ObjectFeatureSet()
public ObjectFeatureSet(java.lang.String locatorURI, java.util.Collection<? extends ObjectFeature> objects)
locatorURI
- the locator URI for the new objectobjects
- the list of objects to encapsulate in this objectpublic ObjectFeatureSet(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.public ObjectFeatureSet(java.io.BufferedReader stream, java.util.Map<java.lang.String,? extends java.io.Serializable> additionalParameters) throws java.io.IOException
stream
- the text stream to read an object fromadditionalParameters
- 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 ObjectFeatureSet(ObjectFeatureSet supSet, float minX, float maxX, float minY, float maxY)
supSet
- original set of features (super-set)minX
- minimal X-coordinate to be included in the resulting subsetmaxX
- maximal X-coordinate to be included in the resulting subsetminY
- minimal Y-coordinate to be included in the resulting subsetmaxY
- maximal Y-coordinate to be included in the resulting subsetpublic ObjectFeatureSet(ObjectFeatureSet superSet)
protected ObjectFeatureSet(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the ObjectFeatureSet fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferpublic LocalAbstractObject cloneRandomlyModify(java.lang.Object... args) throws java.lang.CloneNotSupportedException
LocalAbstractObject
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 errorpublic LocalAbstractObject getObject(int index)
index
- the index to the object array of the object to returnpublic java.util.Iterator<ObjectFeature> iterator()
iterator
in interface java.lang.Iterable<ObjectFeature>
public int getObjectCount()
protected java.lang.String getSaveObjectsClass()
public void addObject(ObjectFeature obj)
obj
- Object to be addedpublic int getParameterCount()
Parametric
getParameterCount
in interface Parametric
public java.util.Collection<java.lang.String> getParameterNames()
Parametric
getParameterNames
in interface Parametric
public boolean containsParameter(java.lang.String name)
Parametric
name
exists in this parametric object.containsParameter
in interface Parametric
name
- the name of the additional parameter to getname
or false if it does notpublic java.lang.Object getParameter(java.lang.String name)
Parametric
name
.getParameter
in interface Parametric
name
- the name of the additional parameter to getname
or null if it is not setpublic java.lang.Object getRequiredParameter(java.lang.String name) throws java.lang.IllegalArgumentException
Parametric
name
.
If the parameter with the given name
is not set, an exception is thrown.getRequiredParameter
in interface Parametric
name
- the name of the additional parameter to getname
java.lang.IllegalArgumentException
- if the parameter with the given name
is not setpublic <T> T getRequiredParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass) throws java.lang.IllegalArgumentException, java.lang.ClassCastException
Parametric
name
.
If the parameter with the given name
is not set or is not an
instance of parameterClass
, an exception is thrown.getRequiredParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getjava.lang.IllegalArgumentException
- if the parameter with the given name
is not setjava.lang.ClassCastException
- if the parameter with the given name
is not an instance of parameterClass
public <T> T getParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass, T defaultValue)
Parametric
name
.
If the parameter is not set or is not an instance of parameterClass
,
the defaultValue
is returned instead.getParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getdefaultValue
- the default value to use if the parameter is nullpublic <T> T getParameter(java.lang.String name, java.lang.Class<? extends T> parameterClass)
Parametric
name
.
If the parameter name
exists but it is not an instance of
parameterClass
, null is returned.getParameter
in interface Parametric
T
- the class of the parametername
- the name of the additional parameter to getparameterClass
- the class of the parameter to getname
or null if it is not setpublic java.util.Map<java.lang.String,? extends java.lang.Object> getParameterMap()
Parametric
getParameterMap
in interface Parametric
protected LocalAbstractObject readObject(java.io.BufferedReader stream, java.lang.String className) throws java.io.IOException
LocalAbstractObject
.
Then, a constructor with BufferedReader
argument is used to load the object up.stream
- the text stream to read the object fromclassName
- the name of the class for the objectjava.io.IOException
- if there was an error resolving the specified class or its constructor or a problem
occurred while reading from the streamprotected <E> E readObject(java.io.BufferedReader stream, java.lang.Class<E> objectClass) throws java.io.IOException
LocalAbstractObject
.
Then, a constructor with BufferedReader
argument is used to load the object up.E
- the class of the object that is read from the streamstream
- the text stream to read the object fromobjectClass
- the class of the object that is read from the streamjava.io.IOException
- if there was an error resolving the specified class or its constructor or a problem
occurred while reading from the streampublic void writeData(java.io.OutputStream stream) throws java.io.IOException
writeData
in class LocalAbstractObject
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streampublic boolean dataEquals(java.lang.Object obj)
dataEquals
in class LocalAbstractObject
obj
- the reference object with which to compare (if it is not ObjectFeatureSet, this method will return false
)true
if this object is the same as the obj
argument; false
otherwise.public int dataHashCode()
dataHashCode
in class LocalAbstractObject
public int getSize()
getSize
in class LocalAbstractObject
public void clearSurplusData()
clearSurplusData
in interface Clearable
clearSurplusData
in class LocalAbstractObject
public java.lang.String toString()
toString
in class AbstractObject
public java.lang.String getStringData()
StringDataProvider
getStringData
in interface StringDataProvider
public void filterFeatures(float minX, float minY, float maxX, float maxY)
minX
- relative limit [0;1]minY
- relative limit [0;1]maxX
- relative limit [0;1]maxY
- relative limit [0;1]public final ObjectFeatureSet clone(float minX, float minY, float maxX, float maxY) throws java.lang.CloneNotSupportedException
minX
- min on X axis (relative value - [0;1])minY
- min on Y axis (relative value - [0;1])maxX
- max on X axis (relative value - [0;1])maxY
- max on Y axis (relative value - [0;1])java.lang.CloneNotSupportedException
- if the object's class does not support cloning or there was an errorpublic LocalAbstractObject clone(boolean cloneFilterChain) throws java.lang.CloneNotSupportedException
clone
in class LocalAbstractObject
cloneFilterChain
- the flag whether the filter chain should be cloned as welljava.lang.CloneNotSupportedException
- if the object's class does not support cloning or there was an errorpublic 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