public class Key extends Object implements WritableComparable<Key>
| 构造器和说明 |
|---|
Key()
default constructor - use with readFields
|
Key(byte[] value)
Constructor.
|
Key(byte[] value,
double weight)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(Key other) |
boolean |
equals(Object o) |
byte[] |
getBytes() |
double |
getWeight() |
int |
hashCode() |
void |
incrementWeight()
Increments the weight of this key by one.
|
void |
incrementWeight(double weight)
Increments the weight of this key with a specified value.
|
void |
readFields(DataInput in)
Deserialize the fields of this object from
in. |
void |
set(byte[] value,
double weight) |
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
public Key()
public Key(byte[] value)
Builds a key with a default weight.
value - The byte value of this key.public Key(byte[] value, double weight)
Builds a key with a specified weight.
value - The value of this key.weight - The weight associated to this key.public void set(byte[] value,
double weight)
value - weight - public byte[] getBytes()
public double getWeight()
public void incrementWeight(double weight)
weight - The increment.public void incrementWeight()
public void write(DataOutput out) throws IOException
Writableout.write 在接口中 Writableout - DataOuput to serialize this object into.IOExceptionpublic void readFields(DataInput in) throws IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields 在接口中 Writablein - DataInput to deseriablize this object from.IOExceptionpublic int compareTo(Key other)
compareTo 在接口中 Comparable<Key>Copyright © 2009 The Apache Software Foundation