ur_rna.Utilities

## Class SimpleDataSerializer

- java.lang.Object
- - ur_rna.Utilities.SimpleDataSerializer

-     public class SimpleDataSerializer
      extends java.lang.Object

  SimpleDataSerializer Serializes Lists, Maps and primitive types (Strings, Numbers, Booleans) to a simple text format. Capable of reading JSON as well as SSON, a simplified form of JSON defined here. SSON (Simple Structured Object Notation) is less strict than JSON. SSON allows the following: - In Maps, quotes are not required for property names (as long as they conform to the rules of unquoted strings described later). - Commas are optional between elements of Lists and Maps - C-style Single-line and multi-line comments are allowed. - Strings do not require quotes if they start with a letter and contain only letters, numbers, and the symbols underscore (_) dot (.) and hyphen (-) - Arrays can have an optional primitive type constraints: e.g. [%i 1 2 3 4 ] [%d 1.1 0.2 3.7 4 ] [%s "a" "b" "c" ] i=int L=long f=float d=double k=byte b=bool s=string (default) ------ Not yet implemented: ----------- - Addition of Tables, which represent an array of same-structured objects in a compact form. [%% "A" "B" "C" | O1.A O1.B O1.C | O2.A O2.B O2.C | O3.A O3.B O3.C ] Instead of: [ { A:O1.A, B:O1.B, C:O1.C} { A:O2.A, B:O2.B, C:O2.C} { A:O3.A, B:O3.B, C:O3.C} ]

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SimpleDataSerializer.OutputFormatSettings`
    `private class` | `SimpleDataSerializer.ParseContext`
    `static class` | `SimpleDataSerializer.SSONList`
    `static class` | `SimpleDataSerializer.SSONMap`
    `(package private) static class` | `SimpleDataSerializer.Token`
    `(package private) static class` | `SimpleDataSerializer.TokenPattern`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.lang.String` | `END_TOKEN`
    `private static java.util.regex.Matcher` | `identifierMatcher`
    `private static int` | `STRING_ESCAPE_OPTIONS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleDataSerializer()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private int[]` | `buildSourceIndex(java.lang.CharSequence input)`
    `private java.lang.String` | `formatTrace(java.util.Queue<java.lang.String> trace)`
    `private boolean` | `isListOrMap(java.lang.Object o)`
    `java.lang.Object` | `parse(java.lang.CharSequence input, int[] characterSourceIndex)` Parses text into an SONMap characterSourceIndex is an array that provides information about the original line and column of a particular character index in the final input code.
    `private java.lang.Object` | `parseArray(SimpleDataSerializer.ParseContext ctx)`
    `private java.lang.Number` | `parseNumber(SimpleDataSerializer.Token t, SimpleDataSerializer.ParseContext ctx)`
    `private java.lang.Object` | `parseObject(SimpleDataSerializer.ParseContext ctx)`
    `private java.lang.Object` | `parseSONValue(SimpleDataSerializer.ParseContext ctx)`
    `private java.lang.String` | `parseString(SimpleDataSerializer.Token t, SimpleDataSerializer.ParseContext ctx)`
    `static java.lang.String` | `quoteIfNeeded(java.lang.String s)`
    `(package private) SyntaxErrorException` | `syntaxErr(java.lang.String message, int pos, int[] sourceIndex, java.lang.String offendingText)`
    `(package private) SimpleDataSerializer.Token[]` | `tokenize(java.lang.CharSequence input, int[] index, boolean dropWhitespace, boolean dropComments)`
    `java.lang.String` | `toString(java.lang.Object value, SimpleDataSerializer.OutputFormatSettings settings)`
    `void` | `write(java.lang.Object value, java.io.Writer out, SimpleDataSerializer.OutputFormatSettings settings)`
    `private void` | `write(java.lang.Object value, java.io.Writer out, SimpleDataSerializer.OutputFormatSettings settings, java.util.Queue<java.lang.String> trace)`
    `private void` | `writeIndent(java.io.Writer out, SimpleDataSerializer.OutputFormatSettings settings, int level)`
    `private void` | `writeList(java.util.List<?> value, java.io.Writer out, SimpleDataSerializer.OutputFormatSettings settings, java.util.Queue<java.lang.String> trace)`
    `private void` | `writeMap(java.util.Map<?,?> value, java.io.Writer out, SimpleDataSerializer.OutputFormatSettings settings, java.util.Queue<java.lang.String> trace)`
    `private java.lang.String` | `writeNumber(java.lang.Number n, SimpleDataSerializer.OutputFormatSettings settings)`
    `private java.lang.String` | `writeString(java.lang.String s, boolean forceQuotes)`

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

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

- - ### Field Detail

    - #### END_TOKEN

          private static final java.lang.String END_TOKEN

      See Also:
        Constant Field Values

    - #### identifierMatcher

          private static transient java.util.regex.Matcher identifierMatcher

    - #### STRING_ESCAPE_OPTIONS

          private static final int STRING_ESCAPE_OPTIONS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SimpleDataSerializer

          public SimpleDataSerializer()

  - ### Method Detail

    - #### buildSourceIndex

          private int[] buildSourceIndex(java.lang.CharSequence input)

    - #### formatTrace

          private java.lang.String formatTrace(java.util.Queue<java.lang.String> trace)

    - #### isListOrMap

          private boolean isListOrMap(java.lang.Object o)

    - #### parse

          public java.lang.Object parse(java.lang.CharSequence input,
                                        @Nullable
                                        int[] characterSourceIndex)
                                 throws SyntaxErrorException

      Parses text into an SONMap characterSourceIndex is an array that provides information about the original line and column of a particular character index in the final input code. The format is [ index1, line1, col1, index2, line2, col2, ... ] such that if an error is found at index=531, the characterSourceIndex can be searched until one index_a < 531 < index_b. Then the original line is line_a and the original column is (531 - index_a + column_a).
      Throws:
        `SyntaxErrorException`

    - #### parseArray

          private java.lang.Object parseArray(SimpleDataSerializer.ParseContext ctx)
                                       throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### parseNumber

          private java.lang.Number parseNumber(SimpleDataSerializer.Token t,
                                               SimpleDataSerializer.ParseContext ctx)
                                        throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### parseObject

          private java.lang.Object parseObject(SimpleDataSerializer.ParseContext ctx)
                                        throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### parseSONValue

          private java.lang.Object parseSONValue(SimpleDataSerializer.ParseContext ctx)
                                          throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### parseString

          private java.lang.String parseString(SimpleDataSerializer.Token t,
                                               SimpleDataSerializer.ParseContext ctx)
                                        throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### quoteIfNeeded

          public static java.lang.String quoteIfNeeded(java.lang.String s)

    - #### syntaxErr

          SyntaxErrorException syntaxErr(java.lang.String message,
                                         int pos,
                                         int[] sourceIndex,
                                         @Nullable
                                         java.lang.String offendingText)

    - #### tokenize

          SimpleDataSerializer.Token[] tokenize(java.lang.CharSequence input,
                                                int[] index,
                                                boolean dropWhitespace,
                                                boolean dropComments)
                                         throws SyntaxErrorException

      Throws:
        `SyntaxErrorException`

    - #### toString

          public java.lang.String toString(java.lang.Object value,
                                           SimpleDataSerializer.OutputFormatSettings settings)
                                    throws FormatterException

      Throws:
        `FormatterException`

    - #### write

          public void write(java.lang.Object value,
                            java.io.Writer out,
                            SimpleDataSerializer.OutputFormatSettings settings)
                     throws java.io.IOException,
                            FormatterException

      Throws:
        `java.io.IOException`
        `FormatterException`

    - #### write

          private void write(java.lang.Object value,
                             java.io.Writer out,
                             SimpleDataSerializer.OutputFormatSettings settings,
                             java.util.Queue<java.lang.String> trace)
                      throws java.io.IOException,
                             FormatterException

      Throws:
        `java.io.IOException`
        `FormatterException`

    - #### writeIndent

          private void writeIndent(java.io.Writer out,
                                   SimpleDataSerializer.OutputFormatSettings settings,
                                   int level)
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeList

          private void writeList(java.util.List<?> value,
                                 java.io.Writer out,
                                 SimpleDataSerializer.OutputFormatSettings settings,
                                 java.util.Queue<java.lang.String> trace)
                          throws java.io.IOException,
                                 FormatterException

      Throws:
        `java.io.IOException`
        `FormatterException`

    - #### writeMap

          private void writeMap(java.util.Map<?,?> value,
                                java.io.Writer out,
                                SimpleDataSerializer.OutputFormatSettings settings,
                                java.util.Queue<java.lang.String> trace)
                         throws java.io.IOException,
                                FormatterException

      Throws:
        `java.io.IOException`
        `FormatterException`

    - #### writeNumber

          private java.lang.String writeNumber(java.lang.Number n,
                                               SimpleDataSerializer.OutputFormatSettings settings)

    - #### writeString

          private java.lang.String writeString(java.lang.String s,
                                               boolean forceQuotes)