diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-31 08:49:17 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-31 08:49:17 -0400 |
| commit | 21db48520acfd6e6ac175aa5df12e50c6be2c767 (patch) | |
| tree | 722a3f3b889a7d6d76ac056bdc47b66204ca657a /BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java | |
| parent | daceafeeb90680116c289a7c301c42eb3e57eb97 (diff) | |
Move FDS to new project
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java b/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java deleted file mode 100644 index a245471..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package bjc.utils.cli.fds; - -import static bjc.utils.ioutils.BlockReaders.pushback; -import static bjc.utils.ioutils.BlockReaders.simple; -import static bjc.utils.ioutils.BlockReaders.trigger; - -import java.io.PrintStream; -import java.io.Reader; - -import bjc.utils.cli.fds.FDSState.InputMode; -import bjc.utils.ioutils.BlockReader; -import bjc.utils.ioutils.Prompter; -import bjc.utils.ioutils.PushbackBlockReader; - -/** - * Utilities for dealing with FDS - * - * @author bjculkin - * - */ -public class FDSUtils { - /** - * Run a FDS instance from a reader. - * - * @param reader - * The reader to use. - * - * @param out - * The output stream to use. - * - * @param mode - * The mode to use. - * - * @param ctx - * The initial state. - * - * @return The final state. - * - * @throws FDSException - * If something goes wrong. - */ - public static <S> S runFromReader(Reader reader, PrintStream out, FDSMode<S> mode, S ctx) throws FDSException { - BlockReader input = simple("\\R", reader); - - Prompter comPrompter = new Prompter("Enter a command (m for help): ", out); - Prompter dataPrompter = new Prompter("> ", out); - - BlockReader rawComInput = trigger(input, comPrompter); - BlockReader rawDataInput = trigger(input, dataPrompter); - - PushbackBlockReader comInput = pushback(rawComInput); - PushbackBlockReader dataInput = pushback(rawDataInput); - - FDSState<S> fdsState = new FDSState<>(ctx, InputMode.NORMAL, comInput, dataInput, out, - dataPrompter::setPrompt, "> "); - - fdsState.modes.push(mode); - - FDS.runFDS(fdsState); - - return ctx; - } -}
\ No newline at end of file |
