站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

TokenChange (Lexer) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.lexer/2 1.19.0 1

org.netbeans.api.lexer
Class TokenChange<T extends TokenId>

java.lang.Object
  extended by org.netbeans.api.lexer.TokenChange<T>

public final class TokenChange<T extends TokenId>
extends Object

Token change describes modification on one level of a token hierarchy.
If there is only one token that was modified and there was a language embedding in that token then most of the embedded tokens can usually be retained. This defines an embedded change accessible by embeddedChange(int).
There may possibly be multiple levels of the embedded changes.


Method Summary
 int addedTokenCount()
          Get number of the tokens added by this token change.
 TokenSequence<T> currentTokenSequence()
          Get the token sequence that corresponds to the current state of the token hierarchy.
 TokenChange<? extends TokenId> embeddedChange(int index)
          Get embedded change at the given index.
<T extends TokenId>
TokenChange<T>
embeddedChange(Language<T> language)
          Get embedded token change of the given type.
 int embeddedChangeCount()
          Get number of embedded changes contained in this change.
 int index()
          Get index of the first token being modified.
 boolean isBoundsChange()
          Whether this change only modifies bounds of a single token.
 Language<T> language()
          Get the language describing token ids used by tokens contained in this token change.
 LanguagePath languagePath()
          Get the complete language path of the tokens contained in this token sequence (containing outer language levels as well).
 int offset()
          Get offset of the first token that was modified.
 int removedTokenCount()
          Get number of removed tokens contained in this token change.
 TokenSequence<T> removedTokenSequence()
          Create token sequence over the removed tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

embeddedChangeCount

public int embeddedChangeCount()
Get number of embedded changes contained in this change.

Returns:
>=0 number of embedded changes.

embeddedChange

public TokenChange<? extends TokenId> embeddedChange(int index)
Get embedded change at the given index.

Parameters:
index - 0 <= index <= embeddedChangeCount() index of the embedded change.
Returns:
non-null embedded token change.

embeddedChange

public <T extends TokenId> TokenChange<T> embeddedChange(Language<T> language)
Get embedded token change of the given type.

Returns:
non-null token change or null if the embedded token change satisfies the condition (embedded().language() == language). Null is returned otherwise.

language

public Language<T> language()
Get the language describing token ids used by tokens contained in this token change.


languagePath

public LanguagePath languagePath()
Get the complete language path of the tokens contained in this token sequence (containing outer language levels as well).


index

public int index()
Get index of the first token being modified.


offset

public int offset()
Get offset of the first token that was modified.
If there were any added/removed tokens then this is a start offset of the first added/removed token.


removedTokenCount

public int removedTokenCount()
Get number of removed tokens contained in this token change.


removedTokenSequence

public TokenSequence<T> removedTokenSequence()
Create token sequence over the removed tokens.

There is no analogy of this method for the added tokens. The currentTokenSequence() may be used for exploration of the current token sequence at this level.

Returns:
token sequence over the removed tokens or null if there were no removed tokens.

addedTokenCount

public int addedTokenCount()
Get number of the tokens added by this token change.


currentTokenSequence

public TokenSequence<T> currentTokenSequence()
Get the token sequence that corresponds to the current state of the token hierarchy.
The token sequence will be positioned at the index().
If this is an embedded token change then this method returns the token sequence at the corresponding embedded level.


isBoundsChange

public boolean isBoundsChange()
Whether this change only modifies bounds of a single token.
This flag is only set if there was a single token removed and a new single token added with the same token id in terms of this change.
For bounds changes the affected offsets of the event will only cover the modified characters (not the modified tokens boundaries).


org.netbeans.modules.lexer/2 1.19.0 1

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.