public class DimensionObjectKey extends AbstractObjectKey
AbstractObjectKey
dimensions of the object.
It can also be used to store just a list of integer, e.g. for creaing multiple independent vocabularies.Modifier and Type | Class and Description |
---|---|
static interface |
DimensionObjectKey.Point
Interface that marks a class that it offers its position (x,y)
|
static interface |
DimensionObjectKey.Range
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
DimensionObjectKey(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of AbstractObjectKey loaded from binary input.
|
|
DimensionObjectKey(java.lang.String value)
Creates a new instance for a string value.
|
|
DimensionObjectKey(java.lang.String locatorURI,
int[] dimensions)
Creates a new instance.
|
|
DimensionObjectKey(java.lang.String locatorURI,
int width,
int height)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the
output . |
int |
compareTo(AbstractObjectKey o)
Compare the keys according to their locators.
|
int |
convertToAbsolute(float value,
int dimension)
Convert the passed relative value in the passed dimension to an absolute value in the interval [0,
this.getDimension(dimension) ). |
float |
convertToRelative(float value,
int dimension)
Convert the passed absolute value in the passed dimension to a relative value in the interval [0,1).
|
float |
convertToRelative(int value,
int dimension)
Convert the passed absolute value in the passed dimension to a relative value in the interval [0,1).
|
boolean |
equals(java.lang.Object obj)
Returns whether this key is equal to the
obj . |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
int |
getDimension(int di)
Size of the object in the required dimension.
|
int |
getDimensionCount()
Number of dimensions.
|
int |
getHeight()
Height of the object.
|
int |
getWidth()
Width of the object.
|
int |
hashCode()
Return the hashCode of the locator URI or 0, if it is null.
|
java.lang.String |
toString()
Returns the URI string.
|
protected void |
writeData(java.io.OutputStream stream)
Store this key's data to a text stream.
|
clone, create, getKeyStringPart, getLocatorURI, write
public DimensionObjectKey(java.lang.String value)
value
- the string representaion of the keypublic DimensionObjectKey(java.lang.String locatorURI, int width, int height)
locatorURI
- the URI locatorwidth
- x-axis dimensionheight
- y-axis dimensionpublic DimensionObjectKey(java.lang.String locatorURI, int[] dimensions)
locatorURI
- the URI locatordimensions
- dimensions of the objectprotected DimensionObjectKey(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the AbstractObjectKey fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the inputpublic int getDimension(int di)
di
- dimension indexpublic int getDimensionCount()
public int getWidth()
public int getHeight()
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
writeData
in class AbstractObjectKey
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streampublic int compareTo(AbstractObjectKey o)
compareTo
in interface java.lang.Comparable<AbstractObjectKey>
compareTo
in class AbstractObjectKey
o
- the key to compare this key withpublic int hashCode()
hashCode
in class AbstractObjectKey
public boolean equals(java.lang.Object obj)
obj
.
It is only and only if the obj
is descendant of
AbstractObjectKey
and has an equal locator URI.equals
in class AbstractObjectKey
obj
- the object to compare this object toobj
argument; false otherwisepublic java.lang.String toString()
toString
in class AbstractObjectKey
public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.binarySerialize
in interface BinarySerializable
binarySerialize
in class AbstractObjectKey
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)
getBinarySize
in interface BinarySerializable
getBinarySize
in class AbstractObjectKey
serializator
- the serializator used to write objectspublic float convertToRelative(int value, int dimension)
value
- absolute value in the passed dimensiondimension
- zero-based dimension index (0 = x-axis, 1 = y-axis, ...)public float convertToRelative(float value, int dimension)
value
- absolute value in the passed dimensiondimension
- zero-based dimension index (0 = x-axis, 1 = y-axis, ...)public int convertToAbsolute(float value, int dimension)
this.getDimension(dimension)
).value
- relative value in the passed dimensiondimension
- zero-based dimension index (0 = x-axis, 1 = y-axis, ...)