| java.lang.Object org.syntax.jedit.KeywordMap
KeywordMap | public class KeywordMap (Code) | | 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.
This class is used by CTokenMarker to map keywords to ids.
author: Slava Pestov, Mike Dillon version: $Id$ |
Inner Class :class Keyword | |
Constructor Summary | |
public | KeywordMap(boolean ignoreCase) Creates a new KeywordMap . | public | KeywordMap(boolean ignoreCase, int mapLength) Creates a new KeywordMap . |
mapLength | protected int mapLength(Code) | | |
KeywordMap | public KeywordMap(boolean ignoreCase)(Code) | | Creates a new KeywordMap .
Parameters: ignoreCase - True if keys are case insensitive |
KeywordMap | public KeywordMap(boolean ignoreCase, int mapLength)(Code) | | Creates a new KeywordMap .
Parameters: ignoreCase - True if the keys are case insensitive Parameters: mapLength - The number of `buckets' to create.A value of 52 will give good performance for most maps. |
add | public void add(String keyword, byte id)(Code) | | Adds a key-value mapping.
Parameters: keyword - The key |
getIgnoreCase | public boolean getIgnoreCase()(Code) | | Returns true if the keyword map is set to be case insensitive,
false otherwise.
|
getSegmentMapKey | protected int getSegmentMapKey(Segment s, int off, int len)(Code) | | |
getStringMapKey | protected int getStringMapKey(String s)(Code) | | |
lookup | public byte lookup(Segment text, int offset, int length)(Code) | | Looks up a key.
Parameters: text - The text segment Parameters: offset - The offset of the substring within the text segment Parameters: length - The length of the substring |
setIgnoreCase | public void setIgnoreCase(boolean ignoreCase)(Code) | | Sets if the keyword map should be case insensitive.
Parameters: ignoreCase - True if the keyword map should be caseinsensitive, false otherwise |
|
|