|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuvi.Sweeper
public class Sweeper
This class essentially defines the HTML that should be mapped to the XML.
The name Sweeper has no particular significance. This class is probably
the most important class of the UVI Generator program. The rest of the
program is just infrastructure for the purpose of allowing this class
to do its job (for the most part).
The power of this class is in its
flexibility for future developers or VerbNet users. If another node is
added to VerbNet, this program can be extended fairly simply by adding the
proper startNODE
and endNODE
methods. If the
tags are in the XML files, the act of declaring the methods to this file
(in the same manner the other methods are declared) makes your code active.
This is because reflection is used. See Generator.executeHTMLMethod(String, Node)
.
Furthermore, if you want to change the way the XML files are displayed as
HTML, changing is easy. If you want to change how the frames are displayed,
example, you would look in startFRAMES
, startFRAME
,
endFRAME
, and endFRAMES
. There the HTML is fairly
clearly generated based on the children and attributes of each node.
Remember
that the HTML is generated in an "in-order" fashion. First the startFRAMES
is executed, then the startFRAME
, then the startDESCRIPTION
,
etc. Then the end tags are executed in the opposite order: endDESCRIPTION
,
endFRAME
, endFRAMES
.
It's ok if a "start" or "end" method does not exist for a given XML element.
If no matching method is found, it is ignored. For example, those nodes
which are defined in the DTD not to have children nodes hardly need "end"
methods declared, since you can just put the "closing" HTML at the end of the
node's "start" method.
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).
Generator.executeHTMLMethod(String, Node)
,
Q
Field Summary | |
---|---|
private static String |
curClass
The name of the current class or subclass being processed. |
private static String |
curFile
Used only to supply the correct web page link when add a member to the index. |
private static int |
curIndentLevel
The current nesting level of the classes. |
private static int |
curMem
A counter maintained by each member section to keep track of which member (verb) is being printed currently. |
private static boolean |
hasBeenOther
Used by various types of nodes for which there might be a list to display to know if another of their same kind has already been shown, so as to print a space, or a comma and a space. |
private static int |
INIT_MEM_ROW
The number of verbs (rows) to display per column if the number of verbs is less than INIT_MEM_ROW * NUM_MEM_COL. |
private static ArrayList |
members
Holds all the member information for a given class/subclass. |
private static int |
memPerCol
The number of members to be shown per column in the 'Members' area. |
private static int |
NUM_MEM_COL
The maximum number of verb columns to display in the 'Members' area. |
private static boolean |
prepSelRestrs
Whether or not the SELRESTRS about to be entered is under a PREP element (as compared to a THEMROLE element). |
private static int |
restrsLevel
The level of nested SELRESTRS being processed. |
private static int |
totalMem
The number of members for the current class or subclass. |
private static boolean |
usingOr
Whether or not nodes which specify logical operators for their children are using 'or'. |
Constructor Summary | |
---|---|
private |
Sweeper()
This constructor is private because the class is not intended to ever be instantiated. |
Method Summary | |
---|---|
private static void |
classHierarchyPrint(Element cls,
int level,
String rootName)
Prints the content of the Class Hierarchy box. |
static void |
endADJ(Node n)
Generates the HTML for the end of a ADJ element. |
static void |
endADV(Node n)
Generates the HTML for the end of a ADV element. |
static void |
endARG(Node n)
Generates the HTML for the end of a ARG element. |
static void |
endARGS(Node n)
Generates the HTML for the end of a ARGS element. |
static void |
endDESCRIPTION(Node n)
Generates the HTML for the end of a DESCRIPTION element. |
static void |
endEXAMPLE(Node n)
Generates the HTML for the end of a EXAMPLE element. |
static void |
endEXAMPLES(Node n)
Generates the HTML for the end of a EXAMPLES element. |
static void |
endFRAME(Node n)
Generates the HTML for the end of a FRAME element. |
static void |
endFRAMES(Node n)
Generates the HTML for the end of a FRAMES element. |
static void |
endLEX(Node n)
Generates the HTML for the end of a LEX element. |
static void |
endMEMBER(Node n)
Generates the HTML for the end of a MEMBER element. |
static void |
endMEMBERS(Node n)
Generates the HTML for the end of a MEMBERS element. |
static void |
endNP(Node n)
Generates the HTML for the end of a NP element. |
static void |
endPRED(Node n)
Generates the HTML for the end of a PRED element. |
static void |
endPREP(Node n)
Generates the HTML for the end of a PREP element. |
static void |
endSELRESTR(Node n)
Generates the HTML for the end of a SELRESTR element. |
static void |
endSELRESTRS(Node n)
Generates the HTML for the end of a SELRESTRS element. |
static void |
endSEMANTICS(Node n)
Generates the HTML for the end of a SEMANTICS element. |
static void |
endSYNRESTR(Node n)
Generates the HTML for the end of a SYNRESTR element. |
static void |
endSYNRESTRS(Node n)
Generates the HTML for the end of a SYNRESTRS element. |
static void |
endSYNTAX(Node n)
Generates the HTML for the end of a SYNTAX element. |
static void |
endTHEMROLE(Node n)
Generates the HTML for the end of a THEMROLE element. |
static void |
endTHEMROLES(Node n)
Generates the HTML for the end of a THEMROLES element. |
static void |
endVERB(Node n)
Generates the HTML for the end of a VERB element. |
static void |
endVNCLASS(Node n)
Generates the HTML for the end of a VNCLASS element. |
static void |
endVNSUBCLASS(Node n)
Generates the HTML for the end of a VNSUBCLASS element. |
private static void |
eprint(String s)
Used as shorthand for System.err.print . |
private static void |
eprintln(String s)
Used as shorthand for System.err.println . |
private static boolean |
hasKids(Node n,
String which)
Whether or not the given XML element has children with a given tag name. |
private static int |
numKids(Node n,
String which)
Counts the number of children of a given XML element who have the given tag name. |
private static void |
print(String s)
Used as shorthand for System.out.print . |
private static void |
println(String s)
Used as shorthand for System.out.println . |
private static void |
printMembers()
Prints the HTML for all the members in the current class/subclass. |
static void |
setCurFile(String newFile)
Sets the current file being processed. |
static void |
startADJ(Node n)
Generates the HTML for the beginning of a ADJ element. |
static void |
startADV(Node n)
Generates the HTML for the beginning of a ADV element. |
static void |
startARG(Node n)
Generates the HTML for the beginning of a ARG element. |
static void |
startARGS(Node n)
Generates the HTML for the beginning of a ARGS element. |
static void |
startDESCRIPTION(Node n)
Generates the HTML for the beginning of a DESCRIPTION element. |
static void |
startEXAMPLE(Node n)
Generates the HTML for the beginning of a EXAMPLE element. |
static void |
startEXAMPLES(Node n)
Generates the HTML for the beginning of a EXAMPLES element. |
static void |
startFRAME(Node n)
Generates the HTML for the beginning of a FRAME element. |
static void |
startFRAMES(Node n)
Generates the HTML for the beginning of a FRAMES element. |
static void |
startLEX(Node n)
Generates the HTML for the beginning of a LEX element. |
static void |
startMEMBER(Node n)
Stores all the information for this member into the members
array to be processed later in endMEMBERS(Node) , once it is completely
sorted. |
static void |
startMEMBERS(Node n)
Generates the HTML for the beginning of a MEMBERS element. |
static void |
startNP(Node n)
Generates the HTML for the beginning of a NP element. |
static void |
startPRED(Node n)
Generates the HTML for the beginning of a PRED element. |
static void |
startPREP(Node n)
Generates the HTML for the beginning of a PREP element. |
static void |
startSELRESTR(Node n)
Generates the HTML for the beginning of a SELRESTR element. |
static void |
startSELRESTRS(Node n)
Generates the HTML for the beginning of a SELRESTRS element. |
static void |
startSEMANTICS(Node n)
Generates the HTML for the beginning of a SEMANTICS element. |
static void |
startSYNRESTR(Node n)
Generates the HTML for the beginning of a SYNRESTR element. |
static void |
startSYNRESTRS(Node n)
Generates the HTML for the beginning of a SYNRESTRS element. |
static void |
startSYNTAX(Node n)
Generates the HTML for the beginning of a SYNTAX element. |
static void |
startTHEMROLE(Node n)
Generates the HTML for the beginning of a THEMROLE element. |
static void |
startTHEMROLES(Node n)
Generates the HTML for the beginning of a THEMROLES element. |
static void |
startVERB(Node n)
Generates the HTML for the beginning of a VERB element. |
static void |
startVNCLASS(Node n)
Generates the HTML for the beginning of a VNCLASS element. |
static void |
startVNSUBCLASS(Node n)
Generates the HTML for the beginning of a VNSUBCLASS element. |
private static void |
warningChecks(int mem,
int fra,
int subc)
Shows warnings concerning "curious" conditions in the VerbNet organization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static int NUM_MEM_COL
startMEMBERS(Node)
,
endMEMBERS(Node)
private static int INIT_MEM_ROW
startMEMBERS(Node)
,
endMEMBERS(Node)
private static int curIndentLevel
startVNCLASS(Node)
,
startVNSUBCLASS(Node)
,
endVNCLASS(Node)
,
endVNSUBCLASS(Node)
private static int memPerCol
NUM_MEM_COL
.
startMEMBERS(Node)
,
endMEMBERS(Node)
,
printMembers()
private static int curMem
startMEMBERS(Node)
,
endMEMBERS(Node)
,
printMembers()
private static int totalMem
startMEMBERS(Node)
,
endMEMBERS(Node)
private static int restrsLevel
startSELRESTRS(Node)
,
endSELRESTRS(Node)
private static boolean prepSelRestrs
startPREP(Node)
,
endPREP(Node)
,
startSELRESTRS(Node)
,
endSELRESTRS(Node)
private static boolean hasBeenOther
startSELRESTRS(Node)
,
startSELRESTR(Node)
,
startARGS(Node)
,
startARG(Node)
,
startSYNRESTRS(Node)
,
startSYNRESTR(Node)
private static boolean usingOr
startSELRESTRS(Node)
,
startSELRESTR(Node)
,
startSYNRESTRS(Node)
,
startSYNRESTR(Node)
private static String curFile
setCurFile(String)
,
printMembers()
private static String curClass
startVNCLASS(Node)
,
startVNSUBCLASS(Node)
,
printMembers()
private static ArrayList members
startMEMBERS(Node)
,
startMEMBER(Node)
,
printMembers()
Constructor Detail |
---|
private Sweeper()
Method Detail |
---|
private static void println(String s)
System.out.println
.
s
- the string to print.PrintStream.println(String)
private static void print(String s)
System.out.print
.
s
- the string to print.PrintStream.print(String)
private static void eprintln(String s)
System.err.println
.
s
- the string to printPrintStream.println(String)
private static void eprint(String s)
System.err.print
.
s
- the string to printPrintStream.print(String)
public static void setCurFile(String newFile)
newFile
- the current file being processed in
Generator.generateHTMLFiles()
Generator.generateHTMLFiles()
private static boolean hasKids(Node n, String which)
n
- the node whose children should be checkedwhich
- the tag name to look for among the children
private static int numKids(Node n, String which)
n
- the node whose children should be checkedwhich
- the tag name to look for among the children
private static void warningChecks(int mem, int fra, int subc)
mem
- the number of members the class/subclass hasfra
- the number of frames the class/subclass hassubc
- the number of subclasses the class/subclass hasprivate static void classHierarchyPrint(Element cls, int level, String rootName)
cls
- the top level XML element representing the main class being printedlevel
- the current subclass level (0 for the main class). This is
used to perform the proper indentation.rootName
- the name of the main class being printed recursively.
This is used only to flag subclasses whose names do not
correspond to the naming convention of the main class.startVNCLASS(Node)
public static void startVNCLASS(Node n)
n
- the Node
object representing
the active VNCLASS elementpublic static void endVNCLASS(Node n)
n
- the Node
object representing
the active VNCLASS elementpublic static void startVNSUBCLASS(Node n)
n
- the Node
object representing
the active VNSUBCLASS elementpublic static void endVNSUBCLASS(Node n)
n
- the Node
object representing
the active VNSUBCLASS elementpublic static void startMEMBERS(Node n)
n
- the Node
object representing
the active MEMBERS elementpublic static void endMEMBERS(Node n)
n
- the Node
object representing
the active MEMBERS elementprintMembers()
public static void startMEMBER(Node n)
members
array to be processed later in endMEMBERS(Node)
, once it is completely
sorted. A formal sorting algorithm is not used, but rather when each new member
is added inside this method, it is inserted in alphabetical order. Also, the
sorting only occurs if the "-s" or "--sort" flag was supplied to the program.
n
- the Node
object representing
the active MEMBER elementpublic static void endMEMBER(Node n)
<!ELEMENT MEMBER EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startMEMBER(Node)
method.
n
- the Node
object representing
the active MEMBER elementprivate static void printMembers()
startMEMBER(Node)
.
startMEMBER(Node)
,
endMEMBERS(Node)
,
Generator.addOthers(int)
,
WordNet
,
VN_FN_Map
public static void startTHEMROLES(Node n)
n
- the Node
object representing
the active THEMROLES elementpublic static void endTHEMROLES(Node n)
n
- the Node
object representing
the active THEMROLES elementpublic static void startTHEMROLE(Node n)
n
- the Node
object representing
the active THEMROLE elementpublic static void endTHEMROLE(Node n)
n
- the Node
object representing
the active THEMROLE elementpublic static void startSELRESTRS(Node n)
n
- the Node
object representing
the active SELRESTRS elementpublic static void endSELRESTRS(Node n)
n
- the Node
object representing
the active SELRESTRS elementpublic static void startSELRESTR(Node n)
n
- the Node
object representing
the active SELRESTR elementpublic static void endSELRESTR(Node n)
<!ELEMENT SELRESTR EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startSELRESTR(Node)
method.
n
- the Node
object representing
the active SELRESTR elementpublic static void startFRAMES(Node n)
n
- the Node
object representing
the active FRAMES elementpublic static void endFRAMES(Node n)
n
- the Node
object representing
the active FRAMES elementpublic static void startFRAME(Node n)
n
- the Node
object representing
the active FRAME elementpublic static void endFRAME(Node n)
n
- the Node
object representing
the active FRAME elementpublic static void startDESCRIPTION(Node n)
n
- the Node
object representing
the active DESCRIPTION elementpublic static void endDESCRIPTION(Node n)
<!ELEMENT DESCRIPTION EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startDESCRIPTION(Node)
method.
n
- the Node
object representing
the active DESCRIPTION elementpublic static void startEXAMPLES(Node n)
n
- the Node
object representing
the active EXAMPLES elementpublic static void endEXAMPLES(Node n)
n
- the Node
object representing
the active EXAMPLES elementpublic static void startEXAMPLE(Node n)
n
- the Node
object representing
the active EXAMPLE elementpublic static void endEXAMPLE(Node n)
<!ELEMENT EXAMPLE (#PCDATA)>
in the DTD, so any "closing HTML" could just be placed at the
end of the startEXAMPLE(Node)
method.
n
- the Node
object representing
the active EXAMPLE elementpublic static void startSYNTAX(Node n)
n
- the Node
object representing
the active SYNTAX elementpublic static void endSYNTAX(Node n)
n
- the Node
object representing
the active SYNTAX elementpublic static void startSEMANTICS(Node n)
n
- the Node
object representing
the active SEMANTICS elementpublic static void endSEMANTICS(Node n)
n
- the Node
object representing
the active SEMANTICS elementpublic static void startPRED(Node n)
n
- the Node
object representing
the active PRED elementpublic static void endPRED(Node n)
n
- the Node
object representing
the active PRED elementpublic static void startARGS(Node n)
n
- the Node
object representing
the active ARGS elementpublic static void endARGS(Node n)
n
- the Node
object representing
the active ARGS elementpublic static void startARG(Node n)
n
- the Node
object representing
the active ARG elementpublic static void endARG(Node n)
<!ELEMENT ARG EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startARG(Node)
method.
n
- the Node
object representing
the active ARG elementpublic static void startNP(Node n)
n
- the Node
object representing
the active NP elementpublic static void endNP(Node n)
n
- the Node
object representing
the active NP elementpublic static void startPREP(Node n)
n
- the Node
object representing
the active PREP elementpublic static void endPREP(Node n)
n
- the Node
object representing
the active PREP elementpublic static void startSYNRESTRS(Node n)
n
- the Node
object representing
the active SYNRESTRS elementpublic static void endSYNRESTRS(Node n)
n
- the Node
object representing
the active SYNRESTRS elementpublic static void startSYNRESTR(Node n)
n
- the Node
object representing
the active SYNRESTR elementpublic static void endSYNRESTR(Node n)
<!ELEMENT SYNRESTR EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startSYNRESTR(Node)
method.
n
- the Node
object representing
the active SYNRESTR elementpublic static void startVERB(Node n)
n
- the Node
object representing
the active VERB elementpublic static void endVERB(Node n)
<!ELEMENT VERB EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startVERB(Node)
method.
n
- the Node
object representing
the active VERB elementpublic static void startADJ(Node n)
n
- the Node
object representing
the active ADJ elementpublic static void endADJ(Node n)
<!ELEMENT ADJ EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startADJ(Node)
method.
n
- the Node
object representing
the active ADJ elementpublic static void startADV(Node n)
n
- the Node
object representing
the active ADV elementpublic static void endADV(Node n)
<!ELEMENT ADV EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startADV(Node)
method.
n
- the Node
object representing
the active ADV elementpublic static void startLEX(Node n)
n
- the Node
object representing
the active LEX elementpublic static void endLEX(Node n)
<!ELEMENT LEX EMPTY>
in the DTD, so any "closing HTML" could just be placed at the
end of the startLEX(Node)
method.
n
- the Node
object representing
the active LEX element
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |