public class LongKey extends AbstractObjectKey
Modifier and Type | Field and Description |
---|---|
long |
key
The long key
|
Modifier | Constructor and Description |
---|---|
protected |
LongKey(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of LongKey loaded from binary input.
|
|
LongKey(java.lang.String keyString)
Creates a new instance of AbstractObjectKey given a buffered reader with the first line of the
following format: "longKey locatorUri"
|
|
LongKey(java.lang.String locatorURI,
boolean hashURI,
long maxValue)
Creates a new instance of LongKey given only the locatorURI -
implicitly create the key as the
(locatorURI.hashCode() + Integer.MAX_VALUE) modulo maxKey . |
|
LongKey(java.lang.String locatorURI,
long key)
Creates a new instance of LongKey
|
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 the long key
|
boolean |
equals(java.lang.Object obj)
Equals according to the long key.
|
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes.
|
int |
hashCode()
Return the long key converted to int.
|
java.lang.String |
toString()
Return 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 LongKey(java.lang.String locatorURI, long key)
locatorURI
- the URI locatorkey
- the long key of the object - it musn't be nullpublic LongKey(java.lang.String locatorURI, boolean hashURI, long maxValue) throws java.lang.IllegalArgumentException
(locatorURI.hashCode() + Integer.MAX_VALUE) modulo maxKey
.locatorURI
- the URI locatorhashURI
- if true then the key is created as hashCode of the locator; it set to 0, otherwisemaxValue
- the maximal value the key can have (incremented by 1)java.lang.IllegalArgumentException
- if the locatorURI is nullpublic LongKey(java.lang.String keyString) throws java.lang.IllegalArgumentException
keyString
- the text stream to read an object fromjava.lang.IllegalArgumentException
- if the string is not of format "longKey locatorUri"protected LongKey(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the LongKey fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the inputprotected void writeData(java.io.OutputStream stream) throws java.io.IOException
AbstractObjectKey
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)
equals
in class AbstractObjectKey
obj
- 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 objects