TokenUtils
Date: 2017-02-11

org.fife.ui.rsyntaxtextarea

## Class TokenUtils

- java.lang.Object
- - org.fife.ui.rsyntaxtextarea.TokenUtils

-     public class TokenUtils
      extends java.lang.Object

  Utility methods for dealing with tokens.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TokenUtils.TokenSubList`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TokenUtils.TokenSubList` | `getSubTokenList(Token tokenList, int pos, javax.swing.text.TabExpander e, RSyntaxTextArea textArea, float x0)` Modifies the passed-in token list to start at the specified offset.
    `static TokenUtils.TokenSubList` | `getSubTokenList(Token tokenList, int pos, javax.swing.text.TabExpander e, RSyntaxTextArea textArea, float x0, TokenImpl tempToken)` Modifies the passed-in token list to start at the specified offset.

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

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

- - ### Method Detail

    - #### getSubTokenList

          public static TokenUtils.TokenSubList getSubTokenList(Token tokenList,
                                                int pos,
                                                javax.swing.text.TabExpander e,
                                                RSyntaxTextArea textArea,
                                                float x0)

      Modifies the passed-in token list to start at the specified offset. For example, if the token list covered positions 20-60 in the document (inclusive) like so:

             [token1] -> [token2] -> [token3] -> [token4]
             20     30   31     40   41     50   51     60

      and you used this method to make the token list start at position 44, then the token list would be modified to be the following:

             [part-of-old-token3] -> [token4]
             44                 50   51     60

      Tokens that come before the specified position are forever lost, and the token containing that position is made to begin at that position if necessary. All token types remain the same as they were originally.

      This method can be useful if you are only interested in part of a token list (i.e., the line it represents), but you don't want to modify the token list yourself.

      Parameters:
        `tokenList` - The list to make start at the specified position. This parameter is modified.
        `pos` - The position at which the new token list is to start. If this position is not in the passed-in token list, returned token list will either be `null` or the unpaintable token(s) at the end of the passed-in token list.
        `e` - How to expand tabs.
        `textArea` - The text area from which the token list came.
        `x0` - The initial x-pixel position of the old token list.
      Returns:
        Information about the "sub" token list. This will be `null` if `pos` was not a valid offset into the token list.
      See Also:
        `getSubTokenList(Token, int, TabExpander, RSyntaxTextArea, float, TokenImpl)`

    - #### getSubTokenList

          public static TokenUtils.TokenSubList getSubTokenList(Token tokenList,
                                                int pos,
                                                javax.swing.text.TabExpander e,
                                                RSyntaxTextArea textArea,
                                                float x0,
                                                TokenImpl tempToken)

      Modifies the passed-in token list to start at the specified offset. For example, if the token list covered positions 20-60 in the document (inclusive) like so:

             [token1] -> [token2] -> [token3] -> [token4]
             20     30   31     40   41     50   51     60

      and you used this method to make the token list start at position 44, then the token list would be modified to be the following:

             [part-of-old-token3] -> [token4]
             44                 50   51     60

      Tokens that come before the specified position are forever lost, and the token containing that position is made to begin at that position if necessary. All token types remain the same as they were originally.

      This method can be useful if you are only interested in part of a token list (i.e., the line it represents), but you don't want to modify the token list yourself.

      Parameters:
        `tokenList` - The list to make start at the specified position. This parameter is modified.
        `pos` - The position at which the new token list is to start. If this position is not in the passed-in token list, returned token list will either be `null` or the unpaintable token(s) at the end of the passed-in token list.
        `e` - How to expand tabs.
        `textArea` - The text area from which the token list came.
        `x0` - The initial x-pixel position of the old token list.
        `tempToken` - A temporary token to use when creating the token list result. This may be `null` but callers can pass in a "buffer" token for performance if desired.
      Returns:
        Information about the "sub" token list. This will be `null` if `pos` was not a valid offset into the token list.
      See Also:
        `getSubTokenList(Token, int, TabExpander, RSyntaxTextArea, float)`