You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/01/09 03:44:44 UTC
[40/66] [abbrv] accumulo git commit: ACCUMULO-3451 Format master
branch (1.7.0-SNAPSHOT)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
index 0751ba4..6f7d433 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Mutation.java
@@ -40,15 +40,15 @@ import com.google.common.base.Preconditions;
* <p>
* Mutation represents an action that manipulates a row in a table. A mutation holds a list of column/value pairs that represent an atomic set of modifications
* to make to a row.
- *
+ *
* <p>
* Convenience methods which takes columns and value as CharSequence (String implements CharSequence) are provided. CharSequence is converted to UTF-8 by
* constructing a new Text object.
- *
+ *
* <p>
* When always passing in the same data as a CharSequence/String, it's probably more efficient to call the Text put methods. This way the data is only encoded
* once and only one Text object is created.
- *
+ *
* <p>
* All of the put methods append data to the mutation; they do not overwrite anything that was previously put. The mutation holds a list of all columns/values
* that were put into it.
@@ -61,62 +61,64 @@ import com.google.common.base.Preconditions;
* </p>
*/
public class Mutation implements Writable {
-
+
/**
- * Internally, this class keeps most mutation data in a byte buffer. If a cell
- * value put into a mutation exceeds this size, then it is stored in a
- * separate buffer, and a reference to it is inserted into the main buffer.
+ * Internally, this class keeps most mutation data in a byte buffer. If a cell value put into a mutation exceeds this size, then it is stored in a separate
+ * buffer, and a reference to it is inserted into the main buffer.
*/
static final int VALUE_SIZE_COPY_CUTOFF = 1 << 15;
-
+
/**
- * Formats available for serializing Mutations. The formats are described
- * in a <a href="doc-files/mutation-serialization.html">separate document</a>.
+ * Formats available for serializing Mutations. The formats are described in a <a href="doc-files/mutation-serialization.html">separate document</a>.
*/
public static enum SERIALIZED_FORMAT {
- VERSION1,
- VERSION2
+ VERSION1, VERSION2
};
-
+
private boolean useOldDeserialize = false;
private byte[] row;
private byte[] data;
private int entries;
private List<byte[]> values;
-
+
private UnsynchronizedBuffer.Writer buffer;
-
+
private List<ColumnUpdate> updates;
private static final Set<String> EMPTY = Collections.emptySet();
private Set<String> replicationSources = EMPTY;
-
+
private static final byte[] EMPTY_BYTES = new byte[0];
-
+
private void serialize() {
if (buffer != null) {
data = buffer.toArray();
buffer = null;
}
}
-
+
/**
* Creates a new mutation. A defensive copy is made.
*
- * @param row row ID
+ * @param row
+ * row ID
* @since 1.5.0
*/
public Mutation(byte[] row) {
this(row, 0, row.length);
}
-
+
/**
* Creates a new mutation. A defensive copy is made.
*
- * @param row byte array containing row ID
- * @param start starting index of row ID in byte array
- * @param length length of row ID in byte array
- * @throws IndexOutOfBoundsException if start or length is invalid
+ * @param row
+ * byte array containing row ID
+ * @param start
+ * starting index of row ID in byte array
+ * @param length
+ * length of row ID in byte array
+ * @throws IndexOutOfBoundsException
+ * if start or length is invalid
* @since 1.5.0
*/
public Mutation(byte[] row, int start, int length) {
@@ -124,34 +126,37 @@ public class Mutation implements Writable {
System.arraycopy(row, start, this.row, 0, length);
buffer = new UnsynchronizedBuffer.Writer();
}
-
+
/**
* Creates a new mutation. A defensive copy is made.
*
- * @param row row ID
+ * @param row
+ * row ID
*/
public Mutation(Text row) {
this(row.getBytes(), 0, row.getLength());
}
-
+
/**
* Creates a new mutation.
*
- * @param row row ID
+ * @param row
+ * row ID
*/
public Mutation(CharSequence row) {
this(new Text(row.toString()));
}
-
+
/**
* Creates a new mutation.
*/
public Mutation() {}
-
+
/**
* Creates a new mutation from a Thrift mutation.
*
- * @param tmutation Thrift mutation
+ * @param tmutation
+ * Thrift mutation
*/
public Mutation(TMutation tmutation) {
this.row = ByteBufferUtil.toBytes(tmutation.row);
@@ -162,7 +167,7 @@ public class Mutation implements Writable {
if (tmutation.isSetSources()) {
this.replicationSources = new HashSet<>(tmutation.sources);
}
-
+
if (this.row == null) {
throw new IllegalArgumentException("null row");
}
@@ -170,11 +175,12 @@ public class Mutation implements Writable {
throw new IllegalArgumentException("null serialized data");
}
}
-
+
/**
* Creates a new mutation by copying another.
*
- * @param m mutation to copy
+ * @param m
+ * mutation to copy
*/
public Mutation(Mutation m) {
m.serialize();
@@ -184,7 +190,7 @@ public class Mutation implements Writable {
this.values = m.values;
this.replicationSources = m.replicationSources;
}
-
+
/**
* Gets the row ID for this mutation. Not a defensive copy.
*
@@ -193,28 +199,28 @@ public class Mutation implements Writable {
public byte[] getRow() {
return row;
}
-
+
private void put(byte b[]) {
put(b, b.length);
}
-
+
private void put(byte b[], int length) {
buffer.writeVLong(length);
buffer.add(b, 0, length);
}
-
+
private void put(boolean b) {
buffer.add(b);
}
-
+
private void put(int i) {
buffer.writeVLong(i);
}
-
+
private void put(long l) {
buffer.writeVLong(l);
}
-
+
private void put(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
put(cf, cf.length, cq, cq.length, cv, hasts, ts, deleted, val, val.length);
}
@@ -225,7 +231,7 @@ public class Mutation implements Writable {
private void put(Text cf, Text cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
put(cf.getBytes(), cf.getLength(), cq.getBytes(), cq.getLength(), cv, hasts, ts, deleted, val, val.length);
}
-
+
private void put(byte[] cf, int cfLength, byte[] cq, int cqLength, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val, int valLength) {
if (buffer == null) {
throw new IllegalStateException("Can not add to mutation after serializing it");
@@ -238,7 +244,7 @@ public class Mutation implements Writable {
put(ts);
}
put(deleted);
-
+
if (valLength < VALUE_SIZE_COPY_CUTOFF) {
put(val, valLength);
} else {
@@ -250,14 +256,14 @@ public class Mutation implements Writable {
values.add(copy);
put(-1 * values.size());
}
-
+
entries++;
}
-
+
private void put(CharSequence cf, CharSequence cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
put(new Text(cf.toString()), new Text(cq.toString()), cv, hasts, ts, deleted, val);
}
-
+
private void put(Text cf, Text cq, byte[] cv, boolean hasts, long ts, boolean deleted, Text val) {
put(cf.getBytes(), cf.getLength(), cq.getBytes(), cq.getLength(), cv, hasts, ts, deleted, val.getBytes(), val.getLength());
}
@@ -267,358 +273,429 @@ public class Mutation implements Writable {
}
/**
- * Puts a modification in this mutation. Column visibility is empty;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param value
+ * cell value
*/
public void put(Text columnFamily, Text columnQualifier, Value value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. Timestamp is not set. All parameters
- * are defensively copied.
+ * Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param value
+ * cell value
*/
public void put(Text columnFamily, Text columnQualifier, ColumnVisibility columnVisibility, Value value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty. All
- * appropriate parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(Text columnFamily, Text columnQualifier, long timestamp, Value value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a modification in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(Text columnFamily, Text columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, false, value.get());
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
*/
public void putDelete(Text columnFamily, Text columnQualifier) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Timestamp is not set. All parameters are
- * defensively copied.
+ * Puts a deletion in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
*/
public void putDelete(Text columnFamily, Text columnQualifier, ColumnVisibility columnVisibility) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility. All
- * appropriate parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
*/
public void putDelete(Text columnFamily, Text columnQualifier, long timestamp) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a deletion in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
*/
public void putDelete(Text columnFamily, Text columnQualifier, ColumnVisibility columnVisibility, long timestamp) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, Value value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. Timestamp is not set. All parameters
- * are defensively copied.
+ * Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, Value value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty. All
- * appropriate parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, Value value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, false, value.get());
}
-
+
/**
- * Puts a modification in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a modification in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, false, value.get());
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
*/
public void putDelete(CharSequence columnFamily, CharSequence columnQualifier) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Timestamp is not set. All appropriate
- * parameters are defensively copied.
+ * Puts a deletion in this mutation. Timestamp is not set. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
*/
public void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility. All
- * appropriate parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
*/
public void putDelete(CharSequence columnFamily, CharSequence columnQualifier, long timestamp) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a deletion in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
*/
public void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, CharSequence value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value);
}
-
+
/**
- * Puts a modification in this mutation. Timestamp is not set. All parameters
- * are defensively copied.
+ * Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, CharSequence value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, false, value);
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty. All
- * appropriate parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, CharSequence value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, false, value);
}
-
+
/**
- * Puts a modification in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a modification in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
*/
public void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, CharSequence value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, false, value);
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param value
+ * cell value
* @since 1.5.0
*/
public void put(byte[] columnFamily, byte[] columnQualifier, byte[] value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, false, value);
}
-
+
/**
- * Puts a modification in this mutation. Timestamp is not set. All parameters
- * are defensively copied.
+ * Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param value
+ * cell value
* @since 1.5.0
*/
public void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, byte[] value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, false, value);
}
-
+
/**
- * Puts a modification in this mutation. Column visibility is empty. All
- * appropriate parameters are defensively copied.
+ * Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
* @since 1.5.0
*/
public void put(byte[] columnFamily, byte[] columnQualifier, long timestamp, byte[] value) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, false, value);
}
-
+
/**
- * Puts a modification in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a modification in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
- * @param value cell value
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
+ * @param value
+ * cell value
* @since 1.5.0
*/
public void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp, byte[] value) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, false, value);
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility;
- * timestamp is not set. All parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
* @since 1.5.0
*/
public void putDelete(byte[] columnFamily, byte[] columnQualifier) {
put(columnFamily, columnQualifier, EMPTY_BYTES, false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Timestamp is not set. All parameters are
- * defensively copied.
+ * Puts a deletion in this mutation. Timestamp is not set. All parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
* @since 1.5.0
*/
public void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility) {
put(columnFamily, columnQualifier, columnVisibility.getExpression(), false, 0l, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. Matches empty column visibility. All
- * appropriate parameters are defensively copied.
+ * Puts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param timestamp
+ * timestamp
* @since 1.5.0
*/
public void putDelete(byte[] columnFamily, byte[] columnQualifier, long timestamp) {
put(columnFamily, columnQualifier, EMPTY_BYTES, true, timestamp, true, EMPTY_BYTES);
}
-
+
/**
- * Puts a deletion in this mutation. All appropriate parameters are
- * defensively copied.
+ * Puts a deletion in this mutation. All appropriate parameters are defensively copied.
*
- * @param columnFamily column family
- * @param columnQualifier column qualifier
- * @param columnVisibility column visibility
- * @param timestamp timestamp
+ * @param columnFamily
+ * column family
+ * @param columnQualifier
+ * column qualifier
+ * @param columnVisibility
+ * column visibility
+ * @param timestamp
+ * timestamp
* @since 1.5.0
*/
public void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp) {
@@ -629,50 +706,49 @@ public class Mutation implements Writable {
int len = in.readInt();
if (len == 0)
return EMPTY_BYTES;
-
+
byte bytes[] = new byte[len];
in.readBytes(bytes);
return bytes;
}
-
+
private byte[] readBytes(UnsynchronizedBuffer.Reader in) {
- int len = (int)in.readVLong();
+ int len = (int) in.readVLong();
if (len == 0)
return EMPTY_BYTES;
-
+
byte bytes[] = new byte[len];
in.readBytes(bytes);
return bytes;
}
-
+
/**
- * Gets the modifications and deletions in this mutation. After calling
- * this method, further modifications to this mutation are ignored. Changes
- * made to the returned updates do not affect this mutation.
+ * Gets the modifications and deletions in this mutation. After calling this method, further modifications to this mutation are ignored. Changes made to the
+ * returned updates do not affect this mutation.
*
* @return list of modifications and deletions
*/
public List<ColumnUpdate> getUpdates() {
serialize();
-
+
UnsynchronizedBuffer.Reader in = new UnsynchronizedBuffer.Reader(data);
-
+
if (updates == null) {
if (entries == 1) {
updates = Collections.singletonList(deserializeColumnUpdate(in));
} else {
ColumnUpdate[] tmpUpdates = new ColumnUpdate[entries];
-
+
for (int i = 0; i < entries; i++)
tmpUpdates[i] = deserializeColumnUpdate(in);
-
+
updates = Arrays.asList(tmpUpdates);
}
}
-
+
return updates;
}
-
+
protected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) {
return new ColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
}
@@ -686,10 +762,10 @@ public class Mutation implements Writable {
if (hasts)
ts = in.readVLong();
boolean deleted = in.readBoolean();
-
+
byte[] val;
- int valLen = (int)in.readVLong();
-
+ int valLen = (int) in.readVLong();
+
if (valLen < 0) {
val = values.get((-1 * valLen) - 1);
} else if (valLen == 0) {
@@ -698,12 +774,12 @@ public class Mutation implements Writable {
val = new byte[valLen];
in.readBytes(val);
}
-
+
return newColumnUpdate(cf, cq, cv, hasts, ts, deleted, val);
}
-
+
private int cachedValLens = -1;
-
+
/**
* Gets the byte length of all large values stored in this mutation.
*
@@ -713,19 +789,19 @@ public class Mutation implements Writable {
long getValueLengths() {
if (values == null)
return 0;
-
+
if (cachedValLens == -1) {
int tmpCVL = 0;
for (byte[] val : values)
tmpCVL += val.length;
-
+
cachedValLens = tmpCVL;
}
-
+
return cachedValLens;
-
+
}
-
+
/**
* Gets the total number of bytes in this mutation.
*
@@ -735,17 +811,16 @@ public class Mutation implements Writable {
serialize();
return row.length + data.length + getValueLengths();
}
-
+
/**
- * Gets an estimate of the amount of memory used by this mutation. The
- * estimate includes data sizes and object overhead.
+ * Gets an estimate of the amount of memory used by this mutation. The estimate includes data sizes and object overhead.
*
* @return memory usage estimate
*/
public long estimatedMemoryUsed() {
return numBytes() + 238;
}
-
+
/**
* Gets the number of modifications / deletions in this mutation.
*
@@ -757,9 +832,9 @@ public class Mutation implements Writable {
/**
* Add a new element to the set of peers which this Mutation originated from
- *
+ *
* @param peer
- * the peer to add
+ * the peer to add
* @since 1.7.0
*/
public void addReplicationSource(String peer) {
@@ -772,7 +847,7 @@ public class Mutation implements Writable {
/**
* Set the replication peers which this Mutation originated from
- *
+ *
* @param sources
* Set of peer names which have processed this update
* @since 1.7.0
@@ -784,6 +859,7 @@ public class Mutation implements Writable {
/**
* Return the replication sources for this Mutation
+ *
* @return An unmodifiable view of the replication sources
*/
public Set<String> getReplicationSources() {
@@ -792,10 +868,10 @@ public class Mutation implements Writable {
}
return Collections.unmodifiableSet(replicationSources);
}
-
+
@Override
public void readFields(DataInput in) throws IOException {
-
+
// Clear out cached column updates and value lengths so
// that we recalculate them based on the (potentially) new
// data we are about to read in.
@@ -803,7 +879,7 @@ public class Mutation implements Writable {
cachedValLens = -1;
buffer = null;
useOldDeserialize = false;
-
+
byte first = in.readByte();
if ((first & 0x80) != 0x80) {
oldReadFields(first, in);
@@ -818,7 +894,7 @@ public class Mutation implements Writable {
data = new byte[len];
in.readFully(data);
entries = WritableUtils.readVInt(in);
-
+
boolean valuesPresent = (first & 0x01) == 0x01;
if (!valuesPresent) {
values = null;
@@ -841,24 +917,23 @@ public class Mutation implements Writable {
}
}
}
-
+
protected void droppingOldTimestamp(long ts) {}
private void oldReadFields(byte first, DataInput in) throws IOException {
- byte b = (byte)in.readByte();
- byte c = (byte)in.readByte();
- byte d = (byte)in.readByte();
-
- int len = (((first & 0xff) << 24) | ((b & 0xff) << 16) |
- ((c & 0xff) << 8) | (d & 0xff));
+ byte b = (byte) in.readByte();
+ byte c = (byte) in.readByte();
+ byte d = (byte) in.readByte();
+
+ int len = (((first & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff));
row = new byte[len];
in.readFully(row);
len = in.readInt();
byte[] localData = new byte[len];
in.readFully(localData);
int localEntries = in.readInt();
-
+
List<byte[]> localValues;
boolean valuesPresent = in.readBoolean();
if (!valuesPresent) {
@@ -873,7 +948,7 @@ public class Mutation implements Writable {
localValues.add(val);
}
}
-
+
// convert data to new format
UnsynchronizedBuffer.Reader din = new UnsynchronizedBuffer.Reader(localData);
buffer = new UnsynchronizedBuffer.Writer();
@@ -884,10 +959,10 @@ public class Mutation implements Writable {
boolean hasts = din.readBoolean();
long ts = din.readLong();
boolean deleted = din.readBoolean();
-
+
byte[] val;
int valLen = din.readInt();
-
+
if (valLen < 0) {
val = localValues.get((-1 * valLen) - 1);
} else if (valLen == 0) {
@@ -896,7 +971,7 @@ public class Mutation implements Writable {
val = new byte[valLen];
din.readBytes(val);
}
-
+
put(cf, cq, cv, hasts, ts, deleted, val);
if (!hasts)
droppingOldTimestamp(ts);
@@ -905,24 +980,24 @@ public class Mutation implements Writable {
serialize();
}
-
+
@Override
public void write(DataOutput out) throws IOException {
serialize();
- byte hasValues = (values == null) ? 0 : (byte)1;
+ byte hasValues = (values == null) ? 0 : (byte) 1;
if (!replicationSources.isEmpty()) {
// Use 2nd least-significant bit for whether or not we have replication sources
hasValues = (byte) (0x02 | hasValues);
}
- out.write((byte)(0x80 | hasValues));
-
+ out.write((byte) (0x80 | hasValues));
+
WritableUtils.writeVInt(out, row.length);
out.write(row);
WritableUtils.writeVInt(out, data.length);
out.write(data);
WritableUtils.writeVInt(out, entries);
-
+
if (0x01 == (0x01 & hasValues)) {
WritableUtils.writeVInt(out, values.size());
for (int i = 0; i < values.size(); i++) {
@@ -938,7 +1013,7 @@ public class Mutation implements Writable {
}
}
}
-
+
@Override
public boolean equals(Object o) {
if (o == this) {
@@ -949,18 +1024,18 @@ public class Mutation implements Writable {
}
return false;
}
-
+
@Override
public int hashCode() {
return toThrift().hashCode();
}
+
/**
- * Checks if this mutation equals another. Two mutations are equal if they
- * target the same row and have the same modifications and deletions, in order.
- * This method may be removed in a future API revision in favor of
- * {@link #equals(Object)}. See ACCUMULO-1627 for more information.
+ * Checks if this mutation equals another. Two mutations are equal if they target the same row and have the same modifications and deletions, in order. This
+ * method may be removed in a future API revision in favor of {@link #equals(Object)}. See ACCUMULO-1627 for more information.
*
- * @param m mutation to compare
+ * @param m
+ * mutation to compare
* @return true if this mutation equals the other, false otherwise
*/
public boolean equals(Mutation m) {
@@ -978,21 +1053,21 @@ public class Mutation implements Writable {
if (values == null && m.values == null)
return true;
-
+
if (values != null && m.values != null && values.size() == m.values.size()) {
for (int i = 0; i < values.size(); i++) {
if (!Arrays.equals(values.get(i), m.values.get(i)))
return false;
}
-
+
return true;
}
-
+
}
-
+
return false;
}
-
+
/**
* Converts this mutation to Thrift.
*
@@ -1006,7 +1081,7 @@ public class Mutation implements Writable {
}
return tmutation;
}
-
+
/**
* Gets the serialization format used to (de)serialize this mutation.
*
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/PartialKey.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/PartialKey.java b/core/src/main/java/org/apache/accumulo/core/data/PartialKey.java
index 5636de0..f4289d2 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/PartialKey.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/PartialKey.java
@@ -21,22 +21,23 @@ package org.apache.accumulo.core.data;
*/
public enum PartialKey {
ROW(1), ROW_COLFAM(2), ROW_COLFAM_COLQUAL(3), ROW_COLFAM_COLQUAL_COLVIS(4), ROW_COLFAM_COLQUAL_COLVIS_TIME(5),
- //everything with delete flag
- ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL(6)
- ;
-
+ // everything with delete flag
+ ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL(6);
+
int depth;
-
+
private PartialKey(int depth) {
this.depth = depth;
}
-
+
/**
* Get a partial key specification by depth of the specification.
*
- * @param depth depth of scope (i.e., number of fields included)
+ * @param depth
+ * depth of scope (i.e., number of fields included)
* @return partial key
- * @throws IllegalArgumentException if no partial key has the given depth
+ * @throws IllegalArgumentException
+ * if no partial key has the given depth
*/
public static PartialKey getByDepth(int depth) {
for (PartialKey d : PartialKey.values())
@@ -44,7 +45,7 @@ public enum PartialKey {
return d;
throw new IllegalArgumentException("Invalid legacy depth " + depth);
}
-
+
/**
* Gets the depth of this partial key.
*
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/Range.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Range.java b/core/src/main/java/org/apache/accumulo/core/data/Range.java
index 56e823e..05bb9f3 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Range.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Range.java
@@ -31,111 +31,137 @@ import org.apache.hadoop.io.WritableComparable;
/**
* This class is used to specify a range of Accumulo keys.
- *
+ *
* @see Key
*/
public class Range implements WritableComparable<Range> {
-
+
private Key start;
private Key stop;
private boolean startKeyInclusive;
private boolean stopKeyInclusive;
private boolean infiniteStartKey;
private boolean infiniteStopKey;
-
+
/**
* Creates a range that goes from negative to positive infinity
*/
public Range() {
this((Key) null, true, (Key) null, true);
}
-
+
/**
* Creates a range from startKey inclusive to endKey inclusive.
- *
- * @param startKey starting key; set to null for negative infinity
- * @param endKey ending key; set to null for positive infinity
- * @throws IllegalArgumentException if end key is before start key
+ *
+ * @param startKey
+ * starting key; set to null for negative infinity
+ * @param endKey
+ * ending key; set to null for positive infinity
+ * @throws IllegalArgumentException
+ * if end key is before start key
*/
public Range(Key startKey, Key endKey) {
this(startKey, true, endKey, true);
}
-
+
/**
* Creates a range that covers an entire row.
- *
- * @param row row to cover; set to null to cover all rows
+ *
+ * @param row
+ * row to cover; set to null to cover all rows
*/
public Range(CharSequence row) {
this(row, true, row, true);
}
-
+
/**
* Creates a range that covers an entire row.
- *
- * @param row row to cover; set to null to cover all rows
+ *
+ * @param row
+ * row to cover; set to null to cover all rows
*/
public Range(Text row) {
this(row, true, row, true);
}
-
+
/**
* Creates a range from startRow inclusive to endRow inclusive.
- *
- * @param startRow starting row; set to null for negative infinity
- * @param endRow ending row; set to null for positive infinity
- * @throws IllegalArgumentException if end row is before start row
+ *
+ * @param startRow
+ * starting row; set to null for negative infinity
+ * @param endRow
+ * ending row; set to null for positive infinity
+ * @throws IllegalArgumentException
+ * if end row is before start row
*/
public Range(Text startRow, Text endRow) {
this(startRow, true, endRow, true);
}
-
+
/**
* Creates a range from startRow inclusive to endRow inclusive.
- *
- * @param startRow starting row; set to null for negative infinity
- * @param endRow ending row; set to null for positive infinity
- * @throws IllegalArgumentException if end row is before start row
+ *
+ * @param startRow
+ * starting row; set to null for negative infinity
+ * @param endRow
+ * ending row; set to null for positive infinity
+ * @throws IllegalArgumentException
+ * if end row is before start row
*/
public Range(CharSequence startRow, CharSequence endRow) {
this(startRow, true, endRow, true);
}
-
+
/**
* Creates a range from startRow to endRow.
- *
- * @param startRow starting row; set to null for negative infinity
- * @param startRowInclusive true to include start row, false to skip
- * @param endRow ending row; set to null for positive infinity
- * @param endRowInclusive true to include start row, false to skip
- * @throws IllegalArgumentException if end row is before start row
+ *
+ * @param startRow
+ * starting row; set to null for negative infinity
+ * @param startRowInclusive
+ * true to include start row, false to skip
+ * @param endRow
+ * ending row; set to null for positive infinity
+ * @param endRowInclusive
+ * true to include start row, false to skip
+ * @throws IllegalArgumentException
+ * if end row is before start row
*/
public Range(Text startRow, boolean startRowInclusive, Text endRow, boolean endRowInclusive) {
this((startRow == null ? null : (startRowInclusive ? new Key(startRow) : new Key(startRow).followingKey(PartialKey.ROW))), true, (endRow == null ? null
: (endRowInclusive ? new Key(endRow).followingKey(PartialKey.ROW) : new Key(endRow))), false);
}
-
+
/**
* Creates a range from startRow to endRow.
- *
- * @param startRow starting row; set to null for negative infinity
- * @param startRowInclusive true to include start row, false to skip
- * @param endRow ending row; set to null for positive infinity
- * @param endRowInclusive true to include start row, false to skip
- * @throws IllegalArgumentException if end row is before start row
+ *
+ * @param startRow
+ * starting row; set to null for negative infinity
+ * @param startRowInclusive
+ * true to include start row, false to skip
+ * @param endRow
+ * ending row; set to null for positive infinity
+ * @param endRowInclusive
+ * true to include start row, false to skip
+ * @throws IllegalArgumentException
+ * if end row is before start row
*/
public Range(CharSequence startRow, boolean startRowInclusive, CharSequence endRow, boolean endRowInclusive) {
this(startRow == null ? null : new Text(startRow.toString()), startRowInclusive, endRow == null ? null : new Text(endRow.toString()), endRowInclusive);
}
-
+
/**
* Creates a range from startKey to endKey.
- *
- * @param startKey starting key; set to null for negative infinity
- * @param startKeyInclusive true to include start key, false to skip
- * @param endKey ending key; set to null for positive infinity
- * @param endKeyInclusive true to include start key, false to skip
- * @throws IllegalArgumentException if end key is before start key
+ *
+ * @param startKey
+ * starting key; set to null for negative infinity
+ * @param startKeyInclusive
+ * true to include start key, false to skip
+ * @param endKey
+ * ending key; set to null for positive infinity
+ * @param endKeyInclusive
+ * true to include start key, false to skip
+ * @throws IllegalArgumentException
+ * if end key is before start key
*/
public Range(Key startKey, boolean startKeyInclusive, Key endKey, boolean endKeyInclusive) {
this.start = startKey;
@@ -144,21 +170,22 @@ public class Range implements WritableComparable<Range> {
this.stop = endKey;
this.stopKeyInclusive = endKeyInclusive;
this.infiniteStopKey = stop == null;
-
+
if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(endKey)) {
throw new IllegalArgumentException("Start key must be less than end key in range (" + startKey + ", " + endKey + ")");
}
}
-
+
/**
* Copies a range.
*
- * @param range range to copy
+ * @param range
+ * range to copy
*/
public Range(Range range) {
this(range.start, range.startKeyInclusive, range.infiniteStartKey, range.stop, range.stopKeyInclusive, range.infiniteStopKey);
}
-
+
/**
* Creates a range from start to stop.
*
@@ -174,8 +201,8 @@ public class Range implements WritableComparable<Range> {
* true if start key is negative infinity (null)
* @param infiniteStopKey
* true if stop key is positive infinity (null)
- * @throws IllegalArgumentException if stop is before start, or infiniteStartKey is true but start is not null, or infiniteStopKey is true but stop is not
- * null
+ * @throws IllegalArgumentException
+ * if stop is before start, or infiniteStartKey is true but start is not null, or infiniteStopKey is true but stop is not null
*/
public Range(Key start, Key stop, boolean startKeyInclusive, boolean stopKeyInclusive, boolean infiniteStartKey, boolean infiniteStopKey) {
this(start, startKeyInclusive, infiniteStartKey, stop, stopKeyInclusive, infiniteStopKey);
@@ -185,9 +212,8 @@ public class Range implements WritableComparable<Range> {
}
/**
- * Creates a range from start to stop. Unlike the public six-argument method,
- * this one does not assure that stop is after start, which helps performance
- * in cases where that assurance is already in place.
+ * Creates a range from start to stop. Unlike the public six-argument method, this one does not assure that stop is after start, which helps performance in
+ * cases where that assurance is already in place.
*
* @param start
* set this to null when negative infinity is needed
@@ -201,15 +227,16 @@ public class Range implements WritableComparable<Range> {
* determines if the range includes the end key
* @param infiniteStopKey
* true if stop key is positive infinity (null)
- * @throws IllegalArgumentException if infiniteStartKey is true but start is not null, or infiniteStopKey is true but stop is not null
+ * @throws IllegalArgumentException
+ * if infiniteStartKey is true but start is not null, or infiniteStopKey is true but stop is not null
*/
protected Range(Key start, boolean startKeyInclusive, boolean infiniteStartKey, Key stop, boolean stopKeyInclusive, boolean infiniteStopKey) {
if (infiniteStartKey && start != null)
throw new IllegalArgumentException();
-
+
if (infiniteStopKey && stop != null)
throw new IllegalArgumentException();
-
+
this.start = start;
this.stop = stop;
this.startKeyInclusive = startKeyInclusive;
@@ -217,20 +244,21 @@ public class Range implements WritableComparable<Range> {
this.infiniteStartKey = infiniteStartKey;
this.infiniteStopKey = infiniteStopKey;
}
-
+
/**
* Creates a range from a Thrift range.
*
- * @param trange Thrift range
+ * @param trange
+ * Thrift range
*/
public Range(TRange trange) {
- this(trange.start == null ? null : new Key(trange.start), trange.startKeyInclusive, trange.infiniteStartKey,
- trange.stop == null ? null : new Key(trange.stop), trange.stopKeyInclusive, trange.infiniteStopKey);
+ this(trange.start == null ? null : new Key(trange.start), trange.startKeyInclusive, trange.infiniteStartKey, trange.stop == null ? null : new Key(
+ trange.stop), trange.stopKeyInclusive, trange.infiniteStopKey);
if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(stop)) {
throw new IllegalArgumentException("Start key must be less than end key in range (" + start + ", " + stop + ")");
}
}
-
+
/**
* Gets the start key, or null if the start is negative infinity.
*
@@ -242,23 +270,24 @@ public class Range implements WritableComparable<Range> {
}
return start;
}
-
+
/**
* Determines if the given key is before the start key of this range.
*
- * @param key key to check
+ * @param key
+ * key to check
* @return true if the given key is before the range, otherwise false
*/
public boolean beforeStartKey(Key key) {
if (infiniteStartKey) {
return false;
}
-
+
if (startKeyInclusive)
return key.compareTo(start) < 0;
return key.compareTo(start) <= 0;
}
-
+
/**
* Gets the ending key, or null if the end is positive infinity.
*
@@ -270,60 +299,63 @@ public class Range implements WritableComparable<Range> {
}
return stop;
}
-
+
/**
* Determines if the given key is after the ending key of this range.
*
- * @param key key to check
+ * @param key
+ * key to check
* @return true if the given key is after the range, otherwise false
*/
public boolean afterEndKey(Key key) {
if (infiniteStopKey)
return false;
-
+
if (stopKeyInclusive)
return stop.compareTo(key) < 0;
return stop.compareTo(key) <= 0;
}
-
+
@Override
public int hashCode() {
int startHash = infiniteStartKey ? 0 : start.hashCode() + (startKeyInclusive ? 1 : 0);
int stopHash = infiniteStopKey ? 0 : stop.hashCode() + (stopKeyInclusive ? 1 : 0);
-
+
return startHash + stopHash;
}
-
+
@Override
public boolean equals(Object o) {
if (o instanceof Range)
return equals((Range) o);
return false;
}
-
+
/**
* Determines if this range equals another.
*
- * @param otherRange range to compare
+ * @param otherRange
+ * range to compare
* @return true if ranges are equals, false otherwise
* @see #compareTo(Range)
*/
public boolean equals(Range otherRange) {
-
+
return compareTo(otherRange) == 0;
}
-
+
/**
* Compares this range to another range. Compares in order: start key, inclusiveness of start key, end key, inclusiveness of end key. Infinite keys sort
* first, and non-infinite keys are compared with {@link Key#compareTo(Key)}. Inclusive sorts before non-inclusive.
*
- * @param o range to compare
+ * @param o
+ * range to compare
* @return comparison result
*/
@Override
public int compareTo(Range o) {
int comp;
-
+
if (infiniteStartKey)
if (o.infiniteStartKey)
comp = 0;
@@ -338,9 +370,9 @@ public class Range implements WritableComparable<Range> {
comp = -1;
else if (!startKeyInclusive && o.startKeyInclusive)
comp = 1;
-
+
}
-
+
if (comp == 0)
if (infiniteStopKey)
if (o.infiniteStopKey)
@@ -357,60 +389,62 @@ public class Range implements WritableComparable<Range> {
else if (!stopKeyInclusive && o.stopKeyInclusive)
comp = -1;
}
-
+
return comp;
}
-
+
/**
* Determines if the given key falls within this range.
*
- * @param key key to consider
+ * @param key
+ * key to consider
* @return true if the given key falls within the range, false otherwise
*/
public boolean contains(Key key) {
return !beforeStartKey(key) && !afterEndKey(key);
}
-
+
/**
* Merges overlapping and adjacent ranges. For example given the following input:
- *
+ *
* <pre>
* [a,c], (c, d], (g,m), (j,t]
* </pre>
- *
+ *
* the following ranges would be returned:
- *
+ *
* <pre>
* [a,d], (g,t]
* </pre>
- *
- * @param ranges to merge
+ *
+ * @param ranges
+ * to merge
* @return list of merged ranges
*/
public static List<Range> mergeOverlapping(Collection<Range> ranges) {
if (ranges.size() == 0)
return Collections.emptyList();
-
+
List<Range> ral = new ArrayList<Range>(ranges);
Collections.sort(ral);
-
+
ArrayList<Range> ret = new ArrayList<Range>(ranges.size());
-
+
Range currentRange = ral.get(0);
boolean currentStartKeyInclusive = ral.get(0).startKeyInclusive;
-
+
for (int i = 1; i < ral.size(); i++) {
// because of inclusive switch, equal keys may not be seen
-
+
if (currentRange.infiniteStopKey) {
// this range has the minimal start key and
// an infinite end key so it will contain all
// other ranges
break;
}
-
+
Range range = ral.get(i);
-
+
boolean startKeysEqual;
if (range.infiniteStartKey) {
// previous start key must be infinite because it is sorted
@@ -423,11 +457,11 @@ public class Range implements WritableComparable<Range> {
} else {
startKeysEqual = false;
}
-
+
if (startKeysEqual || currentRange.contains(range.start)
|| (!currentRange.stopKeyInclusive && range.startKeyInclusive && range.start.equals(currentRange.stop))) {
int cmp;
-
+
if (range.infiniteStopKey || (cmp = range.stop.compareTo(currentRange.stop)) > 0 || (cmp == 0 && range.stopKeyInclusive)) {
currentRange = new Range(currentRange.getStartKey(), currentStartKeyInclusive, range.getEndKey(), range.stopKeyInclusive);
}/* else currentRange contains ral.get(i) */
@@ -437,50 +471,54 @@ public class Range implements WritableComparable<Range> {
currentStartKeyInclusive = range.startKeyInclusive;
}
}
-
+
ret.add(currentRange);
-
+
return ret;
}
-
+
/**
* Creates a range which represents the intersection of this range and the passed in range. The following example will print true.
- *
+ *
* <pre>
* Range range1 = new Range("a", "f");
* Range range2 = new Range("c", "n");
* Range range3 = range1.clip(range2);
* System.out.println(range3.equals(new Range("c", "f")));
* </pre>
- *
- * @param range range to clip to
+ *
+ * @param range
+ * range to clip to
* @return the intersection of this range and the given range
- * @throws IllegalArgumentException if ranges does not overlap
+ * @throws IllegalArgumentException
+ * if ranges does not overlap
*/
public Range clip(Range range) {
return clip(range, false);
}
-
+
/**
- * Creates a range which represents the intersection of this range and the passed in range. Unlike {@link #clip(Range)},
- * this method can optionally return null if the ranges do not overlap, instead of throwing an exception. The returnNullIfDisjoint parameter controls this
- * behavior.
- *
- * @param range range to clip to
- * @param returnNullIfDisjoint true to return null if ranges are disjoint, false to throw an exception
+ * Creates a range which represents the intersection of this range and the passed in range. Unlike {@link #clip(Range)}, this method can optionally return
+ * null if the ranges do not overlap, instead of throwing an exception. The returnNullIfDisjoint parameter controls this behavior.
+ *
+ * @param range
+ * range to clip to
+ * @param returnNullIfDisjoint
+ * true to return null if ranges are disjoint, false to throw an exception
* @return the intersection of this range and the given range, or null if ranges do not overlap and returnNullIfDisjoint is true
- * @throws IllegalArgumentException if ranges does not overlap and returnNullIfDisjoint is false
+ * @throws IllegalArgumentException
+ * if ranges does not overlap and returnNullIfDisjoint is false
* @see Range#clip(Range)
*/
-
+
public Range clip(Range range, boolean returnNullIfDisjoint) {
-
+
Key sk = range.getStartKey();
boolean ski = range.isStartKeyInclusive();
-
+
Key ek = range.getEndKey();
boolean eki = range.isEndKeyInclusive();
-
+
if (range.getStartKey() == null) {
if (getStartKey() != null) {
sk = getStartKey();
@@ -495,7 +533,7 @@ public class Range implements WritableComparable<Range> {
sk = getStartKey();
ski = isStartKeyInclusive();
}
-
+
if (range.getEndKey() == null) {
if (getEndKey() != null) {
ek = getEndKey();
@@ -510,67 +548,70 @@ public class Range implements WritableComparable<Range> {
ek = getEndKey();
eki = isEndKeyInclusive();
}
-
+
return new Range(sk, ski, ek, eki);
}
-
+
/**
* Creates a new range that is bounded by the columns passed in. The start key in the returned range will have a column >= to the minimum column. The end key
* in the returned range will have a column <= the max column.
- *
- * @param min minimum column
- * @param max maximum column
+ *
+ * @param min
+ * minimum column
+ * @param max
+ * maximum column
* @return a column bounded range
- * @throws IllegalArgumentException if the minimum column compares greater than the maximum column
+ * @throws IllegalArgumentException
+ * if the minimum column compares greater than the maximum column
*/
public Range bound(Column min, Column max) {
-
+
if (min.compareTo(max) > 0) {
throw new IllegalArgumentException("min column > max column " + min + " " + max);
}
-
+
Key sk = getStartKey();
boolean ski = isStartKeyInclusive();
-
+
if (sk != null) {
-
+
ByteSequence cf = sk.getColumnFamilyData();
ByteSequence cq = sk.getColumnQualifierData();
-
+
ByteSequence mincf = new ArrayByteSequence(min.columnFamily);
ByteSequence mincq;
-
+
if (min.columnQualifier != null)
mincq = new ArrayByteSequence(min.columnQualifier);
else
mincq = new ArrayByteSequence(new byte[0]);
-
+
int cmp = cf.compareTo(mincf);
-
+
if (cmp < 0 || (cmp == 0 && cq.compareTo(mincq) < 0)) {
ski = true;
sk = new Key(sk.getRowData().toArray(), mincf.toArray(), mincq.toArray(), new byte[0], Long.MAX_VALUE, true);
}
}
-
+
Key ek = getEndKey();
boolean eki = isEndKeyInclusive();
-
+
if (ek != null) {
ByteSequence row = ek.getRowData();
ByteSequence cf = ek.getColumnFamilyData();
ByteSequence cq = ek.getColumnQualifierData();
ByteSequence cv = ek.getColumnVisibilityData();
-
+
ByteSequence maxcf = new ArrayByteSequence(max.columnFamily);
ByteSequence maxcq = null;
if (max.columnQualifier != null)
maxcq = new ArrayByteSequence(max.columnQualifier);
-
+
boolean set = false;
-
+
int comp = cf.compareTo(maxcf);
-
+
if (comp > 0) {
set = true;
} else if (comp == 0 && maxcq != null && cq.compareTo(maxcq) > 0) {
@@ -580,7 +621,7 @@ public class Range implements WritableComparable<Range> {
row = row.subSequence(0, row.length() - 1);
set = true;
}
-
+
if (set) {
eki = false;
if (maxcq == null)
@@ -589,16 +630,16 @@ public class Range implements WritableComparable<Range> {
ek = new Key(row.toArray(), maxcf.toArray(), maxcq.toArray(), new byte[0], 0, false).followingKey(PartialKey.ROW_COLFAM_COLQUAL);
}
}
-
+
return new Range(sk, ski, ek, eki);
}
-
+
@Override
public String toString() {
return ((startKeyInclusive && start != null) ? "[" : "(") + (start == null ? "-inf" : start) + "," + (stop == null ? "+inf" : stop)
+ ((stopKeyInclusive && stop != null) ? "]" : ")");
}
-
+
@Override
public void readFields(DataInput in) throws IOException {
infiniteStartKey = in.readBoolean();
@@ -609,14 +650,14 @@ public class Range implements WritableComparable<Range> {
} else {
start = null;
}
-
+
if (!infiniteStopKey) {
stop = new Key();
stop.readFields(in);
} else {
stop = null;
}
-
+
startKeyInclusive = in.readBoolean();
stopKeyInclusive = in.readBoolean();
@@ -624,7 +665,7 @@ public class Range implements WritableComparable<Range> {
throw new InvalidObjectException("Start key must be less than end key in range (" + start + ", " + stop + ")");
}
}
-
+
@Override
public void write(DataOutput out) throws IOException {
out.writeBoolean(infiniteStartKey);
@@ -636,7 +677,7 @@ public class Range implements WritableComparable<Range> {
out.writeBoolean(startKeyInclusive);
out.writeBoolean(stopKeyInclusive);
}
-
+
/**
* Gets whether the start key of this range is inclusive.
*
@@ -645,7 +686,7 @@ public class Range implements WritableComparable<Range> {
public boolean isStartKeyInclusive() {
return startKeyInclusive;
}
-
+
/**
* Gets whether the end key of this range is inclusive.
*
@@ -654,7 +695,7 @@ public class Range implements WritableComparable<Range> {
public boolean isEndKeyInclusive() {
return stopKeyInclusive;
}
-
+
/**
* Converts this range to Thrift.
*
@@ -664,7 +705,7 @@ public class Range implements WritableComparable<Range> {
return new TRange(start == null ? null : start.toThrift(), stop == null ? null : stop.toThrift(), startKeyInclusive, stopKeyInclusive, infiniteStartKey,
infiniteStopKey);
}
-
+
/**
* Gets whether the start key is negative infinity.
*
@@ -673,7 +714,7 @@ public class Range implements WritableComparable<Range> {
public boolean isInfiniteStartKey() {
return infiniteStartKey;
}
-
+
/**
* Gets whether the end key is positive infinity.
*
@@ -682,238 +723,289 @@ public class Range implements WritableComparable<Range> {
public boolean isInfiniteStopKey() {
return infiniteStopKey;
}
-
+
/**
- * Creates a range that covers an exact row. Returns the same Range as
- * {@link #Range(Text)}.
- *
- * @param row row to cover; set to null to cover all rows
+ * Creates a range that covers an exact row. Returns the same Range as {@link #Range(Text)}.
+ *
+ * @param row
+ * row to cover; set to null to cover all rows
*/
public static Range exact(Text row) {
return new Range(row);
}
-
+
/**
* Creates a range that covers an exact row and column family.
- *
- * @param row row row to cover
- * @param cf column family to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
*/
public static Range exact(Text row, Text cf) {
Key startKey = new Key(row, cf);
return new Range(startKey, true, startKey.followingKey(PartialKey.ROW_COLFAM), false);
}
-
+
/**
* Creates a range that covers an exact row, column family, and column qualifier.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
*/
public static Range exact(Text row, Text cf, Text cq) {
Key startKey = new Key(row, cf, cq);
return new Range(startKey, true, startKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL), false);
}
-
+
/**
* Creates a range that covers an exact row, column family, column qualifier, and column visibility.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cv column visibility to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cv
+ * column visibility to cover
*/
public static Range exact(Text row, Text cf, Text cq, Text cv) {
Key startKey = new Key(row, cf, cq, cv);
return new Range(startKey, true, startKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS), false);
}
-
+
/**
* Creates a range that covers an exact row, column family, column qualifier, column visibility, and timestamp.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cv column visibility to cover
- * @param ts timestamp to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cv
+ * column visibility to cover
+ * @param ts
+ * timestamp to cover
*/
public static Range exact(Text row, Text cf, Text cq, Text cv, long ts) {
Key startKey = new Key(row, cf, cq, cv, ts);
return new Range(startKey, true, startKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME), false);
}
-
+
/**
* Returns a Text that sorts just after all Texts beginning with a prefix.
- *
- * @param prefix to follow
- * @return prefix that immediately follows the given prefix when sorted, or
- * null if no prefix can follow (i.e., the string is all 0xff bytes)
+ *
+ * @param prefix
+ * to follow
+ * @return prefix that immediately follows the given prefix when sorted, or null if no prefix can follow (i.e., the string is all 0xff bytes)
*/
public static Text followingPrefix(Text prefix) {
byte[] prefixBytes = prefix.getBytes();
-
+
// find the last byte in the array that is not 0xff
int changeIndex = prefix.getLength() - 1;
while (changeIndex >= 0 && prefixBytes[changeIndex] == (byte) 0xff)
changeIndex--;
if (changeIndex < 0)
return null;
-
+
// copy prefix bytes into new array
byte[] newBytes = new byte[changeIndex + 1];
System.arraycopy(prefixBytes, 0, newBytes, 0, changeIndex + 1);
-
+
// increment the selected byte
newBytes[changeIndex]++;
return new Text(newBytes);
}
-
+
/**
* Returns a Range that covers all rows beginning with a prefix.
- *
- * @param rowPrefix prefix of rows to cover
+ *
+ * @param rowPrefix
+ * prefix of rows to cover
*/
public static Range prefix(Text rowPrefix) {
Text fp = followingPrefix(rowPrefix);
return new Range(new Key(rowPrefix), true, fp == null ? null : new Key(fp), false);
}
-
+
/**
* Returns a Range that covers all column families beginning with a prefix within a given row.
- *
- * @param row row to cover
- * @param cfPrefix prefix of column families to cover
+ *
+ * @param row
+ * row to cover
+ * @param cfPrefix
+ * prefix of column families to cover
*/
public static Range prefix(Text row, Text cfPrefix) {
Text fp = followingPrefix(cfPrefix);
return new Range(new Key(row, cfPrefix), true, fp == null ? new Key(row).followingKey(PartialKey.ROW) : new Key(row, fp), false);
}
-
+
/**
* Returns a Range that covers all column qualifiers beginning with a prefix within a given row and column family.
- *
- * @param row row to cover
- * @param cf column family to cover
- * @param cqPrefix prefix of column qualifiers to cover
+ *
+ * @param row
+ * row to cover
+ * @param cf
+ * column family to cover
+ * @param cqPrefix
+ * prefix of column qualifiers to cover
*/
public static Range prefix(Text row, Text cf, Text cqPrefix) {
Text fp = followingPrefix(cqPrefix);
return new Range(new Key(row, cf, cqPrefix), true, fp == null ? new Key(row, cf).followingKey(PartialKey.ROW_COLFAM) : new Key(row, cf, fp), false);
}
-
+
/**
* Returns a Range that covers all column visibilities beginning with a prefix within a given row, column family, and column qualifier.
- *
- * @param row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cvPrefix prefix of column visibilities to cover
+ *
+ * @param row
+ * row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cvPrefix
+ * prefix of column visibilities to cover
*/
public static Range prefix(Text row, Text cf, Text cq, Text cvPrefix) {
Text fp = followingPrefix(cvPrefix);
return new Range(new Key(row, cf, cq, cvPrefix), true, fp == null ? new Key(row, cf, cq).followingKey(PartialKey.ROW_COLFAM_COLQUAL) : new Key(row, cf, cq,
fp), false);
}
-
+
/**
* Creates a range that covers an exact row.
- *
- * @param row row to cover; set to null to cover all rows
+ *
+ * @param row
+ * row to cover; set to null to cover all rows
* @see #exact(Text)
*/
public static Range exact(CharSequence row) {
return Range.exact(new Text(row.toString()));
}
-
+
/**
* Creates a range that covers an exact row and column family.
- *
- * @param row row row to cover
- * @param cf column family to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
* @see #exact(Text, Text)
*/
public static Range exact(CharSequence row, CharSequence cf) {
return Range.exact(new Text(row.toString()), new Text(cf.toString()));
}
-
+
/**
* Creates a range that covers an exact row, column family, and column qualifier.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
* @see #exact(Text, Text, Text)
*/
public static Range exact(CharSequence row, CharSequence cf, CharSequence cq) {
return Range.exact(new Text(row.toString()), new Text(cf.toString()), new Text(cq.toString()));
}
-
+
/**
* Creates a range that covers an exact row, column family, column qualifier, and column visibility.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cv column visibility to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cv
+ * column visibility to cover
* @see #exact(Text, Text, Text, Text)
*/
public static Range exact(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv) {
return Range.exact(new Text(row.toString()), new Text(cf.toString()), new Text(cq.toString()), new Text(cv.toString()));
}
-
+
/**
* Creates a range that covers an exact row, column family, column qualifier, column visibility, and timestamp.
- *
- * @param row row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cv column visibility to cover
- * @param ts timestamp to cover
+ *
+ * @param row
+ * row row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cv
+ * column visibility to cover
+ * @param ts
+ * timestamp to cover
* @see #exact(Text, Text, Text, Text, long)
*/
public static Range exact(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv, long ts) {
return Range.exact(new Text(row.toString()), new Text(cf.toString()), new Text(cq.toString()), new Text(cv.toString()), ts);
}
+
/**
* Returns a Range that covers all rows beginning with a prefix.
- *
- * @param rowPrefix prefix of rows to cover
+ *
+ * @param rowPrefix
+ * prefix of rows to cover
* @see #prefix(Text)
*/
public static Range prefix(CharSequence rowPrefix) {
return Range.prefix(new Text(rowPrefix.toString()));
}
-
+
/**
* Returns a Range that covers all column families beginning with a prefix within a given row.
- *
- * @param row row to cover
- * @param cfPrefix prefix of column families to cover
+ *
+ * @param row
+ * row to cover
+ * @param cfPrefix
+ * prefix of column families to cover
* @see #prefix(Text, Text)
*/
public static Range prefix(CharSequence row, CharSequence cfPrefix) {
return Range.prefix(new Text(row.toString()), new Text(cfPrefix.toString()));
}
-
+
/**
* Returns a Range that covers all column qualifiers beginning with a prefix within a given row and column family.
- *
- * @param row row to cover
- * @param cf column family to cover
- * @param cqPrefix prefix of column qualifiers to cover
+ *
+ * @param row
+ * row to cover
+ * @param cf
+ * column family to cover
+ * @param cqPrefix
+ * prefix of column qualifiers to cover
* @see #prefix(Text, Text, Text)
*/
public static Range prefix(CharSequence row, CharSequence cf, CharSequence cqPrefix) {
return Range.prefix(new Text(row.toString()), new Text(cf.toString()), new Text(cqPrefix.toString()));
}
+
/**
* Returns a Range that covers all column visibilities beginning with a prefix within a given row, column family, and column qualifier.
- *
- * @param row row to cover
- * @param cf column family to cover
- * @param cq column qualifier to cover
- * @param cvPrefix prefix of column visibilities to cover
+ *
+ * @param row
+ * row to cover
+ * @param cf
+ * column family to cover
+ * @param cq
+ * column qualifier to cover
+ * @param cvPrefix
+ * prefix of column visibilities to cover
* @see #prefix(Text, Text, Text, Text)
*/
public static Range prefix(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cvPrefix) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/main/java/org/apache/accumulo/core/data/Value.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Value.java b/core/src/main/java/org/apache/accumulo/core/data/Value.java
index 48eae02..e77e8a7 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Value.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Value.java
@@ -51,7 +51,7 @@ public class Value implements WritableComparable<Object> {
/**
* Creates a Value using a byte array as the initial value. The given byte array is used directly as the backing array, so later changes made to the array
* reflect into the new Value.
- *
+ *
* @param bytes
* May not be null
*/
@@ -61,7 +61,7 @@ public class Value implements WritableComparable<Object> {
/**
* Creates a Value using the bytes in a buffer as the initial value. Makes a defensive copy.
- *
+ *
* @param bytes
* May not be null
*/
@@ -72,7 +72,7 @@ public class Value implements WritableComparable<Object> {
/**
* @deprecated A copy of the bytes in the buffer is always made. Use {@link #Value(ByteBuffer)} instead.
- *
+ *
* @param bytes
* bytes of value (may not be null)
* @param copy
@@ -86,7 +86,7 @@ public class Value implements WritableComparable<Object> {
/**
* Creates a Value using a byte array as the initial value.
- *
+ *
* @param bytes
* may not be null
* @param copy
@@ -105,7 +105,7 @@ public class Value implements WritableComparable<Object> {
/**
* Creates a new Value based on another.
- *
+ *
* @param ibw
* may not be null.
*/
@@ -115,7 +115,7 @@ public class Value implements WritableComparable<Object> {
/**
* Creates a Value based on a range in a byte array. A copy of the bytes is always made.
- *
+ *
* @param newData
* source of copy, may not be null
* @param offset
@@ -133,7 +133,7 @@ public class Value implements WritableComparable<Object> {
/**
* Gets the byte data of this value.
- *
+ *
* @return the underlying byte array directly.
*/
public byte[] get() {
@@ -143,7 +143,7 @@ public class Value implements WritableComparable<Object> {
/**
* Sets the byte data of this value. The given byte array is used directly as the backing array, so later changes made to the array reflect into this Value.
- *
+ *
* @param b
* may not be null
*/
@@ -154,7 +154,7 @@ public class Value implements WritableComparable<Object> {
/**
* Sets the byte data of this value. The given byte array is copied.
- *
+ *
* @param b
* may not be null
*/
@@ -166,7 +166,7 @@ public class Value implements WritableComparable<Object> {
/**
* Gets the size of this value.
- *
+ *
* @return size in bytes
*/
public int getSize() {
@@ -195,7 +195,7 @@ public class Value implements WritableComparable<Object> {
/**
* Define the sort order of the BytesWritable.
- *
+ *
* @param right_obj
* The other bytes writable
* @return Positive if left is bigger than right, 0 if they are equal, and negative if left is smaller than right.
@@ -207,7 +207,7 @@ public class Value implements WritableComparable<Object> {
/**
* Compares the bytes in this object to the specified byte array
- *
+ *
* @return Positive if left is bigger than right, 0 if they are equal, and negative if left is smaller than right.
*/
public int compareTo(final byte[] that) {
@@ -254,7 +254,7 @@ public class Value implements WritableComparable<Object> {
/**
* Converts a list of byte arrays to a two-dimensional array.
- *
+ *
* @param array
* list of byte arrays
* @return two-dimensional byte array containing one given byte array per row