20 package net.sf.gridarta.textedit.textarea.tokenmarker;
22 import javax.swing.text.Segment;
63 public byte
lookup(
final Segment text,
final int offset,
final int length) {
65 for (
int i = offset, end = offset + length; i < end; i++) {
66 node = node.
lookup(ignoreCase ? Character.toUpperCase(text.array[i]) : text.array[i]);
79 public void add(
final CharSequence keyword,
final byte
id) {
81 for (
int i = 0, len = keyword.length(); i < len; i++) {
82 node = node.
define(ignoreCase ? Character.toUpperCase(keyword.charAt(i)) : keyword.charAt(i));
byte getId()
Returns the id for this node.
void setId(final byte id)
Sets the id to return for this node.
final boolean ignoreCase
Whether case should be ignored when matching keys.
Node define(final char ch)
Looks up or defines the next node for a given character.
byte lookup(final Segment text, final int offset, final int length)
Looks up a key.
void add(final CharSequence keyword, final byte id)
Adds a key-value mapping.
Base package of all Gridarta classes.
Node lookup(final char ch)
Looks up the next node for a given character.
final Node rootNode
The root node.
KeywordMap(final boolean ignoreCase)
Creates a new instance.
This package contains the other part of the script editor.
Maps (parts of) Segments to.
static final byte NULL
Normal text token id.
A node in the tree that is used to store all key-value pairs.