net.sf.intltyper.lib
Class KeySequenceList

java.lang.Object
  extended bynet.sf.intltyper.lib.KeySequenceList

public class KeySequenceList
extends java.lang.Object

A list of key/value pairs used to map key sequences to characters.


Field Summary
private  java.util.Map completions
           
private  java.io.File file
           
private  KeySequenceList parent
           
 
Constructor Summary
KeySequenceList(KeySequenceList parent)
          Creates a new KeySequenceList
KeySequenceList(KeySequenceList parent, java.io.File file)
          Creates a new KeySequenceList
KeySequenceList(KeySequenceList parent, java.io.InputStream in)
          Creates a new KeySequenceList
 
Method Summary
 java.lang.String get(java.lang.String key)
          Return a value for a key.
 java.util.Set getKeys()
          Return a Set containing all keys (from both this list and its parent).
private  java.util.HashSet getKeySet()
          Return a Set containing all keys (from both this list and its parent).
 java.util.Set getLocalKeys()
          Return a Set containing keys only from this list.
 boolean hasDef(java.lang.String value)
          Check if there is a (public) key for a value.
private  void initData(java.io.InputStream in)
          Initialize a KeySequenceList from an InputStream.
 void put(java.lang.String key, java.lang.String value)
          Put a key/value pair into this list.
 void save()
          Save the keys from this list to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

completions

private java.util.Map completions

file

private java.io.File file

parent

private KeySequenceList parent
Constructor Detail

KeySequenceList

public KeySequenceList(KeySequenceList parent)
Creates a new KeySequenceList

Parameters:
parent - the KeySequenceList to look at for unknown key sequences

KeySequenceList

public KeySequenceList(KeySequenceList parent,
                       java.io.File file)
                throws java.io.IOException
Creates a new KeySequenceList

Parameters:
parent - the KeySequenceList to look at for unknown key sequences
file - file to load and save key sequences to
Throws:
java.io.IOException - if an error occurs

KeySequenceList

public KeySequenceList(KeySequenceList parent,
                       java.io.InputStream in)
                throws java.io.IOException
Creates a new KeySequenceList

Parameters:
parent - the KeySequenceList to look at for unknown key sequences
in - InputStream to load KeySequences from
Throws:
java.io.IOException - if an error occurs
Method Detail

initData

private void initData(java.io.InputStream in)
               throws java.io.IOException
Initialize a KeySequenceList from an InputStream.

Throws:
java.io.IOException

get

public java.lang.String get(java.lang.String key)
Return a value for a key. If the value is not found, the parent list is asked.


put

public void put(java.lang.String key,
                java.lang.String value)
Put a key/value pair into this list.


getKeySet

private java.util.HashSet getKeySet()
Return a Set containing all keys (from both this list and its parent).


getKeys

public java.util.Set getKeys()
Return a Set containing all keys (from both this list and its parent).


getLocalKeys

public java.util.Set getLocalKeys()
Return a Set containing keys only from this list.


hasDef

public boolean hasDef(java.lang.String value)
Check if there is a (public) key for a value.


save

public void save()
Save the keys from this list to a file.