public abstract class LocalAbstractObject extends AbstractObject
getDistanceImpl(messif.objects.LocalAbstractObject, float)
for its own data.
To be able to read/write data from text streams, a constructor with one BufferedReader
argument
should be implemented to parse object data from a line of text. A dual operation should be implemented as the
write(java.io.OutputStream)
method.
Each object can hold an additional data in its suppData
attribute. However, no management is guaranteed
inside MESSIF, thus, if several algorithms that use supplemental data are combined, unpredictable results might
appear. This attribute is never modified inside MESSIF itself apart from the clearSurplusData()
method that
sets it to null.AbstractObject
,
NoDataObject
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
LocalAbstractObject.DataEqualObject
A wrapper class that allows to hash/equal abstract objects
using their data and not ID.
|
static class |
LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>
Provides a factory for creating instances of T from a given
text stream . |
static class |
LocalAbstractObject.TrivialDistanceFunction
Implementation of a simple trivial distance function.
|
Modifier and Type | Field and Description |
---|---|
protected static StatisticCounter |
counterDistanceComputations
Global counter for distance computations (any purpose)
|
protected static StatisticCounter |
counterLowerBoundDistanceComputations
Global counter for lower-bound distance computations (any purpose)
|
protected static StatisticCounter |
counterPrecomputedDistanceSavings
Global counter for saving distance computations by using precomputed
|
protected static StatisticCounter |
counterUpperBoundDistanceComputations
Global counter for upper-bound distance computations (any purpose)
|
static float |
MAX_DISTANCE
Maximal possible distance constant
|
static float |
MIN_DISTANCE
Minimal possible distance constant
|
java.lang.Object |
suppData
Supplemental data object
|
static DistanceFunction<LocalAbstractObject> |
trivialDistanceFunction
Trivial distance function that for any
LocalAbstractObject returns
the call to getDistance(messif.objects.LocalAbstractObject) method |
static float |
UNKNOWN_DISTANCE
Unknown distance constant
|
Modifier | Constructor and Description |
---|---|
protected |
LocalAbstractObject()
Creates a new instance of LocalAbstractObject.
|
protected |
LocalAbstractObject(AbstractObjectKey objectKey)
Creates a new instance of LocalAbstractObject.
|
protected |
LocalAbstractObject(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of LocalAbstractObject loaded from binary input.
|
protected |
LocalAbstractObject(java.lang.String locatorURI)
Creates a new instance of LocalAbstractObject.
|
Modifier and Type | Method and Description |
---|---|
protected int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
void |
clearSurplusData()
Clear non-MESSIF data stored in this object.
|
LocalAbstractObject |
clone()
Creates and returns a copy of this object.
|
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 <E extends LocalAbstractObject> |
create(java.lang.Class<E> objectClass,
java.lang.String objectData,
java.lang.Object... additionalArguments)
Creates a new LocalAbstractObject of the specified type from string.
|
static <T extends LocalAbstractObject> |
create(java.lang.Class<T> objectClass,
java.io.BufferedReader dataReader,
java.lang.Object... additionalArguments)
Creates a new instance of
objectClass from the dataReader . |
float[] |
createMetaDistancesHolder()
Returns the array that can hold distances to the respective encapsulated objects.
|
abstract boolean |
dataEquals(java.lang.Object obj)
Indicates whether some other object has the same data as this one.
|
abstract int |
dataHashCode()
Returns a hash code value for the data of this object.
|
boolean |
excludeUsingPrecompDist(LocalAbstractObject obj,
float radius)
Returns true if the
obj has been excluded (filtered out) using stored precomputed distance. |
protected int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
float |
getDistance(LocalAbstractObject obj)
Metric distance function.
|
float |
getDistance(LocalAbstractObject obj,
float distThreshold)
Metric distance function.
|
float |
getDistance(LocalAbstractObject obj,
float[] metaDistances,
float distThreshold)
Metric distance function.
|
<T extends PrecomputedDistancesFilter> |
getDistanceFilter(java.lang.Class<T> filterClass)
Returns a filter of the specified class (or any of its descendants) from this object's filter chain.
|
<T extends PrecomputedDistancesFilter> |
getDistanceFilter(java.lang.Class<T> filterClass,
boolean inheritable)
Returns a filter of the specified class from this object's filter chain.
|
PrecomputedDistancesFilter |
getDistanceFilter(int position)
Returns a filter at specified position in this object's filter chain.
|
<T extends PrecomputedDistancesFilter> |
getDistanceFilter(PrecomputedDistancesFilterFactory<? extends T> filterFactory)
Returns a filter of the
filterFactory 's class from this object's filter chain. |
protected abstract float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
The actual implementation of the metric function (see
getDistance(messif.objects.LocalAbstractObject) for full explanation). |
float |
getDistanceLowerBound(LocalAbstractObject obj,
int accuracy)
Returns the lower bound of a metric distance.
|
protected float |
getDistanceLowerBoundImpl(LocalAbstractObject obj,
int accuracy)
Implementation that actually computes the lower bound on the metric distance.
|
float |
getDistanceStorePrecomputed(LocalAbstractObject obj,
PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory)
Metric distance function that stores the resulting distance into a
PrecomputedDistancesFilter . |
float |
getDistanceStorePrecomputed(LocalAbstractObject obj,
PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory,
float distThreshold)
Metric distance function that stores the resulting distance into a
PrecomputedDistancesFilter . |
float |
getDistanceStorePrecomputed(LocalAbstractObject obj,
PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory,
float[] metaDistances,
float distThreshold)
Metric distance function that stores the resulting distance into a
PrecomputedDistancesFilter . |
float |
getDistanceUpperBound(LocalAbstractObject obj,
int accuracy)
Returns the upper bound of a metric distance.
|
protected float |
getDistanceUpperBoundImpl(LocalAbstractObject obj,
int accuracy)
Implementation that actually computes the upper bound on the metric distance.
|
protected static java.lang.reflect.Field[] |
getFieldsForNames(java.lang.Class<? extends LocalAbstractObject> forClass,
java.lang.String... fieldName)
Returns a list of fields of the specified class that match the provided names.
|
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
float |
getNormDistance(LocalAbstractObject obj,
float distThreshold)
Normalized metric distance function, i.e. the result of
getDistance(messif.objects.LocalAbstractObject)
divided by getMaxDistance() . |
float |
getPrecomputedDistance(LocalAbstractObject obj)
Returns the precomputed distance to an object.
|
float |
getPrecomputedDistance(LocalAbstractObject obj,
float[] metaDistances)
Returns the precomputed distance to an object.
|
protected static char |
getRandomChar()
Returns a pseudorandom character.
|
protected static double |
getRandomNormal()
Returns a pseudorandom number.
|
abstract int |
getSize()
Returns the size of this object in bytes.
|
void |
chainDestroy()
Destroys whole filter chain of this object.
|
PrecomputedDistancesFilter |
chainFilter(PrecomputedDistancesFilter filter,
boolean replaceIfExists)
Adds the specified filter to the end of this object's filter chain.
|
boolean |
includeUsingPrecompDist(LocalAbstractObject obj,
float radius)
Returns true if the
obj has been included using stored precomputed distance. |
boolean |
isDistanceCompatible(LocalAbstractObject o)
Returns whether the given object is distance compatible with the
distance function of this object.
|
protected boolean |
parseObjectComment(java.lang.String line)
Processes a comment line of text representation of the object.
|
protected static char |
peekNextChar(java.io.BufferedReader reader)
Looks at the next character in the given reader without changing the position.
|
static void |
readAttributesFromStream(java.lang.String line,
java.lang.String attributesRegexp,
java.lang.String arrayItemsRegexp,
LocalAbstractObject dataObject,
java.lang.reflect.Field... dataFields)
Helper method for reading object primitive/array attributes from a text stream.
|
protected java.lang.String |
readObjectComments(java.io.BufferedReader reader)
Processes all the comment lines of text representation of the object.
|
protected void |
readObjectCommentsWithoutData(java.io.BufferedReader reader)
Processes all the comment lines of text representation of the object.
|
boolean |
unchainFilter(PrecomputedDistancesFilter filter)
Deletes the specified filter from this object's filter chain.
|
void |
write(java.io.OutputStream stream)
Writes the object comments and data - key and filters - into an output text stream.
|
void |
write(java.io.OutputStream stream,
boolean writeComments)
Writes the object comments and data - key and filters - into an output text stream.
|
static void |
writeAttributesToStream(java.io.OutputStream stream,
char attributesSeparator,
char arrayItemsSeparator,
LocalAbstractObject dataObject,
java.lang.reflect.Field... dataFields)
Helper method for writing object primitive/array attributes to a text stream.
|
protected abstract void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream.
|
protected void |
writeObjectComment(java.io.OutputStream stream)
Write comment lines of text representation of this object.
|
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey, toString
public java.lang.Object suppData
protected static final StatisticCounter counterDistanceComputations
protected static final StatisticCounter counterLowerBoundDistanceComputations
protected static final StatisticCounter counterUpperBoundDistanceComputations
protected static final StatisticCounter counterPrecomputedDistanceSavings
public static final DistanceFunction<LocalAbstractObject> trivialDistanceFunction
LocalAbstractObject
returns
the call to getDistance(messif.objects.LocalAbstractObject)
methodpublic static final float UNKNOWN_DISTANCE
public static final float MIN_DISTANCE
public static final float MAX_DISTANCE
protected LocalAbstractObject()
protected LocalAbstractObject(AbstractObjectKey objectKey)
objectKey
- the key to be associated with this objectprotected LocalAbstractObject(java.lang.String locatorURI)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectprotected LocalAbstractObject(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the LocalAbstractObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the inputpublic final float getDistance(LocalAbstractObject obj)
obj
- the object for which to measure the distanceobj
public final float getDistance(LocalAbstractObject obj, float distThreshold)
obj
- the object to compute distance todistThreshold
- the threshold value on the distance (the query radius from the example above)public final float getDistance(LocalAbstractObject obj, float[] metaDistances, float distThreshold)
obj
.
The array metaDistances
is filled with the distances
of the respective encapsulated objects if this object contains any, i.e.
this object is a descendant of 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 distancepublic final float getDistanceStorePrecomputed(LocalAbstractObject obj, PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory)
PrecomputedDistancesFilter
.
Measures the distance between this object and obj
.
If the distance to the object was already precomputed, it is returned.
If not, it is computed (using getDistanceImpl
method.
Then, if the filterFactory
is not null, the filter with
the given filterFactory
's class is retrieved from the object or
created by the factory if it does not exist. In that filter instance, the
computed distance is added using PrecomputedDistancesFilter.addPrecomputedDistance(messif.objects.LocalAbstractObject, float, float[])
.
obj
- the object to compute distance tofilterFactory
- the factory used to create a precomputed-distances filter (the class of the created filter is used to search the object first)public final float getDistanceStorePrecomputed(LocalAbstractObject obj, PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory, float distThreshold)
PrecomputedDistancesFilter
.
Measures the distance between this object and obj
.
If the distance to the object was already precomputed, it is returned.
If not, it is computed (using getDistanceImpl
method.
Then, if the filterFactory
is not null, the filter with
the given filterFactory
's class is retrieved from the object or
created by the factory if it does not exist. In that filter instance, the
computed distance is added using PrecomputedDistancesFilter.addPrecomputedDistance(messif.objects.LocalAbstractObject, float, float[])
.
obj
- the object to compute distance tofilterFactory
- the factory used to create a precomputed-distances filter (the class of the created filter is used to search the object first)distThreshold
- the threshold value on the distancepublic final float getDistanceStorePrecomputed(LocalAbstractObject obj, PrecomputedDistancesFilterFactory<? extends PrecomputedDistancesFilter> filterFactory, float[] metaDistances, float distThreshold)
PrecomputedDistancesFilter
.
Measures the distance between this object and obj
.
The array metaDistances
is filled with the distances
of the respective encapsulated objects if this object contains any, i.e.
this object is a descendant of MetaObject
.
If the distance to the object was already precomputed, it is returned.
If not, it is computed (using getDistanceImpl
method
and the metaDistances
array is filled if it is not null.
Then, if the filterFactory
is not null, the filter with
the given filterFactory
's class is retrieved from the object or
created by the factory if it does not exist. In that filter instance, the
computed distance is added using PrecomputedDistancesFilter.addPrecomputedDistance(messif.objects.LocalAbstractObject, float, float[])
.
obj
- the object to compute distance tofilterFactory
- the factory used to create a precomputed-distances filter (the class of the created filter is used to search the object first)metaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nulldistThreshold
- the threshold value on the distanceprotected abstract float getDistanceImpl(LocalAbstractObject obj, float distThreshold)
getDistance(messif.objects.LocalAbstractObject)
for full explanation).
The implementation should not increment distanceComputations statistics.obj
- the object to compute distance todistThreshold
- the threshold value on the distancepublic float[] createMetaDistancesHolder()
MetaObject
,
otherwise null is returned.public final float getNormDistance(LocalAbstractObject obj, float distThreshold)
getDistance(messif.objects.LocalAbstractObject)
divided by getMaxDistance()
. Note that unless an object overrides
the getMaxDistance()
the resulting distance will be too small.
Note that the threshold distance is also normalized, i.e. 0 <= distThreshold <= 1
.
obj
- the object to compute distance todistThreshold
- the threshold value on the distance (see getDistance(messif.objects.LocalAbstractObject)
for explanation)public float getMaxDistance()
MAX_DISTANCE
.public final float getDistanceLowerBound(LocalAbstractObject obj, int accuracy)
obj
- the object to compute the lower-bound distance toaccuracy
- the level of precision to use for the lower-boundobj
protected float getDistanceLowerBoundImpl(LocalAbstractObject obj, int accuracy)
obj
- the object to compute lower-bound distance toaccuracy
- the level of precision to use for lower-boundobj
public final float getDistanceUpperBound(LocalAbstractObject obj, int accuracy)
obj
- the object to compute the upper-bound distance toaccuracy
- the level of precision to use for the upper-boundobj
protected float getDistanceUpperBoundImpl(LocalAbstractObject obj, int accuracy)
obj
- the object to compute upper-bound distance toaccuracy
- the level of precision to use for upper-boundobj
public final float getPrecomputedDistance(LocalAbstractObject obj)
UNKNOWN_DISTANCE
.obj
- the object for which the precomputed distance is returnedpublic final float getPrecomputedDistance(LocalAbstractObject obj, float[] metaDistances)
UNKNOWN_DISTANCE
.obj
- the object for which the precomputed distance is returnedmetaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nullpublic final boolean excludeUsingPrecompDist(LocalAbstractObject obj, float radius)
obj
has been excluded (filtered out) using stored precomputed distance.
Otherwise returns false, i.e. when obj
must be checked using original distance (see getDistance(messif.objects.LocalAbstractObject)
).
In other words, method returns true if this
object and obj
are more distant than radius
. By
analogy, returns false if this
object and obj
are within distance radius
. However, both this cases
use only precomputed distances. Thus, the real distance between this
object and obj
can be greater
than radius
although the method returned false!obj
- the object to check the distance forradius
- the radius between this
object and obj
to checkobj
has been excluded (filtered out) using stored precomputed distancepublic final boolean includeUsingPrecompDist(LocalAbstractObject obj, float radius)
obj
has been included using stored precomputed distance.
Otherwise returns false, i.e. when obj
must be checked using original distance (see getDistance(messif.objects.LocalAbstractObject)
).
In other words, method returns true if the distance of this
object and obj
is below the radius
.
By analogy, returns false if this
object and obj
are more distant than radius
.
However, both this cases use only precomputed distances. Thus, the real distance between this
object and
obj
can be lower than radius
although the method returned false!obj
- the object to check the distance forradius
- the radius between this
object and obj
to checkpublic boolean isDistanceCompatible(LocalAbstractObject o)
o
is null,
false is returned.
Unless overridden, this implementation returns true if and only if
this class is the same-as or super-type-of the class of the object o
.o
- the object to checkpublic final <T extends PrecomputedDistancesFilter> T getDistanceFilter(java.lang.Class<T> filterClass) throws java.lang.NullPointerException
T
- the class of the filter to retrieve from the chainfilterClass
- the class of the filter to retrieve from the chainjava.lang.NullPointerException
- if the filterClass is nullpublic final <T extends PrecomputedDistancesFilter> T getDistanceFilter(java.lang.Class<T> filterClass, boolean inheritable) throws java.lang.NullPointerException
T
- the class of the filter to retrieve from the chainfilterClass
- the class of the filter to retrieve from the chaininheritable
- if false, the exact match of filterClass
is required;
otherwise the first filter that is assignable to filterClass
is returnedjava.lang.NullPointerException
- if the filterClass is nullpublic final PrecomputedDistancesFilter getDistanceFilter(int position) throws java.lang.IndexOutOfBoundsException
position
- a zero based position in the chain (zero returns this filter, negative value returns the last filter)java.lang.IndexOutOfBoundsException
- if the specified position is too bigpublic final <T extends PrecomputedDistancesFilter> T getDistanceFilter(PrecomputedDistancesFilterFactory<? extends T> filterFactory) throws java.lang.NullPointerException
filterFactory
's class from this object's filter chain.
If there is no filter with requested class, a new one is created, chained
to this object and returned.
If there are more filters of the same class, the first one is returned.T
- the class of the filter to retrieve from the chainfilterFactory
- the factory of the filter to retrievejava.lang.NullPointerException
- if the filterFactory is nullpublic final PrecomputedDistancesFilter chainFilter(PrecomputedDistancesFilter filter, boolean replaceIfExists) throws java.lang.IllegalArgumentException
filter
- the filter to add to this object's filter chainreplaceIfExists
- if true and there is another filter with the same class as the inserted filter, it is replacedfilter
or the existing filter that has the same class as the newly inserted one (only if replaceIfExists
is false)java.lang.IllegalArgumentException
- if the provided chain has set nextFilter attributepublic final boolean unchainFilter(PrecomputedDistancesFilter filter)
filter
- the concrete instance of filter to delete from this object's filter chainpublic final void chainDestroy()
public void clearSurplusData()
supplemental data
and
all distance filters
.clearSurplusData
in interface Clearable
clearSurplusData
in class AbstractObject
protected static double getRandomNormal()
double
greater than or equal
to 0.0
and less than 1.0
protected static char getRandomChar()
char
greater than or equal
to a and less than zpublic static <T extends LocalAbstractObject> T create(java.lang.Class<T> objectClass, java.io.BufferedReader dataReader, java.lang.Object... additionalArguments) throws java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
objectClass
from the dataReader
.
The constructor of the LocalAbstractObject
that reads the textual
data is used.T
- the class of the object to createobjectClass
- the class of the object to createdataReader
- the buffered reader of the object dataadditionalArguments
- more constructor arguments (in addition to first BufferedReader
)objectClass
java.lang.IllegalArgumentException
- if the class has is no stream constructorjava.lang.reflect.InvocationTargetException
- if there was an error during creating a new object instancepublic static <E extends LocalAbstractObject> E create(java.lang.Class<E> objectClass, java.lang.String objectData, java.lang.Object... additionalArguments) throws java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
E
- the class of the object to createobjectClass
- the class of the object to createobjectData
- the string that contains object's dataadditionalArguments
- more constructor arguments (in addition to first BufferedReader
)java.lang.IllegalArgumentException
- if the specified class lacks a public BufferedReader constructorjava.lang.reflect.InvocationTargetException
- if there was an error during creating a new object instancepublic static void readAttributesFromStream(java.lang.String line, java.lang.String attributesRegexp, java.lang.String arrayItemsRegexp, LocalAbstractObject dataObject, java.lang.reflect.Field... dataFields) throws java.io.IOException, java.lang.IllegalArgumentException
Object valueOf(String value)
method is used to create a respective attribute object.
If the field is an array, a arrayItemsSeparator
-separated list of items is read into respective attribute array.line
- a line of text representing the dataattributesRegexp
- the regular expression that is used to separate attributesarrayItemsRegexp
- the regular expression that is used to separate items of arraysdataObject
- the object whose data are readdataFields
- the list of dataObject
attribute fields to read from the streamjava.io.IOException
- if there was an error reading from the streamjava.lang.IllegalArgumentException
- if one of the specified fields is invalid or the value specified for a field can't be converted to correct typepublic static void writeAttributesToStream(java.io.OutputStream stream, char attributesSeparator, char arrayItemsSeparator, LocalAbstractObject dataObject, java.lang.reflect.Field... dataFields) throws java.io.IOException, java.lang.IllegalArgumentException
toString
method result is written.
If the attribute is an array, a arrayItemsSeparator
-separated list of items is written.stream
- the stream to output the text toattributesSeparator
- the character written to separate attributesarrayItemsSeparator
- the character written to separate items of an array attributedataObject
- the object whose data are writtendataFields
- the list of dataObject
attribute fields to write to the streamjava.io.IOException
- if there was an error writing to the streamjava.lang.IllegalArgumentException
- if one of the specified fields is invalidprotected static java.lang.reflect.Field[] getFieldsForNames(java.lang.Class<? extends LocalAbstractObject> forClass, java.lang.String... fieldName) throws java.lang.IllegalArgumentException
forClass
- the class to get fields forfieldName
- the list of field namesjava.lang.IllegalArgumentException
- if there is no attribute field with the specified namepublic final LocalAbstractObject clone() throws java.lang.CloneNotSupportedException
clone
in class AbstractObject
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
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 LocalAbstractObject cloneRandomlyModify(java.lang.Object... args) throws java.lang.CloneNotSupportedException
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 abstract int getSize()
public abstract boolean dataEquals(java.lang.Object obj)
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.public abstract int dataHashCode()
protected final java.lang.String readObjectComments(java.io.BufferedReader reader) throws java.io.EOFException, java.io.IOException
EOFException
.
See parseObjectComment(java.lang.String)
for more information
about the comment format.reader
- the reader from which to get lines with commentsjava.io.EOFException
- if the last line was readjava.io.IOException
- if the comment type was recognized but its value is illegalprotected final void readObjectCommentsWithoutData(java.io.BufferedReader reader) throws java.io.EOFException, java.io.IOException
EOFException
.
See parseObjectComment(java.lang.String)
for more information
about the comment format.reader
- the reader from which to get lines with commentsjava.io.EOFException
- if the last line was readjava.io.IOException
- if the comment type was recognized but its value is illegalprotected static char peekNextChar(java.io.BufferedReader reader) throws java.io.EOFException, java.io.IOException
reader
- the buffered reader (so the mark method is always supported) where to peek for a charjava.io.EOFException
- if the end-of-file was reached in the readerjava.io.IOException
- if there was an error reading data from the readerprotected boolean parseObjectComment(java.lang.String line) throws java.lang.IllegalArgumentException
sets the object key
adds a precomputed distances filter
line
- a line with commentjava.lang.IllegalArgumentException
- if there was a problem converting the line's comment, e.g. due to invalid formatprotected void writeObjectComment(java.io.OutputStream stream) throws java.io.IOException
stream
- the stream to write the comments tojava.io.IOException
- if there was an error while writing to streampublic final void write(java.io.OutputStream stream) throws java.io.IOException
writeData
.stream
- the stream to write the comments and data tojava.io.IOException
- if any problem occurs during comment writingpublic final void write(java.io.OutputStream stream, boolean writeComments) throws java.io.IOException
writeData
.stream
- the stream to write the comments and data towriteComments
- if true then the comments are writtenjava.io.IOException
- if any problem occurs during comment writingprotected abstract void writeData(java.io.OutputStream stream) throws java.io.IOException
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streamprotected int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.binarySerialize
in class AbstractObject
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 serializationprotected int getBinarySize(BinarySerializator serializator)
getBinarySize
in class AbstractObject
serializator
- the serializator used to write objects