java.lang.Object
novaworx.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.
|
Constructor Summary |
KeywordMap(boolean abIgnoreCase)
Create a new KeywordMap. |
KeywordMap(boolean abIgnoreCase,
int aiMapLength)
Create a new KeywordMap. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
maKeywords
private KeywordMap.Keyword[] maKeywords
mbIgnoreCase
private boolean mbIgnoreCase
moNoWordSeparators
private java.lang.StringBuffer moNoWordSeparators
miMapLength
protected int miMapLength
KeywordMap
public KeywordMap(boolean abIgnoreCase)
- Create a new
KeywordMap.
KeywordMap
public KeywordMap(boolean abIgnoreCase,
int aiMapLength)
- Create a new
KeywordMap.
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)