public abstract class SortDimension extends java.lang.Object implements java.util.Comparator<ObjectFeature>, BinarySerializable, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
SortDimension.Window
Interface for encapsulating a rectangular 2-D window in a way that it recognizes primary and secondary ordering
instead of rigid references to x and y axes.
|
Modifier and Type | Field and Description |
---|---|
static SortDimension |
sortDimensionX
Implementation of SortDimension that sorts the features by x-axis and then by y-axis.
|
static SortDimension |
sortDimensionY
Implementation of SortDimension that sorts the features by y-axis and then by x-axis.
|
Constructor and Description |
---|
SortDimension() |
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
int |
compare(ObjectFeature o1,
ObjectFeature o2) |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
static SortDimension |
getImplementation(java.lang.String implName)
Factory method for text serialization sake.
|
abstract java.lang.String |
getImplementationName()
Name of implementation of the sort dimension -- it is used for serialization in
ObjectFeatureOrderedSet . |
abstract float |
getPrimary(DimensionObjectKey.Point f)
Returns value of the primary sorting dimension.
|
abstract int |
getPrimaryDimension()
Index of the primary dimension (e.g. x-axis => 0).
|
abstract float |
getSecondary(DimensionObjectKey.Point f)
Returns value of the secondary sorting dimension.
|
abstract int |
getSecondaryDimension()
Index of the secondary dimension (e.g. x-axis => 0).
|
abstract SortDimension.Window |
getWindow(float minX,
float maxX,
float minY,
float maxY)
Create a
SortDimension.Window object that represents the passed rectangular area. |
static SortDimension |
readImplementation(java.io.BufferedReader stream)
Factory method for text serialization sake.
|
void |
storeImplementation(java.io.OutputStream stream)
Factory method for text serialization sake.
|
public static final SortDimension sortDimensionX
public static final SortDimension sortDimensionY
public abstract java.lang.String getImplementationName()
ObjectFeatureOrderedSet
.public abstract float getPrimary(DimensionObjectKey.Point f)
f
- object whose primary sort dimension value is returnedpublic abstract float getSecondary(DimensionObjectKey.Point f)
f
- object whose secondary sort dimension value is returnedpublic abstract int getPrimaryDimension()
public abstract int getSecondaryDimension()
public abstract SortDimension.Window getWindow(float minX, float maxX, float minY, float maxY)
SortDimension.Window
object that represents the passed rectangular area.minX
- minimum in x-axis (relative value within the interval [0,1))maxX
- maximum in x-axis (relative value within the interval [0,1))minY
- minimum in y-axis (relative value within the interval [0,1))maxY
- maximum in y-axis (relative value within the interval [0,1))public int compare(ObjectFeature o1, ObjectFeature o2)
compare
in interface java.util.Comparator<ObjectFeature>
public static SortDimension getImplementation(java.lang.String implName) throws java.lang.NoSuchMethodException
getImplementationName()
for details.implName
- name of implementationjava.lang.NoSuchMethodException
- if unknown implementation is read from the streampublic static SortDimension readImplementation(java.io.BufferedReader stream) throws java.io.IOException
getImplementationName()
for details.stream
- stream with serialized sort dimension implementationjava.io.IOException
- if unknown implementation is read from the streampublic void storeImplementation(java.io.OutputStream stream) throws java.io.IOException
getImplementationName()
for details.stream
- stream with serialized sort dimension implementationjava.io.IOException
- on error during writingpublic int getBinarySize(BinarySerializator serializator)
BinarySerializable
getBinarySize
in interface BinarySerializable
serializator
- the serializator used to write objectspublic int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
BinarySerializable
output
.binarySerialize
in interface BinarySerializable
output
- the binary output that this object is serialized intoserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error during serialization