org.netbeans.modules.lexer/2 1.39.1 1

org.netbeans.spi.lexer
Enum EmbeddingPresence

java.lang.Object
  extended by java.lang.Enum<EmbeddingPresence>
      extended by org.netbeans.spi.lexer.EmbeddingPresence
All Implemented Interfaces:
Serializable, Comparable<EmbeddingPresence>

public enum EmbeddingPresence
extends Enum<EmbeddingPresence>

Defines whether a default embedding can be present for the given token id or not.
It allows to speed up TokenSequence.embedded() calls considerably in most cases.
This only affects the default embedding creation. Custom embedding creation can always be performed by TokenSequene.createEmbedding().


Enum Constant Summary
ALWAYS_QUERY
          Default embedding creation will always be attempted for each token since the embedding presence varies (it may depend on token's text or other token properties).
CACHED_FIRST_QUERY
          Creation of the default embedding for the particular TokenId will be attempted for the first time but if there will be no embedding created then there will be no other attempts for embedding creation for any tokens with the same token id.
NONE
          There is no default embedding for the given TokenId and its creation will not be attempted.
 
Method Summary
static EmbeddingPresence valueOf(String name)
          Returns the enum constant of this type with the specified name.
static EmbeddingPresence[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CACHED_FIRST_QUERY

public static final EmbeddingPresence CACHED_FIRST_QUERY
Creation of the default embedding for the particular TokenId will be attempted for the first time but if there will be no embedding created then there will be no other attempts for embedding creation for any tokens with the same token id.
This corresponds to the most usual case that the embedding presence only depends on a token id.
This is the default for LanguageHierarchy.embeddingPresence(org.netbeans.api.lexer.TokenId).


ALWAYS_QUERY

public static final EmbeddingPresence ALWAYS_QUERY
Default embedding creation will always be attempted for each token since the embedding presence varies (it may depend on token's text or other token properties).
For example if a string literal token would only qualify for an embedding if it would contain a '\' character but not otherwise then this method should return true for string literal token id.
This option presents no performance improvement.


NONE

public static final EmbeddingPresence NONE
There is no default embedding for the given TokenId and its creation will not be attempted.
This is useful e.g. for keywords and operators.

Method Detail

values

public static EmbeddingPresence[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (EmbeddingPresence c : EmbeddingPresence.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static EmbeddingPresence valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

org.netbeans.modules.lexer/2 1.39.1 1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.