com.ihr.xbrl.xbrlq

## Class QueryParser

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<E>
    - - java.util.ArrayList<java.lang.String>
      - - com.ihr.xbrl.xbrlq.QueryParser

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, java.util.List<java.lang.String>, java.util.RandomAccess

      public class QueryParser
      extends java.util.ArrayList<java.lang.String>

  The Class QueryParser.
  Author:
    Ignacio
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `QueryParser.Position` The Class Position.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryParser(java.lang.String query)` Instantiates a new query parser.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `QueryParser.Position` | `getPosition()` Gets the position.
    `boolean` | `hasNext()` Checks for next.
    `java.lang.String` | `peek()` Peek.
    `java.lang.String` | `remainingString()` Used to obtain the unparsed query string.
    `java.lang.String` | `searchToken(java.lang.String[] tokenList)` Search the remaining tokens in the query for any of the tokens in the array received as a parameter.
    `java.lang.String[]` | `searchTwoTokens(java.lang.String[] firstToken, java.lang.String[] nextToken)` Search for any of the tokens in the list of firstTokens.
    `void` | `setPosition(QueryParser.Position newPosition)` Sets the position.
    `java.lang.String` | `textBeforeTwoTokens(java.lang.String[] operators, java.lang.String[] tokens)` returns the text from the current position to the position of the next two tokens.

    - ### Methods inherited from class java.util.ArrayList

      `add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray, trimToSize`

    - ### Methods inherited from class java.util.AbstractList

      `equals, hashCode`

    - ### Methods inherited from class java.util.AbstractCollection

      `containsAll, toString`

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

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.List

      `containsAll, equals, hashCode`

- - ### Constructor Detail

    - #### QueryParser

          public QueryParser(java.lang.String query)

      Instantiates a new query parser.
      Parameters:
        `query` - the query

  - ### Method Detail

    - #### peek

          public java.lang.String peek()

      Peek.
      Returns:
        the string

    - #### hasNext

          public boolean hasNext()

      Checks for next.
      Returns:
        true, if successful

    - #### getPosition

          public QueryParser.Position getPosition()

      Gets the position.
      Returns:
        the position

    - #### setPosition

          public void setPosition(QueryParser.Position newPosition)

      Sets the position.
      Parameters:
        `newPosition` - the new position

    - #### searchToken

          public java.lang.String searchToken(java.lang.String[] tokenList)

      Search the remaining tokens in the query for any of the tokens in the array received as a parameter. If the token is found then the queue is advanced to the position of the token found.
      Parameters:
        `tokenList` - the token list
      Returns:
        the string

    - #### searchTwoTokens

          public java.lang.String[] searchTwoTokens(java.lang.String[] firstToken,
                                           java.lang.String[] nextToken)

      Search for any of the tokens in the list of firstTokens. If one is found then the next token in the tokens list is compared against the list of nextTokens. if one is found then the queue is advanced to the end of the second token and the two consecutive tokens are returned. If it is not found then the queue is not advanced.
      Parameters:
        `firstToken` - the first token
        `nextToken` - the next token
      Returns:
        the string[]

    - #### remainingString

          public java.lang.String remainingString()

      Used to obtain the unparsed query string. Useful for generating error messages
      Returns:
        the string

    - #### textBeforeTwoTokens

          public java.lang.String textBeforeTwoTokens(java.lang.String[] operators,
                                             java.lang.String[] tokens)

      returns the text from the current position to the position of the next two tokens.
      Parameters:
        `operators` - the operators
        `tokens` - the tokens
      Returns:
        the string