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 classTokenIterator.StateExperimental: 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 protectedTokenIterator(TokenList tokens)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Token t, int increment)Appends a token.TokengetNext()Gets the next Token, without advancing the pointer.intgetNextPositionIncrement()Returns the position increment for the next TokenintgetPositionIncrement()Returns the position increment for the current TokenTokenIterator.StategetState()Experimental: Get the current state of iteration.booleanhasNext()trueif a next element existsTokennext()Moves the iterator to the next Token in the TokenList and returns that token.voidremove()Removes the current Token from the TokenListvoidrestoreState(TokenIterator.State state)Experimental: restore the state of iteration fromstate.voidsaveState(TokenIterator.State state)Experimental: save the current state of iteration tostate.voidset(Token t)Replaces the current Token with a new Tokenvoidset(java.lang.String t)Replaces the current Token with a new TokenvoidsetPositionIncrement(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()
trueif a next element exists- Specified by:
hasNextin interfacejava.util.Iterator<Token>
-
next
public Token next()
Moves the iterator to the next Token in the TokenList and returns that token.- Specified by:
nextin 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:
removein 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.Stateinstance.
-
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.
-
-