@Test public void columnEndingWithZeroIsIgnoredForCells() { LockDescriptor descriptor = AtlasCellLockDescriptor.of(TABLE.getQualifiedName(), NO_ZERO_ROW, END_WITH_ZERO); assertThat(AtlasLockDescriptorUtils.candidateCells(descriptor)) .containsExactly(CellReference.of(TABLE, Cell.create(NO_ZERO_ROW, END_WITH_ZERO))); }
public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); }
AtlasLockDescriptorUtils { public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); } }
AtlasLockDescriptorUtils { public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); } private  AtlasLockDescriptorUtils(); }
AtlasLockDescriptorUtils { public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); } private  AtlasLockDescriptorUtils(); static List<CellReference> candidateCells(LockDescriptor lockDescriptor); static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor); }
AtlasLockDescriptorUtils { public static List<CellReference> candidateCells(LockDescriptor lockDescriptor) { Optional<TableRefAndRemainder> tableRefAndRemainder = tryParseTableRef(lockDescriptor); if (!tableRefAndRemainder.isPresent()) { return ImmutableList.of(); } TableReference tableRef = tableRefAndRemainder.get().tableRef(); ByteString remainingBytes = tableRefAndRemainder.get().remainder(); return IntStream.range(1, remainingBytes.size() - 2) .filter(index -> isZeroDelimiterIndex(remainingBytes, index)) .mapToObj(index -> createCellFromByteString(remainingBytes, index)) .map(cell -> CellReference.of(tableRef, cell)) .collect(Collectors.toList()); } private  AtlasLockDescriptorUtils(); static List<CellReference> candidateCells(LockDescriptor lockDescriptor); static Optional<TableRefAndRemainder> tryParseTableRef(LockDescriptor lockDescriptor);  }