Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

novaworx.syntax
Class KeywordMap  view KeywordMap download KeywordMap.java

java.lang.Object
  extended bynovaworx.syntax.KeywordMap

public class KeywordMap
extends java.lang.Object

A KeywordMap is similar to a hashtable in that it maps keys to values. However, the keys are Swing segments. This allows lookups of text substrings without the overhead of creating a new string object.


Nested Class Summary
private  class KeywordMap.Keyword
           
 
Field Summary
private  KeywordMap.Keyword[] maKeywords
           
private  boolean mbIgnoreCase
           
protected  int miMapLength
           
private  java.lang.StringBuffer moNoWordSeparators
           
 
Constructor Summary
KeywordMap(boolean abIgnoreCase)
          Create a new KeywordMap.
KeywordMap(boolean abIgnoreCase, int aiMapLength)
          Create a new KeywordMap.
 
Method Summary
 void add(java.lang.String asKeyword, byte ayID)
          Adds a key-value mapping.
 boolean getIgnoreCase()
          Returns true if the keyword maKeywords is set to be case insensitive, false otherwise.
 java.lang.String[] getKeywords()
          Returns an array containing all keywords in this keyword map.
 java.lang.String getNonAlphaNumericChars()
          Returns all non-alphanumeric characters that appear in the keywords of this keyword maKeywords.
protected  int getSegmentMapKey(javax.swing.text.Segment aoSegment, int aiOffset, int aiLength)
           
protected  int getStringMapKey(java.lang.String asString)
           
 byte lookup(javax.swing.text.Segment aoText, int aiOffset, int aiLength)
          Look up a key.
 void setIgnoreCase(boolean abIgnoreCase)
          Sets if the keyword maKeywords should be case insensitive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maKeywords

private KeywordMap.Keyword[] maKeywords

mbIgnoreCase

private boolean mbIgnoreCase

moNoWordSeparators

private java.lang.StringBuffer moNoWordSeparators

miMapLength

protected int miMapLength
Constructor Detail

KeywordMap

public KeywordMap(boolean abIgnoreCase)
Create a new KeywordMap.


KeywordMap

public KeywordMap(boolean abIgnoreCase,
                  int aiMapLength)
Create a new KeywordMap.

Method Detail

lookup

public byte lookup(javax.swing.text.Segment aoText,
                   int aiOffset,
                   int aiLength)
Look up a key.


add

public void add(java.lang.String asKeyword,
                byte ayID)
Adds a key-value mapping.


getNonAlphaNumericChars

public java.lang.String getNonAlphaNumericChars()
Returns all non-alphanumeric characters that appear in the keywords of this keyword maKeywords.


getKeywords

public java.lang.String[] getKeywords()
Returns an array containing all keywords in this keyword map.


getIgnoreCase

public boolean getIgnoreCase()
Returns true if the keyword maKeywords is set to be case insensitive, false otherwise.


setIgnoreCase

public void setIgnoreCase(boolean abIgnoreCase)
Sets if the keyword maKeywords should be case insensitive.


getStringMapKey

protected int getStringMapKey(java.lang.String asString)

getSegmentMapKey

protected int getSegmentMapKey(javax.swing.text.Segment aoSegment,
                               int aiOffset,
                               int aiLength)