Klasse StringList

java.lang.Object
opennlp.tools.util.StringList
Alle implementierten Schnittstellen:
Iterable<String>

public class StringList extends Object implements Iterable<String>
A StringList is an immutable list of Strings.
  • Konstruktordetails

    • StringList

      public StringList(String singleToken)
      Initializes a StringList instance. By default, this instance is case-sensitive.

      Note:
      Token String will be interned via StringInterners.

      Parameter:
      singleToken - One single token
    • StringList

      public StringList(String... tokens)
      Initializes a StringList instance. By default, this instance is case-sensitive.

      Note:
      Token Strings will be interned via StringInterners.

      Parameter:
      tokens - The string parts of the new StringList. Must not be an empty tokens array or null.
      Löst aus:
      IllegalArgumentException - Thrown if parameters were invalid.
    • StringList

      public StringList(boolean isCaseSensitive, String... tokens)
      Initializes a StringList instance.

      Note:
      Token Strings will be interned via StringInterners.

      Parameter:
      isCaseSensitive - Whether it will operate case-sensitive, or not.
      tokens - The string parts of the new StringList. Must not be an empty tokens array or null.
      Löst aus:
      IllegalArgumentException - Thrown if parameters were invalid.
  • Methodendetails

    • getToken

      public String getToken(int index)
      Parameter:
      index - The index to get a token from.
      Gibt zurück:
      Retrieves a token from the given index.
    • size

      public int size()
      Gibt zurück:
      Retrieves the number of tokens inside this list.
    • iterator

      public Iterator<String> iterator()
      Angegeben von:
      iterator in Schnittstelle Iterable<String>
      Gibt zurück:
      Retrieves an Iterator over all tokens.
    • compareToIgnoreCase

      public boolean compareToIgnoreCase(StringList tokens)
      Compares to token list and ignores the case of the tokens. Note: This can cause problems with some locales.
      Parameter:
      tokens - The tokens used for comparison.
      Gibt zurück:
      true if identically with ignore the case, false otherwise.
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      A human-readable representation of this StringList.
    • isCaseSensitive

      public boolean isCaseSensitive()
      Gibt zurück:
      true, if this StringList is case-sensitive.
    • toCaseInsensitive

      public StringList toCaseInsensitive()
      Gibt zurück:
      If this StringList is case-insensitive, the same instance is returned. Otherwise, a new object is returned.
    • toCaseSensitive

      public StringList toCaseSensitive()
      Gibt zurück:
      If this StringList is case-sensitive, the same instance is returned. Otherwise, a new object is returned.