@Override public int compareTo(byte [] value) { return compareTo(value, 0, value.length); }
/** * Special compareTo method for subclasses, to avoid copying bytes unnecessarily. * @param value bytes to compare within a ByteBuffer * @param offset offset into value * @param length number of bytes to compare * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ public int compareTo(ByteBuffer value, int offset, int length) { // For BC, providing a default implementation here which is doing a bytes copy to a temp byte[] // and calling compareTo(byte[]). Make sure to override this method in subclasses to avoid // copying bytes unnecessarily. byte[] temp = new byte[length]; ByteBufferUtils.copyFromBufferToArray(temp, value, offset, 0, length); return compareTo(temp); } }
/** * Compare cell's column family against given comparator * @param cell * @param comparator * @return result comparing cell's column family */ public static int compareFamily(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getFamilyByteBuffer(), ((ByteBufferExtendedCell) cell).getFamilyPosition(), cell.getFamilyLength()); } return comparator.compareTo(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()); }
/** * Compare cell's qualifier against given comparator * @param cell * @param comparator * @return result comparing cell's qualifier */ public static int compareQualifier(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getQualifierByteBuffer(), ((ByteBufferExtendedCell) cell).getQualifierPosition(), cell.getQualifierLength()); } return comparator.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); }
/** * Compare cell's row against given comparator * @param cell * @param comparator * @return result comparing cell's row */ public static int compareRow(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getRowByteBuffer(), ((ByteBufferExtendedCell) cell).getRowPosition(), cell.getRowLength()); } return comparator.compareTo(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); }
/** * Compare cell's value against given comparator * @param cell * @param comparator * @return result comparing cell's value */ public static int compareValue(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getValueByteBuffer(), ((ByteBufferExtendedCell) cell).getValuePosition(), cell.getValueLength()); } return comparator.compareTo(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); }
@Override public int compareTo(byte [] value) { return compareTo(value, 0, value.length); }
@Override public int compareTo(byte [] value) { return compareTo(value, 0, value.length); }
@Override public int compareTo(byte [] value) { return compareTo(value, 0, value.length); }
/** * Special compareTo method for subclasses, to avoid copying bytes unnecessarily. * @param value bytes to compare within a ByteBuffer * @param offset offset into value * @param length number of bytes to compare * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ public int compareTo(ByteBuffer value, int offset, int length) { // For BC, providing a default implementation here which is doing a bytes copy to a temp byte[] // and calling compareTo(byte[]). Make sure to override this method in subclasses to avoid // copying bytes unnecessarily. byte[] temp = new byte[length]; ByteBufferUtils.copyFromBufferToArray(temp, value, offset, 0, length); return compareTo(temp); } }
/** * Special compareTo method for subclasses, to avoid copying bytes unnecessarily. * @param value bytes to compare within a ByteBuffer * @param offset offset into value * @param length number of bytes to compare * @return a negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ public int compareTo(ByteBuffer value, int offset, int length) { // For BC, providing a default implementation here which is doing a bytes copy to a temp byte[] // and calling compareTo(byte[]). Make sure to override this method in subclasses to avoid // copying bytes unnecessarily. byte[] temp = new byte[length]; ByteBufferUtils.copyFromBufferToArray(temp, value, offset, 0, length); return compareTo(temp); } }
private boolean filterColumnValue(final byte [] data, final int offset, final int length) { int compareResult = this.comparator.compareTo(data, offset, length); switch (this.compareOp) { case LESS: return compareResult <= 0; case LESS_OR_EQUAL: return compareResult < 0; case EQUAL: return compareResult != 0; case NOT_EQUAL: return compareResult == 0; case GREATER_OR_EQUAL: return compareResult > 0; case GREATER: return compareResult >= 0; default: throw new RuntimeException("Unknown Compare op " + compareOp.name()); } }
/** * Compare cell's value against given comparator * @param cell * @param comparator * @return result comparing cell's value */ public static int compareValue(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getValueByteBuffer(), ((ByteBufferExtendedCell) cell).getValuePosition(), cell.getValueLength()); } return comparator.compareTo(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); }
/** * Compare cell's column family against given comparator * @param cell * @param comparator * @return result comparing cell's column family */ public static int compareFamily(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getFamilyByteBuffer(), ((ByteBufferExtendedCell) cell).getFamilyPosition(), cell.getFamilyLength()); } return comparator.compareTo(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()); }
/** * Compare cell's row against given comparator * @param cell * @param comparator * @return result comparing cell's row */ public static int compareRow(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getRowByteBuffer(), ((ByteBufferExtendedCell) cell).getRowPosition(), cell.getRowLength()); } return comparator.compareTo(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); }
/** * Compare cell's row against given comparator * @param cell * @param comparator * @return result comparing cell's row */ public static int compareRow(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getRowByteBuffer(), ((ByteBufferExtendedCell) cell).getRowPosition(), cell.getRowLength()); } return comparator.compareTo(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); }
/** * Compare cell's qualifier against given comparator * @param cell * @param comparator * @return result comparing cell's qualifier */ public static int compareQualifier(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getQualifierByteBuffer(), ((ByteBufferExtendedCell) cell).getQualifierPosition(), cell.getQualifierLength()); } return comparator.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); }
/** * Compare cell's value against given comparator * @param cell * @param comparator * @return result comparing cell's value */ public static int compareValue(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getValueByteBuffer(), ((ByteBufferExtendedCell) cell).getValuePosition(), cell.getValueLength()); } return comparator.compareTo(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); }
/** * Compare cell's column family against given comparator * @param cell * @param comparator * @return result comparing cell's column family */ public static int compareFamily(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getFamilyByteBuffer(), ((ByteBufferExtendedCell) cell).getFamilyPosition(), cell.getFamilyLength()); } return comparator.compareTo(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()); }
/** * Compare cell's qualifier against given comparator * @param cell * @param comparator * @return result comparing cell's qualifier */ public static int compareQualifier(Cell cell, ByteArrayComparable comparator) { if (cell instanceof ByteBufferExtendedCell) { return comparator.compareTo(((ByteBufferExtendedCell) cell).getQualifierByteBuffer(), ((ByteBufferExtendedCell) cell).getQualifierPosition(), cell.getQualifierLength()); } return comparator.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); }