From d766896972c9e9be4a9e0021ec5f4f0665901865 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sat, 9 Sep 2017 21:46:16 -0300 Subject: Update Most of it is documentation changes. The rest is more work on BlockReaders, as well as a simple command language for configuring them. --- .../bjc/utils/ioutils/blocks/LayeredBlockReader.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java b/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java index 54010fe..967a1f2 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java +++ b/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java @@ -14,9 +14,15 @@ import java.io.IOException; * */ public class LayeredBlockReader implements BlockReader { - private final BlockReader first; - private final BlockReader second; + /* + * The readers to drain from. + */ + private final BlockReader first; + private final BlockReader second; + /* + * The current block number. + */ private int blockNo; /** @@ -42,13 +48,16 @@ public class LayeredBlockReader implements BlockReader { public Block getBlock() { final Block firstBlock = first.getBlock(); + /* + * Only drain a block from the second reader if none are + * available in the first reader. + */ return firstBlock == null ? second.getBlock() : firstBlock; } @Override public boolean nextBlock() { final boolean gotFirst = first.nextBlock(); - final boolean succ = gotFirst ? gotFirst : second.nextBlock(); if (succ) { @@ -69,4 +78,4 @@ public class LayeredBlockReader implements BlockReader { first.close(); } -} \ No newline at end of file +} -- cgit v1.2.3