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/FDSState.java | |
| parent | daceafeeb90680116c289a7c301c42eb3e57eb97 (diff) | |
Move FDS to new project
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSState.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSState.java | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSState.java b/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSState.java deleted file mode 100644 index e28e6bc..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/cli/fds/FDSState.java +++ /dev/null @@ -1,144 +0,0 @@ -package bjc.utils.cli.fds; - -import java.io.PrintStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - -import bjc.utils.esodata.SimpleStack; -import bjc.utils.esodata.Stack; -import bjc.utils.ioutils.Block; -import bjc.utils.ioutils.PushbackBlockReader; - -/** - * Internal state for an FDS interface. - * - * @author bjculkin - * - * @param <S> - * The state type of the interface. - */ -public class FDSState<S> { - /** - * The input mode for the interface. - * - * @author bjculkin - * - */ - public static enum InputMode { - /** - * Normal mode. - * - * Reads only the first character in the block as a command. - */ - NORMAL, - /** - * Reads every character in the block as a command. - */ - CHORD, - /** - * Reads every character in the block, but after a terminal - * command, data will be read in-line separated by spaces until - * a semicolon is read. - * - * The semicolon can be escaped with a backslash. - */ - INLINE; - } - - /** - * The state of the interface - */ - public S state; - /** - * The input mode for the interface. - */ - public InputMode mode; - - /** - * The modes being used. - */ - public Stack<FDSMode<S>> modes; - - /** - * The source to read command blocks from. - */ - public PushbackBlockReader comin; - - /** - * The source to read data blocks from. - */ - public PushbackBlockReader datain; - - /** - * The destination for output. - */ - public PrintStream printer; - - /** - * The repository for data macros. - */ - public Map<String, List<Block>> dataMacros; - - /** - * The repository for command macros. - */ - public Map<String, List<Block>> commandMacros; - - FDSMode<S> dataMacroMode; - FDSMode<S> comMacroMode; - - /** - * Function to change the current data prompt. - */ - public Consumer<String> dataPrompter; - - /** - * The default data prompt. - */ - public String defaultPrompt; - - /** - * Create a new interface state. - * - * @param stat - * The initial state for the interface. - * - * @param inputMode - * The input mode for the interface. - * @param cmin - * The source of command blocks. - * - * @param datin - * The source of data blocks. - * - * @param print - * The destination for output. - * @param dataPrompt - * The function to use for changing the data prompt. - * - * @param normalPrompt - * The default data prompt. - */ - public FDSState(S stat, InputMode inputMode, PushbackBlockReader cmin, PushbackBlockReader datin, - PrintStream print, Consumer<String> dataPrompt, String normalPrompt) { - state = stat; - mode = inputMode; - - comin = cmin; - datain = datin; - printer = print; - - dataPrompter = dataPrompt; - defaultPrompt = normalPrompt; - - modes = new SimpleStack<>(); - - dataMacros = new HashMap<>(); - commandMacros = new HashMap<>(); - - dataMacroMode = new MacroFDSMode<>(dataMacros, datain::addBlock); - comMacroMode = new MacroFDSMode<>(commandMacros, comin::addBlock); - } -}
\ No newline at end of file |
