Package com.attivio.sdk.token
Class TokenSink
- java.lang.Object
-
- com.attivio.sdk.token.TokenSink
-
- Direct Known Subclasses:
TokenIterator
,TokenList
public abstract class TokenSink extends java.lang.Object
Abstract class for objects that can have tokens added to them.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_POSITION_INCREMENT
Default position increment (1).
-
Constructor Summary
Constructors Constructor Description TokenSink()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(Token t)
Appends a token using the default position increment.void
add(TokenList tokens)
Adds all Tokens for the passed in TokenList to this TokenList.void
add(TokenList tokens, int increment)
Adds all Tokens for the passed in TokenListabstract void
add(Token t, int increment)
Appends a token.void
add(java.lang.String t)
Appends a token using the default position increment.void
add(java.lang.String t, int increment)
Appends a token.TokenSink
append(Token t)
Appends a token using the default position increment.TokenSink
append(Token t, int increment)
Appends a token.TokenSink
append(java.lang.String t)
Appends a token to this TokenList using the default position increment.TokenSink
append(java.lang.String t, int increment)
Appends a token.void
endScope(java.lang.String name)
Add anTokenAnnotation.SCOPE_END
token to the token list.void
endScope(java.lang.String name, int endOffset)
Add anTokenAnnotation.SCOPE_END
token to the token list.Token
startLanguageRegion(java.util.Locale locale)
Start a language region forlocale
.void
startScope(java.lang.String name)
Add anTokenAnnotation.SCOPE_START
token to the token list.void
startScope(java.lang.String name, int startOffset)
Add aTokenAnnotation.SCOPE_START
token to the token list.
-
-
-
Field Detail
-
DEFAULT_POSITION_INCREMENT
protected static final int DEFAULT_POSITION_INCREMENT
Default position increment (1).- See Also:
- Constant Field Values
-
-
Method Detail
-
startScope
public void startScope(java.lang.String name)
Add anTokenAnnotation.SCOPE_START
token to the token list.
-
startScope
public void startScope(java.lang.String name, int startOffset)
Add aTokenAnnotation.SCOPE_START
token to the token list.
-
startLanguageRegion
public Token startLanguageRegion(java.util.Locale locale)
Start a language region forlocale
.A
null
locale
will be encoded as an empty string.- Since:
- 5.5.0 patch 95
-
endScope
public void endScope(java.lang.String name)
Add anTokenAnnotation.SCOPE_END
token to the token list.
-
endScope
public void endScope(java.lang.String name, int endOffset)
Add anTokenAnnotation.SCOPE_END
token to the token list.
-
add
public final void add(java.lang.String t)
Appends a token using the default position increment.- Parameters:
t
- The string value of a Token to add
-
add
public final void add(java.lang.String t, int increment)
Appends a token.- Parameters:
t
- The string value of a Token to addincrement
- The position increment for the newly added token
-
add
public final void add(Token t)
Appends a token using the default position increment.- Parameters:
t
- The Token to add to this TokenList
-
add
public abstract void add(Token t, int increment)
Appends a token.- Parameters:
t
- The Token to addincrement
- The position increment for the newly added token
-
add
public final void add(TokenList tokens)
Adds all Tokens for the passed in TokenList to this TokenList.The first Token copied from the passed in TokenList will have the default position increment in this TokenList.
NOTE: The tokens in the passed in TokenList will be cloned prior to adding to this TokenList. Modifications to the passed in TokenList after calling add(TokenList) will not impact this TokenList.
- Parameters:
tokens
- The TokenList to copy onto the end of this TokenList.
-
add
public void add(TokenList tokens, int increment)
Adds all Tokens for the passed in TokenListNOTE: The tokens in the passed in TokenList will be cloned prior to being added. Modifications to the passed in TokenList after calling add(TokenList) will not impact this TokenSink.
- Parameters:
tokens
- The TokenList to add.increment
- The increment for the first Token added fromtokens
-
append
public TokenSink append(java.lang.String t)
Appends a token to this TokenList using the default position increment.- Parameters:
t
- The string value of a Token to add to this TokenList- Returns:
this
(supports call chaining)
-
append
public TokenSink append(java.lang.String t, int increment)
Appends a token.- Parameters:
t
- The string value of a Token to addincrement
- The position increment for the Token to add- Returns:
this
(supports call chaining)
-
append
public TokenSink append(Token t)
Appends a token using the default position increment.- Parameters:
t
- The Token to add- Returns:
this
(supports call chaining)
-
-