diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 16:40:33 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-04-10 16:40:33 -0400 |
| commit | 889fac2bdf993dc86f64a8893c0260fdcf848acb (patch) | |
| tree | 99ed08552efa86fdc5fdf4ddb8720d10e599fafe /BJC-Utils2/src/main/java/bjc/utils/ioutils/blocks/LayeredBlockReader.java | |
| parent | 1656b02144446aeedebb3d1179e07ed99c01861c (diff) | |
Cleanup
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.java | 24 |
1 files changed, 13 insertions, 11 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 9ece6df..54010fe 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 @@ -5,30 +5,30 @@ import java.io.IOException; /** * A block reader that supports draining all the blocks from one reading before * swapping to another. - * + * * This is more a 'prioritize blocks from one over the other', than a 'read all * the blocks from one, then all the blocks from the other'. If you need that, * look at {@link SerialBlockReader}. - * + * * @author bjculkin * */ public class LayeredBlockReader implements BlockReader { - private BlockReader first; - private BlockReader second; + private final BlockReader first; + private final BlockReader second; private int blockNo; /** * Create a new layered block reader. - * + * * @param primary * The first source to read blocks from. - * + * * @param secondary * The second source to read blocks from. */ - public LayeredBlockReader(BlockReader primary, BlockReader secondary) { + public LayeredBlockReader(final BlockReader primary, final BlockReader secondary) { first = primary; second = secondary; } @@ -40,18 +40,20 @@ public class LayeredBlockReader implements BlockReader { @Override public Block getBlock() { - Block firstBlock = first.getBlock(); + final Block firstBlock = first.getBlock(); return firstBlock == null ? second.getBlock() : firstBlock; } @Override public boolean nextBlock() { - boolean gotFirst = first.nextBlock(); + final boolean gotFirst = first.nextBlock(); - boolean succ = gotFirst ? gotFirst : second.nextBlock(); + final boolean succ = gotFirst ? gotFirst : second.nextBlock(); - if (succ) blockNo += 1; + if (succ) { + blockNo += 1; + } return succ; } |
