summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-09-09 21:46:16 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-09-09 21:47:34 -0300
commitd766896972c9e9be4a9e0021ec5f4f0665901865 (patch)
tree1f6473300ef86e0697d682360bea0d28fc144baa /BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java
parent40f3a28569366c4357fbda11d2fff3b77686d84f (diff)
Update
Most of it is documentation changes. The rest is more work on BlockReaders, as well as a simple command language for configuring them.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java17
1 files changed, 13 insertions, 4 deletions
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
+}