|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvn.Inspector
public class Inspector
The driver class for the Inspector. This class parses the command-line arguments
given to it and scans the VerbNet XML files while taking the desired actions.
The arguments are used to set flag and view option variables that both
this class and the Sweeper
class use to customize the output. There are five
operators added to the original Inspector to implement the VxC application: -C, -M, -F, A, and -S. Look
at the full usage for further details. The general usage is:
java vn.Inspector [flags] <x> [-V <v>] [-O <o>] -C <c> -M <m> -F <f> [-A <a>] [-S <s>]See the usage note (
java vn.Inspector -?
) for full details.
verbSemTrans
semantic predicates. The -M operator specifies the
manual mapping file against which to compare automatic mapping results. The -F operator
is the location of the file into which all the automatic matches should be placed.
Cyc.flManualClassesOnly
flag (set with -Sm) which skips over those classes and subclasses not included in the manual mapping.
This is useful for analysis of the rules chosen to determine a match between VN and Cyc -
you can just concentrate on the classes for which you'll get a statistical measure of success
(the manual mapping classes).
sh/bash/csh/tcsh: java vn.Inspector verbnet-xml/ -Vfcm -Och > outputHowever, if you are embedding these classes in an application, then you can utilize the
System.setOut(PrintStream)
method to redirect stdout
to an external file from within the Java code. One would most likely call this
method in the 'start' event for the program in
EventManager.fireEvent(int, int, String, String, String, Element, Element)
.
Cyc.flShowDiscards
flag (set with -Sd) option forces a line of text to be printed
to stderr for each naive match that was discarded (after having the constraints specified
by the -A operator applied to it). This text includes what naive match it was and
why it was discarded. You can redirect stderr to a file with:
sh/bash: java vn.Inspector verbnet-xml/ [...] -Sd 2> reasons-for-discard csh/tcsh: ( java vn.Inspector verbnet-xml/ [...] -Sd > temp ) >& reasons-for-discardAbove,
[...]
represents all the other operators and flags you would supply for the execution (i.e. -C, -M, -F).
For csh/tcsh shells, the temp
file is required to properly extract just the
errors from the program into reasons-for-discard
.
analyzeArguments(String[])
was enhanced to
validate them and pass them on to the Cyc
class.
Inspector
,
Sweeper
, and EventManager
classes) provide some more
logistical details about the software.
%Agent
). Look at the UVI's key or
the Inspector's key (-k option on command line) for more information.
javac
1.4.2. The reason for this was so
researchers did not need to download and run Java 1.5 for this software. This software
will however work with Java 1.5. If you do not have Java installed on your system,
download the most recent release
right here.
Also, here are links to the 1.4.2 documentation
and the 1.5.0 documentation.
Nested Class Summary | |
---|---|
private static class |
Inspector.InvalidCommandLineArgumentException
Exception class for identifying when the user did not supply a command-line of the proper format. |
private static class |
Inspector.InvalidPathException
Exception class for identifying when the user did not supply a valid XML input directory. |
private static class |
Inspector.MyFilter
Decides which files to select for the File.listFiles()
method of the File class. |
private static class |
Inspector.UserWantsHelpMessage
Exception class for identifying when the user requests to view the help/usage message for the program. |
private static class |
Inspector.UserWantsKey
Exception class for identifying when the user requests to view the key. |
Field Summary | |
---|---|
private static String |
ALL_OPER_CHARS
All operators used on the command line. |
private static String |
ALL_VIEW_OPTS
All view options. |
private static String[] |
allOnlyFiles
An array representing all the tokens supplied to the -O operator. |
(package private) static String |
flags
A string representation of all of the flags supplied on the command line. |
(package private) static boolean |
flClassCounts
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to view count information
for each class and subclass that is displayed in normal output. |
(package private) static boolean |
flClassH
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to see the class hierarchy. |
(package private) static boolean |
flErrProgress
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like each file name to be
printed to stderr as it is encountered. |
(package private) static boolean |
flHelp
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to see the help/usage
message. |
(package private) static boolean |
flIndent
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like both the normal output
and class hierarchy indented. |
(package private) static boolean |
flKey
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to see the key for the
thematic role and syntax restrictions. |
(package private) static boolean |
flNoAbsence
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to supress the absence
labels in the normal output and class hierarchy. |
(package private) static boolean |
flNoFinalCounts
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to suppress the final count
information that is printed after normal output and class hierarchy. |
(package private) static boolean |
flNoHeader
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to suppress the header
information that is printed before normal output and class hierarchy. |
(package private) static boolean |
flReplicate
A flag set in analyzeArguments(String[]) and
used to print all the labels that represent additional nesting
(file, class, subclass, and frame) before every element that is printed. |
(package private) static boolean |
flSortMembers
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like the verbs in the members
section sorted. |
(package private) static boolean |
flSuppressEvents
A flag set in analyzeArguments(String[]) and
used to suppress the firing of all events. |
(package private) static boolean |
flVFPairs
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like the Inspector to run
in verb-frame pair mode. |
(package private) static boolean |
flVFPairsInvert
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like the Sweeper to visit
verb-frame pairs in frame-major order instead of a verb-major
order. |
(package private) static boolean |
flZeroCounts
A flag set in analyzeArguments(String[]) and
used to indicate that the user would like to view those counts
in both class counts and final counts that are equal to zero in
addition to the non-zero counts. |
private static String |
onlyTheseFiles
The files that the user has requested to see. |
private static HashMap |
tagCounterClass
A map which ties an integer to a string. |
private static HashMap |
tagCounterGlobal
A map which ties an integer to a string. |
(package private) static String |
viewOpts
A string representation of all of the view options supplied on the command line. |
private static File |
vnDir
The directory where the VerbNet XML files are located. |
(package private) static boolean |
voAll
A view option set in analyzeArguments(String[]) and
used to enable all basic view options in normal output mode. |
(package private) static boolean |
voClassName
A view option set in analyzeArguments(String[]) and
used to display class and subclass names in normal output mode. |
(package private) static boolean |
voComplete
A view option set in analyzeArguments(String[]) and
used to display non-standard attributes in normal output mode. |
(package private) static boolean |
voCount
A view option set in analyzeArguments(String[]) and
used to display member and frame counts in normal output mode. |
(package private) static boolean |
voExample
A view option set in analyzeArguments(String[]) and
used to display examples in normal output mode. |
(package private) static boolean |
voFileName
A view option set in analyzeArguments(String[]) and
used to display file names in normal output mode. |
(package private) static boolean |
voFrame
A view option set in analyzeArguments(String[]) and
used to display frame descriptions in normal output mode. |
(package private) static boolean |
voMember
A view option set in analyzeArguments(String[]) and
used to display member (verbs) in normal output mode. |
(package private) static boolean |
voSemantics
A view option set in analyzeArguments(String[]) and
used to display semantics in normal output mode. |
(package private) static boolean |
voSyntax
A view option set in analyzeArguments(String[]) and
used to display syntax in normal output mode. |
(package private) static boolean |
voThemRole
A view option set in analyzeArguments(String[]) and
used to display thematic roles in normal output mode. |
(package private) static boolean |
voTRSelRestr
A view option set in analyzeArguments(String[]) and
used to display selectional restrictions for thematic roles in normal output
mode. |
(package private) static boolean |
voVFPairs
A view option set in analyzeArguments(String[]) and
used to display verb-frame pair descriptions in normal output mode. |
(package private) static boolean |
voWordNet
A view option set in analyzeArguments(String[]) and
used to display WordNet senses in normal output mode. |
(package private) static boolean |
voXSelRestr
A view option set in analyzeArguments(String[]) and
used to display selectional restrictions for noun phrases in normal output
mode. |
(package private) static boolean |
voXSynRestr
A view option set in analyzeArguments(String[]) and
used to display the current file in normal output mode. |
private static File[] |
xmlFiles
A list of just the XML files located in the XML input directory. |
Constructor Summary | |
---|---|
private |
Inspector()
This constructor is private because the class is not intended to ever be instantiated. |
Method Summary | |
---|---|
private static void |
analyzeArguments(String[] args)
Validates all of the command-line arguments and sets appropriate class-level variables. |
(package private) static void |
clearClassTagCounter()
Empties the class counts tag counter. |
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 void |
executeHTMLMethod(String which,
Node n)
Executes a method in the Sweeper class based on an XML element tag name
(i.e. 'VNCLASS') and a 'start' or 'end' flag. |
(package private) static String |
filePath(File f)
Returns a descriptive path for a File object. |
private static int |
getTagCount(HashMap tagCounter,
String tagName)
Returns the number of times a given tag name was encountered for the given counter. |
(package private) static void |
incrementTagCounter(String tagName)
Increments the counter for a given tag by 1. |
(package private) static void |
incrementTagCounter(String tagName,
int howMany)
Increments the counter for a given tag by a given integer. |
static void |
main(String[] args)
The main method of the program. |
private static void |
performInspection()
Performs the scanning of the XML files in the XML input directory. |
private static void |
print(String s)
Used as shorthand for System.out.print . |
private static void |
printHeader()
Prints the header for this execution of the Inspector. |
private static void |
printKey()
Prints the thematic role and syntax key. |
private static void |
println(String s)
Used as shorthand for System.out.println . |
private static void |
printTagCount(HashMap tagCounter,
String tagName)
Prints a tag name along with the number of times it was encountered. |
(package private) static void |
printTagCounts(boolean useClassCounter)
Prints all the counts from either the class counts tag counter or the final counts tag counter. |
private static void |
printUsage()
Prints the usage (a.k.a. help message) for the Inspector. |
private static void |
processNode(Node n)
Starts by outputting the simple text you would want to output upon encountering the start of the given node, then recursively prints all the simple text associated with this node's children nodes, and finally outputs the simple text needed for the close of the given node. |
(package private) static void |
processNodeByPairs(Node n,
ArrayList prevFrames)
Starts by outputting the simple text you would want to output upon encountering the start of the given node, then recursively prints all the simple text associated with this node's children nodes, and finally outputs the simple text needed for the close of the given node. |
static void |
run(String commandLine)
Executes the Inspector application. |
private static void |
sortXMLFiles()
Sorts the already loaded XML files array xmlFiles . |
private static String |
together(String[] array)
Concatenates all the elements in a string array, separated by spaces. |
(package private) static String |
wrapString(String s)
Massages a string that could be null for the header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static File vnDir
analyzeArguments(String[])
,
printHeader()
private static File[] xmlFiles
Inspector.MyFilter
) to list just
the XML files.
analyzeArguments(String[])
,
performInspection()
static String flags
analyzeArguments(String[])
,
printHeader()
static boolean flHelp
analyzeArguments(String[])
and
used to indicate that the user would like to see the help/usage
message. This flag is set with the -? option. If this option
is supplied, the program prints the usage message and exits.
No further processing occurs.
analyzeArguments(String[])
static boolean flKey
analyzeArguments(String[])
and
used to indicate that the user would like to see the key for the
thematic role and syntax restrictions. This flag is set
with the -k option. If this option is supplied, the program prints
the key and exits. No further processing occurs.
analyzeArguments(String[])
static boolean flClassH
analyzeArguments(String[])
and
used to indicate that the user would like to see the class hierarchy.
This flag is set with the -c option. If this option is supplied, the
program prints the class hierarchy and exits. No further processing
occurs. The -V operator is ignored and the -m option is not honored.
Only final counts can be seen when viewing the class hierarchy.
analyzeArguments(String[])
,
processNode(Node)
,
Sweeper.startVNCLASS(Node)
,
Sweeper.classHierarchyPrint(Element, int)
static boolean flNoHeader
analyzeArguments(String[])
and
used to indicate that the user would like to suppress the header
information that is printed before normal output and class hierarchy.
This flag is set with the -h option.
analyzeArguments(String[])
,
main(String[])
static boolean flNoFinalCounts
analyzeArguments(String[])
and
used to indicate that the user would like to suppress the final count
information that is printed after normal output and class hierarchy.
This flag is set with the -n option.
analyzeArguments(String[])
,
main(String[])
static boolean flClassCounts
analyzeArguments(String[])
and
used to indicate that the user would like to view count information
for each class and subclass that is displayed in normal output.
This flag is set with the -m option. This option has no effect
when the class hierarchy is printed.
analyzeArguments(String[])
,
incrementTagCounter(String, int)
,
Sweeper.endFRAMES(Node)
,
printTagCounts(boolean)
static boolean flZeroCounts
analyzeArguments(String[])
and
used to indicate that the user would like to view those counts
in both class counts and final counts that are equal to zero in
addition to the non-zero counts. This flag is set with the -0 option.
analyzeArguments(String[])
,
printTagCounts(boolean)
,
printTagCount(HashMap, String)
static boolean flErrProgress
analyzeArguments(String[])
and
used to indicate that the user would like each file name to be
printed to stderr as it is encountered. This flag is set with the
-w option. This option exists only as a convenience so that if
stdout is being redirected to a file, one can still view the progress
of the Inspector.
analyzeArguments(String[])
,
performInspection()
static boolean flSortMembers
analyzeArguments(String[])
and
used to indicate that the user would like the verbs in the members
section sorted. This flag is set with the -s option. If the
Inspector is running in verb-frame pair mode (-q or -Vq supplied) then
the verb-frame pairs will also be sorted by the verb.
analyzeArguments(String[])
,
Sweeper.startMEMBER(Node)
,
Sweeper.printMembers()
static boolean flIndent
analyzeArguments(String[])
and
used to indicate that the user would like both the normal output
and class hierarchy indented. This flag is set with the -i option.
Indentation occurs with files, classes, subclasses, and frames.
All output which is logically under these elements is indented over
one additional indent width. The indent width is 3 spaces.
analyzeArguments(String[])
,
Sweeper.iprintln(String)
,
Sweeper.iprint(String)
,
Sweeper.classHierarchyPrint(Element, int)
,
Sweeper.INDENT_WIDTH
static boolean flNoAbsence
analyzeArguments(String[])
and
used to indicate that the user would like to supress the absence
labels in the normal output and class hierarchy. This flag is set
with the -z option. An absence label is one of the following:
<NO SUBCLASSES>, <NO MEMBERS>, <NO THEMROLES>,
<NO FRAMES>, or <NO
analyzeArguments(String[])
,
Sweeper.classHierarchyPrint(Element, int)
,
Sweeper.startMEMBERS(Node)
,
Sweeper.startTHEMROLES(Node)
,
Sweeper.startFRAMES(Node)
,
Sweeper.printVerbFramePairs()
static boolean flVFPairs
analyzeArguments(String[])
and
used to indicate that the user would like the Inspector to run
in verb-frame pair mode. This flag is set with the -q option.
The -Vq option implies the -q option. If the -q is set, then
-Vm or -Vr imply -Vq.processNodeByPairs(Node, ArrayList)
instead of processNode(Node)
). Also, nothing besides
thematic roles is printed until the closing of the FRAMES element.
At which point, Sweeper.printVerbFramePairs()
is called to
print all the pairs.
analyzeArguments(String[])
,
performInspection()
,
Sweeper.startMEMBERS(Node)
,
Sweeper.endMEMBERS(Node)
,
Sweeper.startFRAMES(Node)
,
Sweeper.endFRAMES(Node)
,
Sweeper.startFRAME(Node)
,
Sweeper.endFRAME(Node)
,
Sweeper.startDESCRIPTION(Node)
,
Sweeper.curVFFrameList
static boolean flVFPairsInvert
analyzeArguments(String[])
and
used to indicate that the user would like the Sweeper to visit
verb-frame pairs in frame-major order instead of a verb-major
order. This flag is set with the -v option. This option is
ineffective unless -q or -Vq is supplied. To illustrate this
option, here is a small table:Verb Major | Frame Major |
VERB 1 - FRAME 1 VERB 1 - FRAME 2 VERB 2 - FRAME 1 VERB 2 - FRAME 2 |
FRAME 1 - VERB 1 FRAME 1 - VERB 2 FRAME 2 - VERB 1 FRAME 2 - VERB 2 |
analyzeArguments(String[])
,
Sweeper.printVerbFramePairs()
static boolean flSuppressEvents
analyzeArguments(String[])
and
used to suppress the firing of all events. If this flag is set,
the Inspector is only acting as a VerbNet viewer, printing out
those elements of the XML files as specified by the -V operator.
analyzeArguments(String[])
static boolean flReplicate
analyzeArguments(String[])
and
used to print all the labels that represent additional nesting
(file, class, subclass, and frame) before every element that is printed. The
output becomes abundant but this option is provided only for added
interoperability with grep. The additional labels that are printed
are still dependent on view options, but do not affect class or
final counts.
analyzeArguments(String[])
private static final String ALL_OPER_CHARS
analyzeArguments(String[])
,
Constant Field Valuesprivate static final String ALL_VIEW_OPTS
analyzeArguments(String[])
.
analyzeArguments(String[])
,
Constant Field Valuesstatic String viewOpts
analyzeArguments(String[])
,
printHeader()
static boolean voFileName
analyzeArguments(String[])
and
used to display file names in normal output mode. This view
option is set with the letter f
.
analyzeArguments(String[])
,
Sweeper.startVNCLASS(Node)
,
Sweeper.endVNCLASS(Node)
static boolean voClassName
analyzeArguments(String[])
and
used to display class and subclass names in normal output mode. This view
option is set with the letter c
.
analyzeArguments(String[])
,
Sweeper.startVNCLASS(Node)
,
Sweeper.endVNCLASS(Node)
,
Sweeper.startVNSUBCLASS(Node)
,
Sweeper.endVNSUBCLASS(Node)
static boolean voCount
analyzeArguments(String[])
and
used to display member and frame counts in normal output mode. This view
option is set with the letter n
. For this view option to
have any effect, the -Vc option must also be supplied. Member and frame
counts include only the class being processed, not ancestor or
descendant classes.
analyzeArguments(String[])
,
Sweeper.startVNCLASS(Node)
,
Sweeper.startVNSUBCLASS(Node)
static boolean voMember
analyzeArguments(String[])
and
used to display member (verbs) in normal output mode. This view
option is set with the letter m
.
analyzeArguments(String[])
,
Sweeper.startMEMBERS(Node)
,
Sweeper.endMEMBER(Node)
,
Sweeper.printMembers()
static boolean voWordNet
analyzeArguments(String[])
and
used to display WordNet senses in normal output mode. This view
option is set with the letter w
. For this view option to
have any effect, the -Vm option must also be supplied.
analyzeArguments(String[])
,
Sweeper.startDESCRIPTION(Node)
,
Sweeper.printMembers()
static boolean voThemRole
analyzeArguments(String[])
and
used to display thematic roles in normal output mode. This view
option is set with the letter t
.
analyzeArguments(String[])
,
Sweeper.startTHEMROLES(Node)
,
Sweeper.endTHEMROLES(Node)
,
Sweeper.startTHEMROLE(Node)
,
Sweeper.endTHEMROLE(Node)
,
Sweeper.startSELRESTRS(Node)
,
Sweeper.endSELRESTRS(Node)
,
Sweeper.startSELRESTR(Node)
,
Sweeper.endSELRESTR(Node)
static boolean voTRSelRestr
analyzeArguments(String[])
and
used to display selectional restrictions for thematic roles in normal output
mode. This view option is set with the letter u
. For this view
option to have any effect, the -Vt option must also be supplied.
analyzeArguments(String[])
,
Sweeper.startSELRESTRS(Node)
,
Sweeper.endSELRESTRS(Node)
,
Sweeper.startSELRESTR(Node)
,
Sweeper.endSELRESTR(Node)
static boolean voFrame
analyzeArguments(String[])
and
used to display frame descriptions in normal output mode. This view
option is set with the letter r
.
analyzeArguments(String[])
,
Sweeper.startFRAMES(Node)
,
Sweeper.endFRAMES(Node)
,
Sweeper.startFRAME(Node)
,
Sweeper.endFRAME(Node)
,
Sweeper.startDESCRIPTION(Node)
,
Sweeper.endDESCRIPTION(Node)
static boolean voExample
analyzeArguments(String[])
and
used to display examples in normal output mode. This view
option is set with the letter e
.
analyzeArguments(String[])
,
Sweeper.startEXAMPLES(Node)
,
Sweeper.endEXAMPLES(Node)
,
Sweeper.startEXAMPLE(Node)
,
Sweeper.endEXAMPLE(Node)
static boolean voSyntax
analyzeArguments(String[])
and
used to display syntax in normal output mode. This view
option is set with the letter x
. The format used is
congruent to the Unified Verb Index save for the noun phrase
thematic roles, which are preceded by a % sign instead of underline.
analyzeArguments(String[])
,
Sweeper.startSELRESTRS(Node)
,
Sweeper.endSELRESTRS(Node)
,
Sweeper.startSELRESTR(Node)
,
Sweeper.endSELRESTR(Node)
,
Sweeper.startSYNTAX(Node)
,
Sweeper.endSYNTAX(Node)
,
Sweeper.startNP(Node)
,
Sweeper.endNP(Node)
,
Sweeper.startSYNRESTRS(Node)
,
Sweeper.endSYNRESTRS(Node)
,
Sweeper.startSYNRESTR(Node)
,
Sweeper.endSYNRESTR(Node)
,
Sweeper.startPREP(Node)
,
Sweeper.endPREP(Node)
,
Sweeper.startVERB(Node)
,
Sweeper.endVERB(Node)
,
Sweeper.startADJ(Node)
,
Sweeper.endADJ(Node)
,
Sweeper.startADV(Node)
,
Sweeper.endADV(Node)
,
Sweeper.startLEX(Node)
,
Sweeper.endLEX(Node)
static boolean voXSynRestr
analyzeArguments(String[])
and
used to display the current file in normal output mode. This view
option is set with the letter y
. For this view
option to have any effect, the -Vx option must also be supplied.
analyzeArguments(String[])
,
Sweeper.startSYNRESTRS(Node)
,
Sweeper.endSYNRESTRS(Node)
,
Sweeper.startSYNRESTR(Node)
,
Sweeper.endSYNRESTR(Node)
static boolean voXSelRestr
analyzeArguments(String[])
and
used to display selectional restrictions for noun phrases in normal output
mode. This view option is set with the letter z
. For this view
option to have any effect, the -Vx option must also be supplied. Preposition
classes also use selectional restrictions but are not affected by this
view option.
analyzeArguments(String[])
,
Sweeper.startSELRESTRS(Node)
,
Sweeper.endSELRESTRS(Node)
,
Sweeper.startSELRESTR(Node)
,
Sweeper.endSELRESTR(Node)
static boolean voSemantics
analyzeArguments(String[])
and
used to display semantics in normal output mode. This view
option is set with the letter s
. One line of text is
printed for each predicate.
analyzeArguments(String[])
,
Sweeper.startSEMANTICS(Node)
,
Sweeper.endSEMANTICS(Node)
,
Sweeper.startPRED(Node)
,
Sweeper.endPRED(Node)
,
Sweeper.startARGS(Node)
,
Sweeper.endARGS(Node)
,
Sweeper.startARG(Node)
,
Sweeper.endARG(Node)
static boolean voAll
analyzeArguments(String[])
and
used to enable all basic view options in normal output mode. This view
option is set with the letter a
. All basic view options
include: fcnmwturexyzs
.
analyzeArguments(String[])
static boolean voVFPairs
analyzeArguments(String[])
and
used to display verb-frame pair descriptions in normal output mode. This view
option is set with the letter q
. This forces the Inspector
to run in verb-frame pair mode (see flVFPairs
). This
view option will display the line which shows the the verb and the frame
description. Examples, syntax, and semantics will follow this line, if
their corresponding view options are supplied. Although the flag
flVFPairs
creates most of the processing changes
for verb-frame pairs, this flag makes sure the counters get incremented
if a verb-frame pair description is printed and decides whether or not
to print the absence label if a class or subclass has no verb-frame pairs.
analyzeArguments(String[])
,
Sweeper.startFRAME(Node)
,
Sweeper.printVerbFramePairs()
static boolean voComplete
analyzeArguments(String[])
and
used to display non-standard attributes in normal output mode. This view
option is set with the letter b
. The non-standard attributes
that are included are: DESCRIPTION/descriptionNumber, DESCRIPTION/xtag, and
ARG/type. So to view as much of the XML files as possible, use -Vab.
analyzeArguments(String[])
,
Sweeper.startDESCRIPTION(Node)
,
Sweeper.startARG(Node)
private static String onlyTheseFiles
null
if the user did not specify the -O operator. If the user
did not specify the -O operator, then all the XML files in the input
directory are proessed. If the -O operator is supplied, its argument
limits which XML files that are actually processed. Only those files whose
names start with one of the tokens supplied to -O will be processed.
For example, a possible value for this variable could be "ch,care" if
the user supplied the option "-Och,care". If one of the tokens is not
the beginning of any XML file name (i.e. -Oxyz), then it is ignored.
analyzeArguments(String[])
,
printHeader()
,
performInspection()
private static String[] allOnlyFiles
analyzeArguments(String[])
. Later, each
XML file is compared against the elements in this array. If its name
starts with any one of the elements of this array, it is processed.
analyzeArguments(String[])
,
performInspection()
private static HashMap tagCounterClass
incrementTagCounter(String, int)
,
clearClassTagCounter()
,
printTagCounts(boolean)
private static HashMap tagCounterGlobal
incrementTagCounter(String, int)
,
printTagCounts(boolean)
Constructor Detail |
---|
private Inspector()
Method Detail |
---|
private static void println(String s)
System.out.println
.
s
- the string to print to stdout, followed by a carriage returnPrintStream.println(String)
private static void print(String s)
System.out.print
.
s
- the string to print to stdoutPrintStream.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)
private static String together(String[] array)
array
- the string array
main(String[])
private static void sortXMLFiles()
xmlFiles
.
This is because different operating systems will return a directory's
contents in different orders but we want to always process the files
in a consistent fashion.
public static void main(String[] args)
args
- the command line arguments supplied to the InspectoranalyzeArguments(String[])
,
performInspection()
,
printHeader()
,
printTagCounts(boolean)
public static void run(String commandLine)
vn.Inspector.main( new String[] { "../vn-xml", "-Vab", "-ir", "-Ocare" } );
vn.Inspector.run( "../vn-xml -Vab -ir -Ocare" );
commandLine
- a single string of all the command line arguments,
separated by spacesmain(String[])
private static void printUsage()
main(String[])
private static void printKey()
main(String[])
private static void printHeader()
main(String[])
,
wrapString(String)
,
filePath(File)
static String wrapString(String s)
flags
,
vnDir
, viewOpts
,
and onlyTheseFiles
begin as null
and are only given values if they have a corresponding
value on the command line.
s
- the string to massage
printHeader()
static String filePath(File f)
File
object. This is
only a distinct method due to the possibility of the more desired method,
File.getCanonicalPath()
to throw an exception. If an
exception is thrown, the basic File.getPath()
is returned.
f
- the file whose path to retrieve
printHeader()
static void incrementTagCounter(String tagName)
tagName
- the name of the tag whose counter to increment by 1tagCounterClass
,
tagCounterGlobal
,
Sweeper.startVNCLASS(Node)
,
Sweeper.startVNSUBCLASS(Node)
,
Sweeper.startTHEMROLE(Node)
,
Sweeper.startFRAME(Node)
,
Sweeper.startEXAMPLE(Node)
,
Sweeper.startSYNTAX(Node)
,
Sweeper.startPRED(Node)
,
Sweeper.printMembers()
,
Sweeper.classHierarchyPrint(Element, int)
static void incrementTagCounter(String tagName, int howMany)
Sweeper.classHierarchyPrint(Element, int)
to increment member and frame counters more quickly and indirectly by
all thosme methods which directly call incrementTagCounter(String)
.
This me,hod increments both the class counts tag counter and the final counts tag counter
simultaneously.
tagName
- the name of the tag whose counter to increment by howMany
howMany
- the number of times to increment the tag counter for tagName
tagCounterGlobal
,
Sweeper.classHierarchyPrint(Element, int)
,
incrementTagCounter(String)
static void clearClassTagCounter()
Sweeper.startVNCLASS(Node)
,
Sweeper.startVNSUBCLASS(Node)
static void printTagCounts(boolean useClassCounter)
useClassCounter
- whether or not to print the class counts. If set
to true
the class counts are printed, otherwise the
final counts are printed.main(String[])
,
Sweeper.endFRAMES(Node)
,
printTagCount(HashMap, String)
private static void printTagCount(HashMap tagCounter, String tagName)
flZeroCounts
flag is set.
tagName
- the tag name whose count to printprintTagCounts(boolean)
,
getTagCount(HashMap, String)
private static int getTagCount(HashMap tagCounter, String tagName)
tagName
- the tag name whose count to return
printTagCounts(boolean)
,
printTagCount(HashMap, String)
private static void analyzeArguments(String[] args) throws Inspector.InvalidCommandLineArgumentException, Inspector.InvalidPathException, Inspector.UserWantsHelpMessage, Inspector.UserWantsKey
args
- the command-line arguments from main(String[])
Inspector.InvalidCommandLineArgumentException
- if the command-line contains invalid flags
or does not contain the requisite XML input directory.
Inspector.InvalidPathException
- if the XML input directory does not exist or does not have
the appropriate permissions.
Inspector.UserWantsHelpMessage
- if the user has supplied the help flag.
Inspector.UserWantsKey
- if the user has supplied the key flag.main(String[])
,
Inspector.MyFilter
private static void performInspection()
main(String[])
,
processNode(Node)
,
processNodeByPairs(Node, ArrayList)
private static void processNode(Node n)
n
- the XML node for which to generate simple-text representationperformInspection()
,
executeHTMLMethod(String, Node)
static void processNodeByPairs(Node n, ArrayList prevFrames)
processNode(Node)
is that this method accumulates frames as it traverses down the class tree.
This ensures that a subclass at depth 2 has all the frames of the main class
(depth 0), the subclass at depth 1, and itself, the subclass at depth 2.
See more information at Sweeper.curVFFrameList
.
n
- the XML node for which to generate simple-text representationprevFrames
- all the frames accumulated since the main class of the fileperformInspection()
,
executeHTMLMethod(String, Node)
,
Sweeper.curVFFrameList
private static void executeHTMLMethod(String which, Node n)
Sweeper
class based on an XML element tag name
(i.e. 'VNCLASS') and a 'start' or 'end' flag. Each of the methods in Sweeper,
startVNCLASS, endVNCLASS, startMEMBERS, endMEMBERS, etc., produce simple text.
This method just calls the right method based on the current node being
processed by processNode(Node)
or
processNodeByPairs(Node, ArrayList)
.
which
- either the value 'start' or 'end', the string to prepend to the
tag name when locating the method in Sweeper
n
- the node whose tag name should be located in the Sweeper methodsprocessNode(Node)
,
processNodeByPairs(Node, ArrayList)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |