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

Quick Search    Search Deep

com.memoire.jedit
Class JEditKeywordMap  view JEditKeywordMap download JEditKeywordMap.java

java.lang.Object
  extended bycom.memoire.jedit.JEditKeywordMap

public class JEditKeywordMap
extends java.lang.Object

A JEditKeywordMap 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 JEditCTokenMarker to map keywords to ids.

Version:
$Id: JEditKeywordMap.java,v 1.3 2001/07/25 17:39:05 desnoix Exp $

Nested Class Summary
(package private)  class JEditKeywordMap.Keyword
           
 
Field Summary
private  boolean ignoreCase
           
private  JEditKeywordMap.Keyword[] map
           
protected  int mapLength
           
 
Constructor Summary
JEditKeywordMap(boolean ignoreCase)
          Creates a new JEditKeywordMap.
JEditKeywordMap(boolean ignoreCase, int mapLength)
          Creates a new JEditKeywordMap.
 
Method Summary
 void add(java.lang.String keyword, byte id)
          Adds a key-value mapping.
 boolean getIgnoreCase()
          Returns true if the keyword map is set to be case insensitive, false otherwise.
protected  int getSegmentMapKey(javax.swing.text.Segment s, int off, int len)
           
protected  int getStringMapKey(java.lang.String s)
           
 byte lookup(javax.swing.text.Segment text, int offset, int length)
          Looks up a key.
 void setIgnoreCase(boolean ignoreCase)
          Sets if the keyword map should be case insensitive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapLength

protected int mapLength

map

private JEditKeywordMap.Keyword[] map

ignoreCase

private boolean ignoreCase
Constructor Detail

JEditKeywordMap

public JEditKeywordMap(boolean ignoreCase)
Creates a new JEditKeywordMap.


JEditKeywordMap

public JEditKeywordMap(boolean ignoreCase,
                       int mapLength)
Creates a new JEditKeywordMap.

Method Detail

lookup

public byte lookup(javax.swing.text.Segment text,
                   int offset,
                   int length)
Looks up a key.


add

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


getIgnoreCase

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


setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)
Sets if the keyword map should be case insensitive.


getStringMapKey

protected int getStringMapKey(java.lang.String s)

getSegmentMapKey

protected int getSegmentMapKey(javax.swing.text.Segment s,
                               int off,
                               int len)