ur_rna.StructureEditor.services.fileIO

## Class DrawingFileIO.SimpleScanner

- java.lang.Object
- - ur_rna.StructureEditor.services.fileIO.DrawingFileIO.SimpleScanner

- Enclosing class:
    DrawingFileIO

      private static class DrawingFileIO.SimpleScanner
      extends java.lang.Object

  This replacement for Scanner automatically skips whitespace, but does NOT skip over newlines unless `nextLine()` is called. The primary reason that this class was created (and that Scanner was unacceptable) was that if Scanner's delimiter were set to just spaces and tabs, but not newlines, it would fail to recognize valid content at the end of a line. for example getNextInt() would fail for "3\n". This class allows testing (and extracting the results of) Patterns directly against the content of the current line (at the current read position) without regard to delimiters, whereas Scanner seems to only allow the testing of Patterns against pre-delimited text. For example: Text: "Hello there!" `Scanner(text).hasNext("Hello There") => false` (because the test is only applied to { "Hello", "There!" }[0] `SimpleScanner(text).hasNext("Hello There") => true` (although whitespace BEFORE a match has already been skipped, it can still be matched in the subsequent content.) In general, Scanner's hasNextXXX functions are replaced by atXXX. `Scanner.hasNext()` is replaced by a (negated) call to `atEndOfLine()`. This function also keeps track of the current line and column numbers so users can be provided with more detailed information about where a potential error was found.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.util.regex.Pattern` | `ANY`
    `private static java.util.regex.Pattern` | `BOOL`
    `private static java.lang.String` | `END_TOKEN`
    `protected boolean` | `eof`
    `private java.lang.String` | `line`
    `protected int` | `lineNum`
    `protected java.util.regex.Matcher` | `matcher`
    `private static java.util.regex.Pattern` | `NUM`
    `protected int` | `pos`
    `protected java.io.BufferedReader` | `reader`
    `private static java.util.regex.Pattern` | `SPACE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleScanner(java.io.Reader input)`
    `SimpleScanner(java.lang.String content)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `accept()`
    `boolean` | `at(java.util.regex.Pattern pattern)`
    `boolean` | `atBool()`
    `boolean` | `atEndOfLine()`
    `boolean` | `atEOF()`
    `boolean` | `atNumber()`
    `int` | `colNumber()`
    `int` | `lineNumber()`
    `protected boolean` | `matchNext(java.util.regex.Pattern p)`
    `java.lang.String` | `next()` Returns the text of the next token, regardless of type, and advance the read position.
    `java.lang.String` | `next(java.util.regex.Pattern pattern)`
    `boolean` | `nextBool()`
    `double` | `nextDouble()`
    `float` | `nextFloat()`
    `int` | `nextInt()`
    `java.lang.String` | `nextLine()` Returns the remaining content on the current line (i.e.
    `java.util.regex.MatchResult` | `nextMatch(java.util.regex.Pattern pattern)`
    `java.lang.String` | `peek()` Returns the text of the next token, regardless of type, but does not advance the read position.
    `java.util.regex.MatchResult` | `peekMatch(java.util.regex.Pattern pattern)` Returns a Matchresult if the pattern was matched, or null otherwise.
    `protected boolean` | `readLine()`
    `protected java.lang.String` | `require(java.util.regex.Pattern pattern)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ANY

          private static final java.util.regex.Pattern ANY

    - #### BOOL

          private static final java.util.regex.Pattern BOOL

    - #### END_TOKEN

          private static final java.lang.String END_TOKEN

      See Also:
        Constant Field Values

    - #### eof

          protected boolean eof

    - #### line

          private java.lang.String line

    - #### lineNum

          protected int lineNum

    - #### matcher

          protected java.util.regex.Matcher matcher

    - #### NUM

          private static final java.util.regex.Pattern NUM

    - #### pos

          protected int pos

    - #### reader

          protected final java.io.BufferedReader reader

    - #### SPACE

          private static final java.util.regex.Pattern SPACE

  - ### Constructor Detail

    - #### SimpleScanner

          public SimpleScanner(java.io.Reader input)

    - #### SimpleScanner

          public SimpleScanner(java.lang.String content)

  - ### Method Detail

    - #### accept

          protected void accept()

    - #### at

          public boolean at(java.util.regex.Pattern pattern)

    - #### atBool

          public boolean atBool()

    - #### atEndOfLine

          public boolean atEndOfLine()

    - #### atEOF

          public boolean atEOF()

    - #### atNumber

          public boolean atNumber()

    - #### colNumber

          public int colNumber()

    - #### lineNumber

          public int lineNumber()

    - #### matchNext

          protected boolean matchNext(java.util.regex.Pattern p)

    - #### next

          public java.lang.String next()

      Returns the text of the next token, regardless of type, and advance the read position.

    - #### next

          public java.lang.String next(java.util.regex.Pattern pattern)

    - #### nextBool

          public boolean nextBool()

    - #### nextDouble

          public double nextDouble()

    - #### nextFloat

          public float nextFloat()

    - #### nextInt

          public int nextInt()

    - #### nextLine

          public java.lang.String nextLine()

      Returns the remaining content on the current line (i.e. the substring after the current read position). Also advances the read position to the next line, so that subsequent queries (atXXX) and extractions (getXXX) will be applied to the next line.

    - #### nextMatch

          public java.util.regex.MatchResult nextMatch(java.util.regex.Pattern pattern)

    - #### peek

          public java.lang.String peek()

      Returns the text of the next token, regardless of type, but does not advance the read position.

    - #### peekMatch

          public java.util.regex.MatchResult peekMatch(java.util.regex.Pattern pattern)

      Returns a Matchresult if the pattern was matched, or null otherwise.

    - #### readLine

          protected boolean readLine()

    - #### require

          protected java.lang.String require(java.util.regex.Pattern pattern)