uvi
Class Index

java.lang.Object
  extended by uvi.Index

public class Index
extends Object

This class contains all the verbs encountered during the parsing process and the links associated with each verb. This class accumulates verbs and links first during the XML parsing process and secondly during the PropBank and FrameNet loading. The VerbNet verbs are added when a MEMBER tag is located in an XML file. Once it contains all the links, the Generator asks this class to sort each list of verbs (a list is a single letter, like A). Finally, this class is the integral part in all of the index page creation.

NOTE: Any reference to "HTML Files" should be taken as a synonym for "PHP Files." When this documentation was created, only *.html files were used. Later, they were converted to *.php files to facilitate dynamic content (i.e. comments).

Version:
1.0, 2006.9.8
Author:
Derek Trumbo
See Also:
Generator.generateHTMLFiles(), Generator.generateIndexFiles(), Generator.addOthers(int), Sweeper.startMEMBER(Node)

Nested Class Summary
(package private) static class Index.Entry
          Represents the index entry for a single English verb and holds all relevant links for that verb (from either VerbNet, PropBank, FrameNet).
(package private) static class Index.Link
          Represents a single link for a verb.
 
Field Summary
(package private) static ArrayList[] index
          An array which can hold one ArrayList for each letter of the alphabet.
(package private) static int LETTER_MAX
          The number of letters in the alphabet.
 
Constructor Summary
private Index()
          This constructor is private because the class is not intended to ever be instantiated.
 
Method Summary
(package private) static void addLink(String newVerb, int newType, String newText, String newLink)
          Registers a verb and one link with the index.
(package private) static int getNumVerbs(int type)
          Returns the total number of verbs represented in the index or the total number of links in the index for a given data source.
(package private) static void sort()
          Sort the verbs in each index entry array since verbs from the PropBank and FrameNet will have just been added to the end of the lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LETTER_MAX

static int LETTER_MAX
The number of letters in the alphabet.


index

static ArrayList[] index
An array which can hold one ArrayList for each letter of the alphabet. Each index element begins as null. Once the first verb for that element's corresponding letter (i.e. C: index[2]) has been encountered, the element is assigned to an instantiated ArrayList. That ArrayList will hold Index.Entry objects. Each Index.Entry object corresponds to a single English verb.

Constructor Detail

Index

private Index()
This constructor is private because the class is not intended to ever be instantiated. The UVI generation is a very procedural process and thus all the members are static.

Method Detail

addLink

static void addLink(String newVerb,
                    int newType,
                    String newText,
                    String newLink)
Registers a verb and one link with the index. If this is the first verb with the given first-letter, a new ArrayList is created and assigned to the proper index array element. If the corresponding list is created, but the verb does not exist, the verb and its link is added to the list. If the verb does exist in the list for that first-letter already, then the link is simply added to the verb's array of links (see Index.Entry.links).

Parameters:
newVerb - the verb found in the VerbNet, PropBank, or FrameNet sources
newType - one of the values Generator.DS_*. This is used to identify the source of this verb/link pair.
newText - the text to use in the index for this link
newLink - the href to use in the index for this link
See Also:
Generator.addOthers(int), Sweeper.startMEMBER(Node), Index.Entry, Index.Link

sort

static void sort()
Sort the verbs in each index entry array since verbs from the PropBank and FrameNet will have just been added to the end of the lists. Due to the relatively small number of verbs in each list (on the order of hundreds), a simple and inefficient exchange sort (n-squared) algorithm is used.

See Also:
Generator.generateHTMLFiles()

getNumVerbs

static int getNumVerbs(int type)
Returns the total number of verbs represented in the index or the total number of links in the index for a given data source. If the value -1 is supplied, the number of uniquely represented verbs represented in the index is returned. If one of the Generator.DS_* values is supplied, the number of index links of that type is returned.

Parameters:
type - either the value -1 or one of the Generator.DS_* values
Returns:
the total number of verbs in the index (for all sources combined) or the number of links in the index for a single data source.
See Also:
Generator.generateIndexFiles()