net.ontopia.utils
Class ChainedIndex<K,E>

java.lang.Object
  extended by net.ontopia.utils.ChainedIndex<K,E>
All Implemented Interfaces:
LookupIndexIF<K,E>

public class ChainedIndex<K,E>
extends java.lang.Object
implements LookupIndexIF<K,E>

INTERNAL: A lookup index that delegates LookupIndexIF calls to chains of LookupIndexIFs.

get(key) returns the first non-null value returned from a getter.

put(key) removes the key from all putters.

remove(key) removes the key from all removers.

Since:
1.3.2

Field Summary
protected  LookupIndexIF<K,E>[] getters
           
protected  int gsize
           
protected  E missvalue
           
protected  int psize
           
protected  LookupIndexIF<K,E>[] putters
           
protected  LookupIndexIF<K,E>[] removers
           
protected  int rsize
           
 
Constructor Summary
ChainedIndex(LookupIndexIF<K,E>[] chain)
           
ChainedIndex(LookupIndexIF<K,E>[] getters, LookupIndexIF<K,E> setter)
           
ChainedIndex(LookupIndexIF<K,E>[] getters, LookupIndexIF<K,E>[] setters)
           
ChainedIndex(LookupIndexIF<K,E>[] getters, LookupIndexIF<K,E>[] putters, LookupIndexIF<K,E>[] removers)
           
ChainedIndex(LookupIndexIF<K,E> getter, LookupIndexIF<K,E>[] setters)
           
 
Method Summary
 E get(K key)
           
 java.lang.Object getMissValue()
          INTERNAL: Gets the missvalue member, which is used to decide whether an index lookup missed or not.
 E put(K key, E value)
           
 E remove(K key)
           
 void setMissValue(E missvalue)
          INTERNAL: Sets the missvalue member, which is used to decide whether an index lookup missed or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getters

protected LookupIndexIF<K,E>[] getters

putters

protected LookupIndexIF<K,E>[] putters

removers

protected LookupIndexIF<K,E>[] removers

gsize

protected int gsize

psize

protected int psize

rsize

protected int rsize

missvalue

protected E missvalue
Constructor Detail

ChainedIndex

public ChainedIndex(LookupIndexIF<K,E>[] chain)

ChainedIndex

public ChainedIndex(LookupIndexIF<K,E>[] getters,
                    LookupIndexIF<K,E>[] setters)

ChainedIndex

public ChainedIndex(LookupIndexIF<K,E> getter,
                    LookupIndexIF<K,E>[] setters)

ChainedIndex

public ChainedIndex(LookupIndexIF<K,E>[] getters,
                    LookupIndexIF<K,E> setter)

ChainedIndex

public ChainedIndex(LookupIndexIF<K,E>[] getters,
                    LookupIndexIF<K,E>[] putters,
                    LookupIndexIF<K,E>[] removers)
Method Detail

get

public E get(K key)
Specified by:
get in interface LookupIndexIF<K,E>

getMissValue

public java.lang.Object getMissValue()
INTERNAL: Gets the missvalue member, which is used to decide whether an index lookup missed or not. The default is null.

Since:
1.3.4

setMissValue

public void setMissValue(E missvalue)
INTERNAL: Sets the missvalue member, which is used to decide whether an index lookup missed or not.

Since:
1.3.4

put

public E put(K key,
             E value)
Specified by:
put in interface LookupIndexIF<K,E>

remove

public E remove(K key)
Specified by:
remove in interface LookupIndexIF<K,E>


Copyright © 2000-2012 Ontopia.