|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.nist.nlpir.irf.index.DualKeyContainer
This class is the "heart" of the Index. It mainly contains two hash tables of
vectors. The first one, called valuesBySource, stores all indexing features
found, classified by source. It will allow user to retrieve all the features
of a given document, for example. The second one, called sourcesByValue, stores
the different values whatever their source is. It will allow user to retrieve
all the sources where a given feature appear.
Each entry in a table corresponds to a vector of features. For the first table,
the vector contains all the features found for the source entry. In the second
table, one vector contains all the sources in which the entry feature can be
found.
An example of using the class is below
setIndexingFeature = new DualKeyContainer(); // Add an element to DualKeyContainer using two keys setIndexingFeature.put(source, key, value); // More precise example setIndexingFeature.put("doc1", "word1", "word1InDoc1"); setIndexingFeature.put("doc1", "word2", "word2InDoc1"); setIndexingFeature.put("doc2", "word1", "word1InDoc2"); // We now have: // setIndexingFeatures.getSourceVector("word1") == {"word1InDoc1", "word1InDoc2"} // setIndexingFeatures.getValuesVector("doc1") == {"word1InDoc1", "word2InDoc1"}
Hashtable
Field Summary | |
private static int |
FEATURE_VECTOR_CAPACITY_INCREMENT
|
private static int |
FEATURE_VECTOR_INITIAL_CAPACITY
|
private static int |
SOURCE_VECTOR_CAPACITY_INCREMENT
|
private static int |
SOURCE_VECTOR_INITIAL_CAPACITY
|
private IrfHashtable |
sourcesByValue
|
private int |
sourcesNumber
|
private int |
uniqueValuesNumber
|
private IrfHashtable |
valuesBySource
|
private int |
valuesNumber
|
Constructor Summary | |
DualKeyContainer()
Initializes both tables. |
Method Summary | |
void |
clear()
Clears both tables. |
java.util.Enumeration |
elements()
Returns all the features stored. |
java.lang.Object |
getActualFeature(java.lang.Object feature)
When a value is stored, it appears in a Vector corresponding to its feature (a key of a hashtable). |
java.lang.Object |
getActualSource(java.lang.Object source)
When a value is stored, it appears in a Vector corresponding to its source (a key of a hashtable). |
ProxyFeatureList |
getAllValues()
Returns a Vector containing all the values stored in the DualKeyContainer. |
ProxyFeatureList |
getFeatureVector(java.lang.Object source)
Returns the vector of values associated to the given source. |
int |
getNumberOfSourcesFor(java.lang.Object feature)
Gives the number of sources containing the given feature. |
int |
getNumberOfValuesFor(java.lang.Object source)
Gives the number of features stored for the given source. |
java.util.Enumeration |
getSources()
Returns the enumeration of Objects used as sources in this DualKeyContainer. |
int |
getSourcesNumber()
Gives the number of sources in the DualKeyContainer. |
ProxyFeatureList |
getSourceVector(java.lang.Object feature)
Returns the vector of sources that correspond to the given feature. |
int |
getUniqueValuesNumber()
Returns the number of different values stored in the DualKeyContainer. |
java.util.Enumeration |
getValues()
Returns the enumeration of Objects used as features for this DualKeyContainer. |
int |
getValuesNumber()
Gives the total number of features stored in the table. |
boolean |
isEmpty()
|
void |
put(java.lang.Object source,
java.lang.Object feature,
java.lang.Object value)
|
void |
showStatistics(int depth,
int maxLengthIfDepth3)
Prints statistics about the DualKeyContainer, ie its size and the size of its elements. |
private void |
showStats(IrfHashtable table,
int depth,
int maxLengthIfDepth3)
Prints statistics for ONE HVtable. |
java.lang.String |
toString()
Creates massive string representation of the DualKeyContainer. |
int |
valuesBySourceSize()
Gives the number of sources that appear in the DualKeyContainer. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private IrfHashtable valuesBySource
private IrfHashtable sourcesByValue
private int valuesNumber
private int sourcesNumber
private int uniqueValuesNumber
private static int SOURCE_VECTOR_INITIAL_CAPACITY
private static int SOURCE_VECTOR_CAPACITY_INCREMENT
private static int FEATURE_VECTOR_INITIAL_CAPACITY
private static int FEATURE_VECTOR_CAPACITY_INCREMENT
Constructor Detail |
public DualKeyContainer()
Method Detail |
public int valuesBySourceSize()
public int getValuesNumber()
public int getNumberOfValuesFor(java.lang.Object source)
source
- the source for which the number of values will be computed.public int getNumberOfSourcesFor(java.lang.Object feature)
feature
- the feature for which the number of sources will be computed.public boolean isEmpty()
public java.util.Enumeration elements()
put(java.lang.Object, java.lang.Object, java.lang.Object)
public ProxyFeatureList getAllValues()
public ProxyFeatureList getFeatureVector(java.lang.Object source)
source
- The source for which the values will be returned.public ProxyFeatureList getSourceVector(java.lang.Object feature)
feature
- The feature for which the sources will be returned.public void put(java.lang.Object source, java.lang.Object feature, java.lang.Object value)
source
- Where the value was found.feature
- The feature created with this value.value
- The object to be stored.public void clear()
public java.lang.String toString()
public void showStatistics(int depth, int maxLengthIfDepth3)
depth
- 1, prints the size of the contained vectors for each hash table,private void showStats(IrfHashtable table, int depth, int maxLengthIfDepth3)
table
- The hashtable of vectors to be presented.depth
- Same as showStatistics() depth.public int getSourcesNumber()
public int getUniqueValuesNumber()
public java.util.Enumeration getSources()
public java.util.Enumeration getValues()
public java.lang.Object getActualSource(java.lang.Object source)
IrfHashtable.getActualKey(java.lang.Object)
public java.lang.Object getActualFeature(java.lang.Object feature)
IrfHashtable.getActualKey(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |