private RowResult(byte[] row, SortedMap<byte[], T> columns) { Preconditions.checkArgument(Cell.isNameValid(row)); Preconditions.checkArgument(UnsignedBytes.lexicographicalComparator().equals(columns.comparator()), "comparator for the map must be the bytes comparator"); for (byte[] colName : columns.keySet()) { Preconditions.checkArgument(Cell.isNameValid(colName)); } this.row = row.clone(); this.columns = ImmutableSortedMap.copyOf(columns, UnsignedBytes.lexicographicalComparator()); }
public boolean inRange(byte[] position) { Preconditions.checkArgument(Cell.isNameValid(position)); final boolean afterStart; final boolean afterEnd; if (reverse) { afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) >= 0; afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) < 0; } else { afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) <= 0; afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) > 0; } return afterStart && afterEnd; }
private RowResult(byte[] row, SortedMap<byte[], T> columns) { Preconditions.checkArgument(Cell.isNameValid(row)); Preconditions.checkArgument(UnsignedBytes.lexicographicalComparator().equals(columns.comparator()), "comparator for the map must be the bytes comparator"); for (byte[] colName : columns.keySet()) { Preconditions.checkArgument(Cell.isNameValid(colName)); } this.row = row.clone(); this.columns = ImmutableSortedMap.copyOf(columns, UnsignedBytes.lexicographicalComparator()); }
public boolean inRange(byte[] position) { Preconditions.checkArgument(Cell.isNameValid(position)); final boolean afterStart; final boolean afterEnd; if (reverse) { afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) >= 0; afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) < 0; } else { afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) <= 0; afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) > 0; } return afterStart && afterEnd; }