Package com.attivio.sdk.token
Class TokenIterator
- java.lang.Object
-
- com.attivio.sdk.token.TokenSink
-
- com.attivio.sdk.token.TokenIterator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TokenIterator.State
Experimental: contains an opaque iteration state that can be used to reposition a token iterator.
-
Field Summary
-
Fields inherited from class com.attivio.sdk.token.TokenSink
DEFAULT_POSITION_INCREMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TokenIterator(TokenList tokens)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Token t, int increment)
Appends a token.Token
getNext()
Gets the next Token, without advancing the pointer.int
getNextPositionIncrement()
Returns the position increment for the next Tokenint
getPositionIncrement()
Returns the position increment for the current TokenTokenIterator.State
getState()
Experimental: Get the current state of iteration.boolean
hasNext()
true
if a next element existsToken
next()
Moves the iterator to the next Token in the TokenList and returns that token.void
remove()
Removes the current Token from the TokenListvoid
restoreState(TokenIterator.State state)
Experimental: restore the state of iteration fromstate
.void
saveState(TokenIterator.State state)
Experimental: save the current state of iteration tostate
.void
set(Token t)
Replaces the current Token with a new Tokenvoid
set(java.lang.String t)
Replaces the current Token with a new Tokenvoid
setPositionIncrement(int increment)
Sets the position increment for the current Token-
Methods inherited from class com.attivio.sdk.token.TokenSink
add, add, add, add, add, append, append, append, append, endScope, endScope, startLanguageRegion, startScope, startScope
-
-
-
-
Constructor Detail
-
TokenIterator
protected TokenIterator(TokenList tokens)
Constructor
-
-
Method Detail
-
hasNext
public boolean hasNext()
true
if a next element exists- Specified by:
hasNext
in interfacejava.util.Iterator<Token>
-
next
public Token next()
Moves the iterator to the next Token in the TokenList and returns that token.- Specified by:
next
in interfacejava.util.Iterator<Token>
-
getNext
public Token getNext()
Gets the next Token, without advancing the pointer.
-
getNextPositionIncrement
public int getNextPositionIncrement()
Returns the position increment for the next Token
-
getPositionIncrement
public int getPositionIncrement()
Returns the position increment for the current Token- Returns:
- the position increment for the current Token
-
setPositionIncrement
public void setPositionIncrement(int increment)
Sets the position increment for the current Token
-
set
public void set(java.lang.String t)
Replaces the current Token with a new Token- Parameters:
t
- The string value for the new Token to replace the current Token
-
set
public void set(Token t)
Replaces the current Token with a new Token- Parameters:
t
- The Token to replace the current Token with
-
add
public void add(Token t, int increment)
Appends a token.
-
remove
public void remove()
Removes the current Token from the TokenList- Specified by:
remove
in interfacejava.util.Iterator<Token>
-
getState
public TokenIterator.State getState()
Experimental: Get the current state of iteration.NOTE: it is recommended that you create a minimal number of saved states. States can be reused by calling
saveState(State)
to save the current state of iteration to an existingTokenIterator.State
instance.
-
saveState
public void saveState(TokenIterator.State state)
Experimental: save the current state of iteration tostate
.
-
restoreState
public void restoreState(TokenIterator.State state)
Experimental: restore the state of iteration fromstate
.
-
-