org.modeshape.common.text

## Class TokenStream.CaseSensitiveToken

- java.lang.Object
- - org.modeshape.common.text.TokenStream.CaseSensitiveToken

- All Implemented Interfaces:
    TokenStream.Token
  Direct Known Subclasses:
    TokenStream.CaseInsensitiveToken
  Enclosing class:
    TokenStream

      @Immutable
      protected class TokenStream.CaseSensitiveToken
      extends Object
      implements TokenStream.Token

  An immutable `TokenStream.Token` that implements matching using case-sensitive logic.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenStream.CaseSensitiveToken(int startIndex, int endIndex, int type, Position position)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `endIndex()` Get the index in the raw stream past the last character in the token.
    `int` | `length()` Get the length of the token, which is equivalent to `endIndex() - startIndex()`.
    `boolean` | `matches(char expected)` Determine if the token matches the supplied character.
    `boolean` | `matches(int expectedType)` Determine if the token matches the supplied type.
    `boolean` | `matches(String expected)` Determine if the token matches the supplied string.
    `protected String` | `matchString()`
    `Position` | `position()` Get the position of this token, which includes the line number and column number of the first character in the token.
    `int` | `startIndex()` Get the index in the raw stream for the first character in the token.
    `String` | `toString()`
    `int` | `type()` Get the type of the token.
    `String` | `value()` Get the value of the token, in actual case.
    `TokenStream.Token` | `withType(int typeMask)` Bitmask ORed with existing type value.

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

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

- - ### Constructor Detail

    - #### TokenStream.CaseSensitiveToken

          public TokenStream.CaseSensitiveToken(int startIndex,
                                        int endIndex,
                                        int type,
                                        Position position)

  - ### Method Detail

    - #### withType

          public TokenStream.Token withType(int typeMask)

      Bitmask ORed with existing type value.
      Specified by:
        `withType` in interface `TokenStream.Token`
      Returns:
        copy of Token with new type
      See Also:
        `TokenStream.Token.withType(int)`

    - #### type

          public final int type()

      Get the type of the token.
      Specified by:
        `type` in interface `TokenStream.Token`
      Returns:
        the token's type
      See Also:
        `TokenStream.Token.type()`

    - #### startIndex

          public final int startIndex()

      Get the index in the raw stream for the first character in the token.
      Specified by:
        `startIndex` in interface `TokenStream.Token`
      Returns:
        the starting index of the token
      See Also:
        `TokenStream.Token.startIndex()`

    - #### endIndex

          public final int endIndex()

      Get the index in the raw stream past the last character in the token.
      Specified by:
        `endIndex` in interface `TokenStream.Token`
      Returns:
        the ending index of the token, which is past the last character
      See Also:
        `TokenStream.Token.endIndex()`

    - #### length

          public final int length()

      Get the length of the token, which is equivalent to `endIndex() - startIndex()`.
      Specified by:
        `length` in interface `TokenStream.Token`
      Returns:
        the length
      See Also:
        `TokenStream.Token.length()`

    - #### matches

          public final boolean matches(char expected)

      Determine if the token matches the supplied character.
      Specified by:
        `matches` in interface `TokenStream.Token`
      Parameters:
        `expected` - the expected character value
      Returns:
        true if the token's value matches the supplied character value, or false otherwise
      See Also:
        `TokenStream.Token.matches(char)`

    - #### matches

          public final boolean matches(String expected)

      Determine if the token matches the supplied string.
      Specified by:
        `matches` in interface `TokenStream.Token`
      Parameters:
        `expected` - the expected value
      Returns:
        true if the token's value matches the supplied value, or false otherwise
      See Also:
        `TokenStream.Token.matches(java.lang.String)`

    - #### matches

          public final boolean matches(int expectedType)

      Determine if the token matches the supplied type.
      Specified by:
        `matches` in interface `TokenStream.Token`
      Parameters:
        `expectedType` - the expected integer type
      Returns:
        true if the token's value matches the supplied integer type, or false otherwise
      See Also:
        `TokenStream.Token.matches(int)`

    - #### value

          public final String value()

      Get the value of the token, in actual case.
      Specified by:
        `value` in interface `TokenStream.Token`
      Returns:
        the value
      See Also:
        `TokenStream.Token.value()`

    - #### position

          public Position position()

      Get the position of this token, which includes the line number and column number of the first character in the token.
      Specified by:
        `position` in interface `TokenStream.Token`
      Returns:
        the position; never null
      See Also:
        `TokenStream.Token.position()`

    - #### matchString

          protected String matchString()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.