HBASE-1240 Would be nice if RowResult could be comparable

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@750778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-03-06 06:29:21 +00:00
parent 353c716a54
commit f4da3b9340
2 changed files with 17 additions and 1 deletions

View File

@ -76,6 +76,8 @@ Release 0.20.0 - Unreleased
HBASE-1231 Today, going from a RowResult to a BatchUpdate reqiures some
data processing even though they are pretty much the same thing
(Erik Holstad via Stack)
HBASE-1240 Would be nice if RowResult could be comparable
(Erik Holstad via Stack)
Release 0.19.0 - 01/21/2009
INCOMPATIBLE CHANGES

View File

@ -45,7 +45,8 @@ import agilejson.TOJSON;
/**
* Holds row name and then a map of columns to cells.
*/
public class RowResult implements Writable, SortedMap<byte [], Cell>, ISerializable {
public class RowResult implements Writable, SortedMap<byte [], Cell>,
Comparable, ISerializable {
private byte [] row = null;
private final HbaseMapWritable<byte [], Cell> cells;
@ -278,4 +279,17 @@ public class RowResult implements Writable, SortedMap<byte [], Cell>, ISerializa
Bytes.writeByteArray(out, this.row);
this.cells.write(out);
}
//
// Comparable
//
/**
* Comparing this RowResult with another one by
* comparing the row in it.
* @param o the RowResult Object to compare to
* @return the compare number
*/
public int compareTo(Object o){
return Bytes.compareTo(this.row, ((RowResult)o).getRow());
}
}