Servertec
Persistent Object Store
1.4.1 09/04/2005

stec.pos
Class IndexReference

java.lang.Object
  extended by stec.pos.IndexReference
All Implemented Interfaces:
Iterator

public final class IndexReference
extends java.lang.Object
implements Iterator

Handle to the persistent Index returned by Index.open() used to interface with the opened Index.

Since:
1.1.0 09/01/2002
See Also:
open

Method Summary
 boolean add(java.lang.Object key, java.lang.Object value)
          Adds the specified key, value pair to the index.
 boolean ascending()
          Returns whether the current Index is sorted in ascending order.
 boolean atFirst()
          Returns whether the key, value pair cursor is at the first key, value pair.
 boolean atLast()
          Returns whether the key, value pair cursor is at the last key, value pair.
 void clear()
          Removes all the keys and associated values from the Index.
 void close()
          Closes this handle to the Index.
 boolean contains(java.lang.Object key, java.lang.Object value)
          Returns whether the Index contains the specified key, value pair.
 boolean containsKey(java.lang.Object key)
          Returns whether the Index contains the specified key associated with any value.
 boolean containsValue(java.lang.Object value)
          Returns whether the Index contains the specified value associated with any key.
 boolean duplicates()
          Returns whether the current Index supports duplicates.
 boolean first()
          Attempt to set the cursor to the first key, value pair.
 java.lang.Object get(java.lang.Object key)
          Returns the first value associated with the specified key and sets the current key, value pair cursor.
 java.lang.Object getCurrentKey()
          Returns the current key or null if none exists.
 java.lang.Object getCurrentValue()
          Returns the current value or null if none exists.
 java.lang.String getFilename()
          Returns the filename of the index this reference references.
 java.lang.String getKeysClassName()
          Returns the keys class name.
 java.lang.String getKeysIndexCollator()
          Returns the class name of the keys index collator.
 java.lang.String getValuesClassName()
          Returns the values class name.
 java.lang.String getValuesIndexCollator()
          Returns the class name of the values index collator.
 boolean iLocked(java.lang.Object key)
          Returns whether the current IndexReference has locked the specified key.
 boolean iReadLocked(java.lang.Object key)
          Returns whether the current IndexReference has read locked the specified key.
 boolean isEmpty()
          Returns whether the Index is empty.
 boolean isLocked(java.lang.Object key)
          Returns whether the specified key is locked.
 boolean isOpen()
          Returns whether the current IndexReference is still open.
 boolean isReadLocked(java.lang.Object key)
          Returns whether the specified read key is locked.
 boolean isSet()
          Returns whether the key, value pair cursor is set to a key, value pair.
 boolean isWriteLocked(java.lang.Object key)
          Returns whether the specified key is write locked.
 boolean iWriteLocked(java.lang.Object key)
          Returns whether the current IndexReference has write locked the specified key.
 boolean last()
          Attempt to set the cursor to the last key, value pair.
 void lock(java.lang.Object key)
          Write locks the specified key or waits until it can be write locked.
 boolean lock(java.lang.Object key, long timeout)
          Write locks the specified key or waits until it can be write locked or the specified timeout is reached.
 int lockCount()
          Returns the number of locked keys.
 int lockCount(java.lang.Object key)
          Returns the number of locks for the specified key.
 java.util.Enumeration locks()
          Returns an Enumeration of the locked keys.
 java.util.Enumeration locks(java.lang.Object key)
          Returns an Enumeration of the locks on the specified key.
 boolean next()
          Fowards the cursor and returns whether a next key, value pair exists.
 boolean next(IndexFilter filter)
          Forwards the cursor and returns whether a next key, value pair exists that meets the specified criteria.
 java.lang.Object nextKey()
          Returns the next key.
 java.lang.Object nextKey(IndexFilter filter)
          Returns the next key that meets the specified criteria.
 java.lang.Object nextValue()
          Returns the next value.
 java.lang.Object nextValue(boolean all_keys)
          Returns the next value.
 java.lang.Object nextValue(IndexFilter filter)
          Returns the next value that meets the specified criteria.
 java.lang.Object nextValue(IndexFilter filter, boolean all_keys)
          Returns the next value that meets the specified criteria.
 boolean previous()
          Moves the cursor back and returns whether a prior key, value pair exists.
 boolean previous(IndexFilter filter)
          Moves the cursor back and returns whether a prior key, value pair exists that meets the specified criteria.
 java.lang.Object previousKey()
          Returns the previous key.
 java.lang.Object previousKey(IndexFilter filter)
          Returns the previous key that meets the specified criteria.
 java.lang.Object previousValue()
          Returns the previous value.
 java.lang.Object previousValue(boolean all_keys)
          Returns the previous value.
 java.lang.Object previousValue(IndexFilter filter)
          Returns the previous value that meets the specified criteria.
 java.lang.Object previousValue(IndexFilter filter, boolean all_keys)
          Returns the previous value that meets the specified criteria.
 void readLock(java.lang.Object key)
          Read locks the specified key or waits until it can be read locked.
 boolean readLock(java.lang.Object key, long timeout)
          Read locks the specified key or waits until it can be read locked or the specified timeout is reached.
 void remove()
          Removes the current key, value pair from the Index.
 void remove(java.lang.Object key)
          Removes the specified key and associated values from the Index.
 void remove(java.lang.Object key, java.lang.Object value)
          Removes the specified key, value pair from the Index.
 boolean seek(java.lang.Object key)
          Sets the current cursor to the specified key.
 boolean seek(java.lang.Object key, java.lang.Object value)
          Sets the current cursor to the specified key, value pair.
 boolean setCurrentKey(java.lang.Object key)
          Sets the current key to the specified existing key.
 boolean setCurrentValue(java.lang.Object value)
          Sets the current value cursor to the specified existing value.
 boolean setCursor(java.lang.Object key, java.lang.Object value)
          Sets the current cursor to the specified existing key, value pair.
 int size()
          Returns the number of key, value pairs in the Index.
 void unlock(java.lang.Object key)
          Unlocks the specified key.
 void unlockAll()
          Clears all the locks to this Index.
 void unlockMine()
          Clears all the locks for the current IndexReference.
 int valueCount(java.lang.Object key)
          Returns the number of duplicate values associated with the specified key in the Index.
 void writeLock(java.lang.Object key)
          Write locks the specified key or waits until it can be write locked.
 boolean writeLock(java.lang.Object key, long timeout)
          Write locks the specified key or waits until it can be write locked or the specified timeout is reached.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public final void close()
                 throws java.io.IOException
Closes this handle to the Index.

Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
open

add

public final boolean add(java.lang.Object key,
                         java.lang.Object value)
                  throws java.io.IOException
Adds the specified key, value pair to the index.

Parameters:
key - the key to add.
value - the value to associate with the specified key.
Returns:
whether the specified key, value pair was added.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
remove, remove, remove

remove

public final void remove(java.lang.Object key)
                  throws java.io.IOException
Removes the specified key and associated values from the Index.

Invalidates the key, value pair cursor.

Parameters:
key - the key to remove.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
remove, remove, add

remove

public final void remove(java.lang.Object key,
                         java.lang.Object value)
                  throws java.io.IOException
Removes the specified key, value pair from the Index.

Invalidates the key, value pair cursor.

Parameters:
key - the key to remove.
value - the associated value to remove.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
remove, remove, add

remove

public final void remove()
                  throws java.io.IOException
Removes the current key, value pair from the Index.

Invalidates the key, value pair cursor.

Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
remove, remove, add

get

public final java.lang.Object get(java.lang.Object key)
                           throws java.io.IOException
Returns the first value associated with the specified key and sets the current key, value pair cursor.

Changes the key, value pair cursor if the specified key was found.

Parameters:
key - the key to retrieve.
Returns:
the first value associated with the specified key. Returns null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

containsKey

public final boolean containsKey(java.lang.Object key)
                          throws java.io.IOException
Returns whether the Index contains the specified key associated with any value.

Parameters:
key - the key to test.
Returns:
whether the Index contains the specified key associated with any value.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
containsValue, contains

containsValue

public final boolean containsValue(java.lang.Object value)
                            throws java.io.IOException
Returns whether the Index contains the specified value associated with any key.

Parameters:
value - the value to test.
Returns:
whether the Index contains the specified value associated with any key.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
containsKey, contains

contains

public final boolean contains(java.lang.Object key,
                              java.lang.Object value)
                       throws java.io.IOException
Returns whether the Index contains the specified key, value pair.

Parameters:
key - the key to test.
value - the value to test.
Returns:
whether the Index contains the specified key, value pair.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
containsKey, containsValue

setCursor

public final boolean setCursor(java.lang.Object key,
                               java.lang.Object value)
                        throws java.io.IOException
Sets the current cursor to the specified existing key, value pair.

Changes the key, value pair cursor if the specified key, value pair was found.

Specified by:
setCursor in interface Iterator
Parameters:
key - the key to set as the current key.
value - the value to set as the current value.
Returns:
whether the specified key, value pair exists and if the current key, value pair cursor could be set to the specified key, value pair.
Throws:
java.io.IOException - if an I/O exception occurred.

getCurrentKey

public final java.lang.Object getCurrentKey()
                                     throws java.io.IOException
Returns the current key or null if none exists.

Uses the key cursor.

Specified by:
getCurrentKey in interface Iterator
Returns:
the current key. null if none.
Throws:
java.io.IOException - if an I/O exception occurred.

getCurrentValue

public final java.lang.Object getCurrentValue()
                                       throws java.io.IOException
Returns the current value or null if none exists.

Uses the value cursor.

Specified by:
getCurrentValue in interface Iterator
Returns:
the current value. null if none.
Throws:
java.io.IOException - if an I/O exception occurred.

setCurrentKey

public final boolean setCurrentKey(java.lang.Object key)
                            throws java.io.IOException
Sets the current key to the specified existing key.

Changes the key, value pair cursor if the specified key was found.

Specified by:
setCurrentKey in interface Iterator
Parameters:
key - the key to set as the current key.
Returns:
whether the specified key exists and if the current key could be set to the specified key.
Throws:
java.io.IOException - if an I/O exception occurred.

setCurrentValue

public final boolean setCurrentValue(java.lang.Object value)
                              throws java.io.IOException
Sets the current value cursor to the specified existing value.

Changes the value cursor if the specified value was found.

Specified by:
setCurrentValue in interface Iterator
Parameters:
value - the value to set as the current value.
Returns:
whether the current key is associated with the specified value and if the current value cursor could be set to the specified value.
Throws:
java.io.IOException - if an I/O exception occurred.

first

public final boolean first()
                    throws java.io.IOException
Attempt to set the cursor to the first key, value pair.

Changes the key, value pair cursor.

Specified by:
first in interface Iterator
Returns:
whether the cursor could be set to the first key, value pair. Returns false if the Index was empty.
Throws:
java.io.IOException - if an I/O exception occurred.

last

public final boolean last()
                   throws java.io.IOException
Attempt to set the cursor to the last key, value pair.

Changes the key, value pair cursor.

Specified by:
last in interface Iterator
Returns:
whether the cursor could be set to the last key. Returns false if the Index was empty.
Throws:
java.io.IOException - if an I/O exception occurred.

atFirst

public final boolean atFirst()
                      throws java.io.IOException
Returns whether the key, value pair cursor is at the first key, value pair.

Uses the key, value pair cursor.

Specified by:
atFirst in interface Iterator
Returns:
whether the key, value pair cursor was at the first key, value pair. Returns false if the index was empty.
Throws:
java.io.IOException - if an I/O exception occurred.

atLast

public final boolean atLast()
                     throws java.io.IOException
Returns whether the key, value pair cursor is at the last key, value pair.

Uses the key, value pair cursor.

Specified by:
atLast in interface Iterator
Returns:
whether the key, value pair cursor was at the last key, value pair. Returns false if the index was empty.
Throws:
java.io.IOException - if an I/O exception occurred.

isSet

public final boolean isSet()
                    throws java.io.IOException
Returns whether the key, value pair cursor is set to a key, value pair.

Uses the key, value pair cursor.

Specified by:
isSet in interface Iterator
Returns:
whether the key, value pair cursor was set to a key, value pair.
Throws:
java.io.IOException - if an I/O exception occurred.

previous

public final boolean previous()
                       throws java.io.IOException
Moves the cursor back and returns whether a prior key, value pair exists.

Uses and updates the key, value pair cursor.

If a previous key exists then this method sets the current value to the last value of the new key.

Specified by:
previous in interface Iterator
Returns:
whether a prior key, value pair exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previous

public final boolean previous(IndexFilter filter)
                       throws java.io.IOException
Moves the cursor back and returns whether a prior key, value pair exists that meets the specified criteria.

Uses and updates the key, value pair cursor.

If a previous key exists then this method sets the current value to the last value of the new key.

Specified by:
previous in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
whether a prior key, value pair exists that meets the specified criteria.
Throws:
java.io.IOException - if an I/O exception occurred.

previousKey

public final java.lang.Object previousKey()
                                   throws java.io.IOException
Returns the previous key.

Uses and updates the key, value pair cursor.

If a previous key exists then this method sets the current value to the last value of the new key.

Specified by:
previousKey in interface Iterator
Returns:
the previous key. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previousValue

public final java.lang.Object previousValue()
                                     throws java.io.IOException
Returns the previous value.

Uses and updates the key, value pair cursor.

Specified by:
previousValue in interface Iterator
Returns:
the previous value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previousValue

public final java.lang.Object previousValue(boolean all_keys)
                                     throws java.io.IOException
Returns the previous value.

Uses and updates the key, value pair cursor.

Specified by:
previousValue in interface Iterator
Parameters:
all_keys - whether to return the previous value for all keys or for only the current key.
Returns:
the previous value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previousKey

public final java.lang.Object previousKey(IndexFilter filter)
                                   throws java.io.IOException
Returns the previous key that meets the specified criteria.

Uses and updates the key, value pair cursor.

If a previous key exists then this method sets the current value to the last value of the new key.

Specified by:
previousKey in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
the previous key. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previousValue

public final java.lang.Object previousValue(IndexFilter filter)
                                     throws java.io.IOException
Returns the previous value that meets the specified criteria.

Uses and updates the key, value pair cursor.

Specified by:
previousValue in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
the previous value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

previousValue

public final java.lang.Object previousValue(IndexFilter filter,
                                            boolean all_keys)
                                     throws java.io.IOException
Returns the previous value that meets the specified criteria.

Uses and updates the key, value pair cursor.

Specified by:
previousValue in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
all_keys - whether to return the previous value for all keys or for only the current key.
Returns:
the previous value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

next

public final boolean next()
                   throws java.io.IOException
Fowards the cursor and returns whether a next key, value pair exists.

Uses and updates the key, value pair cursor.

If a next key exists then this method sets the current value to the first value of the new key.

Specified by:
next in interface Iterator
Returns:
whether a next key, value pair exists.
Throws:
java.io.IOException - if an I/O exception occurred.

next

public final boolean next(IndexFilter filter)
                   throws java.io.IOException
Forwards the cursor and returns whether a next key, value pair exists that meets the specified criteria.

Uses and updates the key, value pair cursor.

If a next key exists then this method sets the current value to the first value of the new key.

Specified by:
next in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
whether a next key, value pair exists that meets the specified criteria.
Throws:
java.io.IOException - if an I/O exception occurred.

nextKey

public final java.lang.Object nextKey()
                               throws java.io.IOException
Returns the next key.

Uses and updates the key, value pair cursor.

If a next key exists then this method sets the current value to the first value of the new key.

Specified by:
nextKey in interface Iterator
Returns:
the next key. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

nextValue

public final java.lang.Object nextValue()
                                 throws java.io.IOException
Returns the next value.

Uses and updates the key, value pair cursor.

Specified by:
nextValue in interface Iterator
Returns:
the next value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

nextValue

public final java.lang.Object nextValue(boolean all_keys)
                                 throws java.io.IOException
Returns the next value.

Uses and updates the key, value pair cursor.

Specified by:
nextValue in interface Iterator
Parameters:
all_keys - whether to return the next value for all keys or for only the current key.
Returns:
the next value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

nextKey

public final java.lang.Object nextKey(IndexFilter filter)
                               throws java.io.IOException
Returns the next key that meets the specified criteria.

Uses and updates the key, value pair cursor.

If a next key exists then this method sets the current value to the first value of the new key.

Specified by:
nextKey in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
the next key. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

nextValue

public final java.lang.Object nextValue(IndexFilter filter)
                                 throws java.io.IOException
Returns the next value that meets the specified criteria.

Uses and updates the key, value pair cursor.

Specified by:
nextValue in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
Returns:
the next value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

nextValue

public final java.lang.Object nextValue(IndexFilter filter,
                                        boolean all_keys)
                                 throws java.io.IOException
Returns the next value that meets the specified criteria.

Uses and updates the key, value pair cursor.

Specified by:
nextValue in interface Iterator
Parameters:
filter - the IndexFilter that evaluates whether key, value pairs match the criteria.
all_keys - whether to return the next value for all keys or for only the current key.
Returns:
the next value. null if none exists.
Throws:
java.io.IOException - if an I/O exception occurred.

size

public final int size()
               throws java.io.IOException
Returns the number of key, value pairs in the Index.

Returns:
the number of key, value pairs in the Index.
Throws:
java.io.IOException - if an I/O exception occurred.

isEmpty

public final boolean isEmpty()
                      throws java.io.IOException
Returns whether the Index is empty.

Specified by:
isEmpty in interface Iterator
Returns:
whether the Index was empty.
Throws:
java.io.IOException - if an I/O exception occurred.

valueCount

public final int valueCount(java.lang.Object key)
                     throws java.io.IOException
Returns the number of duplicate values associated with the specified key in the Index.

Specified by:
valueCount in interface Iterator
Parameters:
key - the key whose values will be counted.
Returns:
the number of duplicate values associated with the specified key in the Index.
Throws:
java.io.IOException - if an I/O exception occurred.

clear

public final void clear()
                 throws java.io.IOException
Removes all the keys and associated values from the Index.

Also removes all locks.

Throws:
java.io.IOException - if an I/O exception occurred.

lock

public final void lock(java.lang.Object key)
                throws java.io.IOException
Write locks the specified key or waits until it can be write locked.

Same as writeLock().

If the key is already read or write locked by another stec.pos.IndexReference the current thread will be blocked until the specified key can be write locked.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to write lock. key cannot be null.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
readLock, writeLock, lock, readLock, writeLock, unlock, unlockAll, unlockMine

readLock

public final void readLock(java.lang.Object key)
                    throws java.io.IOException
Read locks the specified key or waits until it can be read locked.

If the key is already write locked by another stec.pos.IndexReference the current thread will be blocked until the specified key can be read locked.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to read lock. key cannot be null.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
lock, writeLock, lock, readLock, writeLock, unlock, unlockAll, unlockMine

writeLock

public final void writeLock(java.lang.Object key)
                     throws java.io.IOException
Write locks the specified key or waits until it can be write locked.

If the key is already read or write locked by another stec.pos.IndexReference the current thread will be blocked until the specified key can be write locked.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to write lock. key cannot be null.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
lock, readLock, lock, readLock, writeLock, unlock, unlockAll, unlockMine

lock

public final boolean lock(java.lang.Object key,
                          long timeout)
                   throws java.io.IOException
Write locks the specified key or waits until it can be write locked or the specified timeout is reached.

Same as writeLock().

If the key is already read or write locked by another stec.pos.IndexReference the current thread will be blocked until the key can be write locked or the specified timeout is reached.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to write lock. key cannot be null.
timeout - the number of milliseconds to wait. -1 for unlimited
Returns:
whether or not the specified key could be write locked.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
lock, readLock, writeLock, readLock, writeLock, unlock, unlockAll, unlockMine

readLock

public final boolean readLock(java.lang.Object key,
                              long timeout)
                       throws java.io.IOException
Read locks the specified key or waits until it can be read locked or the specified timeout is reached.

If the key is already write locked by another stec.pos.IndexReference the current thread will be blocked until the key can be read locked or the specified timeout is reached.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to read lock. key cannot be null.
timeout - the number of milliseconds to wait. -1 for unlimited
Returns:
whether or not the specified key could be read locked.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
lock, readLock, writeLock, lock, writeLock, unlock, unlockAll, unlockMine

writeLock

public final boolean writeLock(java.lang.Object key,
                               long timeout)
                        throws java.io.IOException
Write locks the specified key or waits until it can be write locked or the specified timeout is reached.

If the key is already read or write locked by another stec.pos.IndexReference the current thread will be blocked until the key can be write locked or the specified timeout is reached.

Once a key is locked it remains locked until the key is explicitly unlocked by a call to stec.pos.IndexReference.unlock(Object), the Index is cleared by a call to stec.pos.IndexReference.clear() or the stec.pos.IndexReference is closed.

Parameters:
key - the key to write lock. key cannot be null.
timeout - the number of milliseconds to wait. -1 for unlimited
Returns:
whether or not the specified key could be write locked.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
lock, readLock, writeLock, lock, readLock, unlock, unlockAll, unlockMine

unlock

public final void unlock(java.lang.Object key)
                  throws java.io.IOException
Unlocks the specified key.

Parameters:
key - the key to unlock. key cannot be null.
Throws:
java.io.IOException - if the specified key is locked by another stec.pos.IndexReference or if an I/O exception occurred.
See Also:
lock, readLock, writeLock, lock, readLock, writeLock, unlockAll, unlockMine

unlockAll

public final void unlockAll()
                     throws java.io.IOException
Clears all the locks to this Index.

Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
lock, readLock, writeLock, lock, readLock, writeLock, unlock, unlockMine

unlockMine

public final void unlockMine()
                      throws java.io.IOException
Clears all the locks for the current IndexReference.

Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
lock, readLock, writeLock, lock, readLock, writeLock, unlock, unlockAll

isLocked

public final boolean isLocked(java.lang.Object key)
                       throws java.io.IOException
Returns whether the specified key is locked.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is locked.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
isReadLocked, isWriteLocked, iLocked, iReadLocked, iWriteLocked

isReadLocked

public final boolean isReadLocked(java.lang.Object key)
                           throws java.io.IOException
Returns whether the specified read key is locked.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is read locked.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
isLocked, isWriteLocked, iLocked, iReadLocked, iWriteLocked

isWriteLocked

public final boolean isWriteLocked(java.lang.Object key)
                            throws java.io.IOException
Returns whether the specified key is write locked.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is write locked.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
isLocked, isReadLocked, iLocked, iReadLocked, iWriteLocked

iLocked

public final boolean iLocked(java.lang.Object key)
                      throws java.io.IOException
Returns whether the current IndexReference has locked the specified key.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is locked by the current IndexReference.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
isLocked, isReadLocked, isWriteLocked, iReadLocked, iWriteLocked

iReadLocked

public final boolean iReadLocked(java.lang.Object key)
                          throws java.io.IOException
Returns whether the current IndexReference has read locked the specified key.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is read locked by the current IndexReference.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
isLocked, isReadLocked, isWriteLocked, iLocked, iWriteLocked

iWriteLocked

public final boolean iWriteLocked(java.lang.Object key)
                           throws java.io.IOException
Returns whether the current IndexReference has write locked the specified key.

Parameters:
key - the key to test. key cannot be null.
Returns:
whether the specified key is write locked by the current IndexReference.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
isLocked, isReadLocked, isWriteLocked, iLocked, iReadLocked

lockCount

public int lockCount()
              throws java.io.IOException
Returns the number of locked keys.

Returns:
the number of locked keys.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002
See Also:
lockCount

lockCount

public int lockCount(java.lang.Object key)
              throws java.io.IOException
Returns the number of locks for the specified key.

Parameters:
key - the key check to use.
Returns:
the number of locks for the specified key.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
lockCount

locks

public java.util.Enumeration locks()
                            throws java.io.IOException
Returns an Enumeration of the locked keys.

Returns:
the Enumeration of the locked keys.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
locks, Enumeration, LinkedList

locks

public java.util.Enumeration locks(java.lang.Object key)
                            throws java.io.IOException
Returns an Enumeration of the locks on the specified key.

Parameters:
key - the object to use.
Returns:
the Enumeration of of the locks.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.4.0 08/23/2004
See Also:
locks, Enumeration, Lock

isOpen

public final boolean isOpen()
                     throws java.io.IOException
Returns whether the current IndexReference is still open.

Specified by:
isOpen in interface Iterator
Returns:
whether the current IndexReference is open.
Throws:
java.io.IOException - if an I/O exception occurred.
See Also:
open, close

duplicates

public final boolean duplicates()
                         throws java.io.IOException
Returns whether the current Index supports duplicates.

Specified by:
duplicates in interface Iterator
Returns:
whether the current Index supports duplicates.
Throws:
java.io.IOException - if an I/O exception occurred.

ascending

public final boolean ascending()
                        throws java.io.IOException
Returns whether the current Index is sorted in ascending order.

Specified by:
ascending in interface Iterator
Returns:
whether the current Index is sorted in ascending order.
Throws:
java.io.IOException - if an I/O exception occurred.

seek

public final boolean seek(java.lang.Object key)
                   throws java.io.IOException
Sets the current cursor to the specified key.

Changes the key, value pair cursor.

If the specified key does not exist then calls to getCurrentKey() and getCurrentValue() will return null.

Specified by:
seek in interface Iterator
Parameters:
key - the key to set as the current key.
Returns:
whether the specified key exists.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

seek

public final boolean seek(java.lang.Object key,
                          java.lang.Object value)
                   throws java.io.IOException
Sets the current cursor to the specified key, value pair.

Changes the key, value pair cursor.

If the specified key, value pair does not exist then calls to getCurrentKey() and getCurrentValue() will return null.

Specified by:
seek in interface Iterator
Parameters:
key - the key to set as the current key.
value - the value to set as the current value.
Returns:
whether the specified key, value pair exists.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

getKeysClassName

public final java.lang.String getKeysClassName()
                                        throws java.io.IOException
Returns the keys class name.

Returns:
the keys class name.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

getValuesClassName

public final java.lang.String getValuesClassName()
                                          throws java.io.IOException
Returns the values class name.

Returns:
the values class name.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

getKeysIndexCollator

public final java.lang.String getKeysIndexCollator()
                                            throws java.io.IOException
Returns the class name of the keys index collator.

Returns:
the class name of the keys index collator.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

getValuesIndexCollator

public final java.lang.String getValuesIndexCollator()
                                              throws java.io.IOException
Returns the class name of the values index collator.

Returns:
the class name of the values index collator.
Throws:
java.io.IOException - if an I/O exception occurred.
Since:
1.2.0 12/03/2002

getFilename

public final java.lang.String getFilename()
Returns the filename of the index this reference references.

Returns:
the filename of the index this reference references.
Since:
1.3.1 11/26/2003

Servertec
Persistent Object Store
1.4.1 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.