HEADER

ru.biosoft.access
Class IndexTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--ru.biosoft.access.IndexTable

public class IndexTable
extends Hashtable

IndexTable extention of hash table for work with database indexes. Build index file for flat file and then use them.

Version: 1.0
pending temporary implementation (speed up), urgent This class should be removed.

Field Summary
 final static StringENTRY_DELIMITERS_PROPERTY
           
 final static StringENTRY_END_PROPERTY
           
 final static StringENTRY_ID_PROPERTY
           
 final static StringENTRY_START_PROPERTY
           
 final static StringINDEX_SUFFIX
           

Constructor Summary
IndexTable(RandomAccessFile f, String startKey, Properties properties)
          Creates a IndexTable, that contains indexes for entry searching by specified line (startKey).

Method Summary
 voidclose()
           
 Indexget(String key)
          Gets the index value associated with index key.
 Indexput(RandomAccessFile f, ru.biosoft.access.Entry entry)
          Put new entry to the file and puts the corresponding entry index table.
 Indexput(RandomAccessFile f, String entry)
          Put new entry to the file and puts the corresponding entry index table.
 synchronized voidputIndex(String key, Index value)
          Put new index into index table.
 synchronized voidremoveIndex(String key)
          Remove the key from the index table.

Methods inherited from class java.util.Hashtable
size, isEmpty, keys, elements, contains, containsValue, containsKey, get, put, remove, putAll, clear, clone, toString, keySet, entrySet, values, equals, hashCode

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait

Field Detail

ENTRY_DELIMITERS_PROPERTY

public final static String ENTRY_DELIMITERS_PROPERTY

ENTRY_END_PROPERTY

public final static String ENTRY_END_PROPERTY

ENTRY_ID_PROPERTY

public final static String ENTRY_ID_PROPERTY

ENTRY_START_PROPERTY

public final static String ENTRY_START_PROPERTY

INDEX_SUFFIX

public final static String INDEX_SUFFIX
Constructor Detail

IndexTable

public IndexTable(RandomAccessFile f, String startKey, Properties properties)
throws java.lang.Exception
Creates a IndexTable, that contains indexes for entry searching by specified line (startKey). Also puts index in sorted array of strings.

Note. It is a very simple version. Only one index per entry is created. The index value is the first substring in the first approprate entry line (startKey).

Parameters:
f - database file
startKey - name of line (startKey) for indexation.
properties - data to turn in entry parsing.
Method Detail

close

public void close()
throws java.io.IOException

get

public Index get(String key)
Gets the index value associated with index key.
Parameters:
key - the specified index key
Returns: the index value or null if the key is not defined in the index table.

put

public Index put(RandomAccessFile f, ru.biosoft.access.Entry entry)
throws java.lang.Exception
Put new entry to the file and puts the corresponding entry index table.
Parameters:
f - the database file
entry - database entry that will be added
Returns: the new entry index

put

public Index put(RandomAccessFile f, String entry)
throws java.lang.Exception
Put new entry to the file and puts the corresponding entry index table.
Parameters:
f - the database file
entry - database entry that will be added
Returns: the new entry index

putIndex

public synchronized void putIndex(String key, Index value)
throws java.io.IOException
Put new index into index table.
Parameters:
key - index key.
value - index value.
Returns: the old value of the key, or null if it did not have one.

removeIndex

public synchronized void removeIndex(String key)
throws java.io.IOException
Remove the key from the index table.
Parameters:
key - key to be removed.

Association Links

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

Delimiter characters.

Default value is: ";\t\r\n".

to Class java.lang.String

String from wich any entry is started. Default value is: "ID".

to Class java.lang.String

String by wich any entry is finished. Default value is: "//" .

to Class java.lang.String

Name of indexed startKey.

to Class java.util.Vector

The vector of sorted alphabetically field values.

to Class java.io.RandomAccessFile

Index file.

to Class java.io.File

Name of index file.

to Class org.apache.log4j.Category

log

FOOTER

BOTTOM