Skip to content

Commit d0e6052

Browse files
committed
Consistent argument naming
1 parent a27aacb commit d0e6052

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/main/java/org/janelia/saalfeldlab/n5/shard/DatasetAccess.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@
2323
*/
2424
public interface DatasetAccess<T> {
2525

26-
DataBlock<T> readBlock(PositionValueAccess kva, long[] gridPosition) throws N5IOException;
26+
DataBlock<T> readBlock(PositionValueAccess pva, long[] gridPosition) throws N5IOException;
2727

28-
void writeBlock(PositionValueAccess kva, DataBlock<T> dataBlock) throws N5IOException;
28+
void writeBlock(PositionValueAccess pva, DataBlock<T> dataBlock) throws N5IOException;
2929

30-
boolean deleteBlock(PositionValueAccess kva, long[] gridPosition) throws N5IOException;
30+
boolean deleteBlock(PositionValueAccess pva, long[] gridPosition) throws N5IOException;
3131

3232

33-
List<DataBlock<T>> readBlocks(PositionValueAccess kva, List<long[]> positions) throws N5IOException;
33+
List<DataBlock<T>> readBlocks(PositionValueAccess pva, List<long[]> positions) throws N5IOException;
3434

35-
void writeBlocks(PositionValueAccess kva, List<DataBlock<T>> blocks) throws N5IOException;
35+
void writeBlocks(PositionValueAccess pva, List<DataBlock<T>> blocks) throws N5IOException;
3636

3737
// TODO:
38-
// boolean deleteBlocks(PositionValueAccess kva, List<long[]> positions) throws N5IOException;
38+
// boolean deleteBlocks(PositionValueAccess pva, List<long[]> positions) throws N5IOException;
3939

4040

4141
/**
@@ -91,7 +91,6 @@ void writeRegion(
9191
ExecutorService exec
9292
) throws N5Exception, InterruptedException, ExecutionException;
9393

94-
9594
NestedGrid getGrid();
9695

9796
/**
@@ -104,6 +103,7 @@ void writeRegion(
104103
* @param outerLevel of the outerLevel shard position to group by. must be in range {@code [1, NestedGrid.numLevels() - 1]}
105104
* @return map of outerLevel shard positions to inner level block positions
106105
*/
106+
// TODO: move to Nesting
107107
static <T extends NestedPosition> Collection<List<T>> groupInnerPositions(final NestedGrid grid, final List<T> innerPositions, final int outerLevel) {
108108

109109
if (outerLevel < 1 || outerLevel >= grid.numLevels())

src/main/java/org/janelia/saalfeldlab/n5/shard/DefaultDatasetAccess.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public NestedGrid getGrid() {
3535
}
3636

3737
@Override
38-
public DataBlock<T> readBlock(final PositionValueAccess kva, final long[] gridPosition) throws N5IOException {
38+
public DataBlock<T> readBlock(final PositionValueAccess pva, final long[] gridPosition) throws N5IOException {
3939
final NestedPosition position = grid.nestedPosition(gridPosition);
40-
return readBlockRecursive(kva.get(position.key()), position, grid.numLevels() - 1);
40+
return readBlockRecursive(pva.get(position.key()), position, grid.numLevels() - 1);
4141
}
4242

4343
private DataBlock<T> readBlockRecursive(
@@ -347,23 +347,23 @@ private ReadData writeRegionRecursive(
347347
}
348348

349349
@Override
350-
public boolean deleteBlock(final PositionValueAccess kva, final long[] gridPosition) throws N5IOException {
350+
public boolean deleteBlock(final PositionValueAccess pva, final long[] gridPosition) throws N5IOException {
351351
final NestedPosition position = grid.nestedPosition(gridPosition);
352352
final long[] key = position.key();
353353
if (grid.numLevels() == 1) {
354354
// for non-sharded dataset, don't bother getting the value, just remove the key.
355355
try {
356-
return kva.remove(key);
356+
return pva.remove(key);
357357
} catch (final Exception e) {
358358
throw new N5Exception("The shard at " + Arrays.toString(key) + " could not be deleted.", e);
359359
}
360360
} else {
361-
final ReadData existingData = kva.get(key);
361+
final ReadData existingData = pva.get(key);
362362
final ReadData modifiedData = deleteBlockRecursive(existingData, position, grid.numLevels() - 1);
363363
if (existingData != null && modifiedData == null) {
364-
return kva.remove(key);
364+
return pva.remove(key);
365365
} else if (modifiedData != existingData) {
366-
kva.put(key, modifiedData);
366+
pva.put(key, modifiedData);
367367
return true;
368368
} else {
369369
return false;

0 commit comments

Comments
 (0)