|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
ru.biosoft.access.IndexTable
IndexTable extention of hash table for work with database indexes. Build index file for flat file and then use them.
| Field Summary | |
protected static org.apache.log4j.Category |
cat
log |
protected java.lang.String |
delimiters
Delimiter characters. |
static java.lang.String |
ENTRY_DELIMITERS_PROPERTY
|
static java.lang.String |
ENTRY_END_PROPERTY
|
static java.lang.String |
ENTRY_ID_PROPERTY
|
static java.lang.String |
ENTRY_START_PROPERTY
|
static java.lang.String |
INDEX_SUFFIX
|
protected java.io.RandomAccessFile |
indexFile
Index file. |
protected java.io.File |
indexFileName
Name of index file. |
protected java.util.Vector |
indexList
The vector of sorted alphabetically field values. |
protected java.lang.String |
startKey
Name of indexed startKey. |
| Constructor Summary | |
IndexTable(java.io.RandomAccessFile f,
java.lang.String startKey,
java.util.Properties properties)
Creates a IndexTable, that contains indexes for entry searching by specified line (startKey). |
|
| Method Summary | |
protected void |
addKey(java.lang.String key)
Add key to the index list. |
void |
close()
|
protected java.lang.String |
extractKey(java.lang.String data,
java.lang.String start,
java.lang.String delimiters)
Parse data and extract key from it. |
protected void |
finalize()
Free resources. |
ru.biosoft.access.IndexTable.Index |
get(java.lang.String key)
Gets the index value associated with index key. |
ru.biosoft.access.IndexTable.Index |
put(java.io.RandomAccessFile f,
Entry entry)
Put new entry to the file and puts the corresponding entry index table. |
ru.biosoft.access.IndexTable.Index |
put(java.io.RandomAccessFile f,
java.lang.String entry)
Put new entry to the file and puts the corresponding entry index table. |
void |
putIndex(java.lang.String key,
ru.biosoft.access.IndexTable.Index value)
Put new index into index table. |
void |
removeIndex(java.lang.String key)
Remove the key from the index table. |
protected void |
writeIndex(java.lang.String key,
ru.biosoft.access.IndexTable.Index ind)
|
protected void |
writeIndex(java.lang.String key,
int from,
int len)
Write the index to file. |
| Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String INDEX_SUFFIX
public static final java.lang.String ENTRY_DELIMITERS_PROPERTY
public static final java.lang.String ENTRY_START_PROPERTY
public static final java.lang.String ENTRY_ID_PROPERTY
public static final java.lang.String ENTRY_END_PROPERTY
protected java.lang.String delimiters
Default value is: ";\t\r\n".
protected java.lang.String startKey
protected java.util.Vector indexList
protected java.io.RandomAccessFile indexFile
protected java.io.File indexFileName
protected static org.apache.log4j.Category cat
| Constructor Detail |
public IndexTable(java.io.RandomAccessFile f,
java.lang.String startKey,
java.util.Properties properties)
throws java.lang.Exception
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).
f - database filestartKey - name of line (startKey) for indexation.properties - data to turn in entry parsing.| Method Detail |
protected void writeIndex(java.lang.String key,
int from,
int len)
throws java.io.IOException
key - the key
java.io.IOException
protected void writeIndex(java.lang.String key,
ru.biosoft.access.IndexTable.Index ind)
throws java.io.IOException
java.io.IOException
protected void finalize()
throws java.lang.Throwable
java.lang.Throwable - If error occured.close()protected void addKey(java.lang.String key)
public ru.biosoft.access.IndexTable.Index get(java.lang.String key)
key - the specified index key
protected java.lang.String extractKey(java.lang.String data,
java.lang.String start,
java.lang.String delimiters)
throws java.lang.Exception
data - Text with key.start - Start tag after which key is placed.delimiters - Set of symbols that not contained in the key.
java.lang.Exception
public void putIndex(java.lang.String key,
ru.biosoft.access.IndexTable.Index value)
throws java.io.IOException
key - index key.value - index value.
java.io.IOException
public ru.biosoft.access.IndexTable.Index put(java.io.RandomAccessFile f,
Entry entry)
throws java.lang.Exception
f - the database fileentry - database entry that will be added
java.lang.Exception
public ru.biosoft.access.IndexTable.Index put(java.io.RandomAccessFile f,
java.lang.String entry)
throws java.lang.Exception
f - the database fileentry - database entry that will be added
java.lang.Exception
public void removeIndex(java.lang.String key)
throws java.io.IOException
key - key to be removed.
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||