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

TokenContextPath (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class TokenContextPath

java.lang.Object
  extended by org.netbeans.editor.TokenContextPath

public final class TokenContextPath
extends Object

Immutable and 'interned' wrapper holding an array of the contexts starting with the original context in which the token is defined and ending with the target context from which the token is being returned. It is final and has no public constructor. The only entrypoint is through the get() method. It's guaranteed that the two context-paths containing the same contexts in the same order are the same objects and the equal-operator can be used instead of calling equals().


Method Summary
 boolean contains(TokenContextPath tcp)
          Does this path contain the given path.
 TokenContextPath getBase()
          Get the base path which corresponds to only the first context in the context-array.
 TokenContext[] getContexts()
          Retrieve the contexts of this context-path.
 String getFullTokenName(TokenCategory tokenIDOrCategory)
          Get the token-name with the name-prefix of this context-path.
 String getNamePrefix()
          Get the prefix that this context adds to the name of its tokens.
 TokenContextPath getParent()
          Get parent context-path that consists of all the contexts of this path except the last one.
 int length()
          Get the length of the path returning the length of the contexts array.
 TokenContextPath replaceStart(TokenContextPath byPath)
          Get the path which has the initial part of the path (usually only the base path) replaced by the given path.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContexts

public TokenContext[] getContexts()
Retrieve the contexts of this context-path. The contexts of the context-array must NOT be modified in any way.


length

public int length()
Get the length of the path returning the length of the contexts array.


getParent

public TokenContextPath getParent()
Get parent context-path that consists of all the contexts of this path except the last one.


getBase

public TokenContextPath getBase()
Get the base path which corresponds to only the first context in the context-array. The base path can be used for fast checking of the origin path of the token.


contains

public boolean contains(TokenContextPath tcp)
Does this path contain the given path. It corresponds to the situation when the contexts of the given path are at the begining of this path.


replaceStart

public TokenContextPath replaceStart(TokenContextPath byPath)
Get the path which has the initial part of the path (usually only the base path) replaced by the given path. The length of the replaced part of the path is the same as the length of the path that will replace it. For better performance the method caches the [byPath, result-path] in hashmap.

Parameters:
byPath - path that will replace the initial portion of this path. The length of the portion is the same as the length of this parameter.
Returns:
the path with the initial part being replaced.

getNamePrefix

public String getNamePrefix()
Get the prefix that this context adds to the name of its tokens.


getFullTokenName

public String getFullTokenName(TokenCategory tokenIDOrCategory)
Get the token-name with the name-prefix of this context-path. It merges the token-name with the name-prefix of this context-path but it does it without creating a new object.


toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.editor.lib/1 1.14.0 3

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