Package org.bct.api

Class NestedTokenizer.Token

java.lang.Object
org.bct.api.NestedTokenizer.Token
Enclosing class:
NestedTokenizer

public static class NestedTokenizer.Token extends Object
Represents a parsed token with optional nested sub-tokens.

A Token contains a string value and may have nested tokens representing the content inside braces. Tokens support deep nesting for complex hierarchical structures.

Structure:
  • value: The main token value (part before any braces)
  • nested: Optional list of nested tokens (content within braces)
Examples:
  • "foo"Token{value="foo", nested=null}
  • "foo{a,b}"Token{value="foo", nested=[Token{value="a"}, Token{value="b"}]}
  • Constructor Details

    • Token

      public Token(String value)
      Creates a new token with the specified value.
      Parameters:
      value - The token value
  • Method Details

    • getValue

      public String getValue()
      Returns the main value of this token.
      Returns:
      The token value
    • hasNested

      public boolean hasNested()
      Returns true if this token has nested content.
      Returns:
      true if nested tokens exist
    • getNested

      public List<NestedTokenizer.Token> getNested()
      Returns an unmodifiable view of the nested tokens.
      Returns:
      unmodifiable list of nested tokens, or empty list if none
    • setNested

      void setNested(List<NestedTokenizer.Token> nested)
      Sets the nested tokens for this token (package-private for tokenizer use).
      Parameters:
      nested - The list of nested tokens
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object