|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvn.EventManager
public class EventManager
This class implements the mock application. When extending the Inspector one does not need to change the files Inspector.java or Sweeper.java. One only needs to change this file, EventManager.java. The goal of the mock application is to demonstrate what elements of Java code should go where when modifying this file. This mock application is small and attempts to find a mapping between VerbNet and an invented toy lexicon called TOYLEX. This lexicon is enumerated here:
TOYLEX | |
Verb | Semantics |
run | horizontal movement |
walk | horizontal movement |
jump | vertical movement |
spring | vertical movement |
push | move by force |
shove | move by force |
java vn.Inspector xml/ -qThe verb-frame pairs option (-q) is used to implement this application. This option displays a verb-frame pair for each frame that a verb can participate in. There are close to 30,000 such pairs. One can imagine other ways to implement the same mock application, without using verb-frame pairs as well, since this event interface is as generic as possible.
fireEvent(int, int, String, String, String, Element, Element)
Nested Class Summary | |
---|---|
private static class |
EventManager.MyLexiconEntry
Represents a single lexical entry in our TOYLEX lexicon. |
Field Summary | |
---|---|
(package private) static int |
EVENT_CLASS
Identifies that the event is for a main class. |
(package private) static int |
EVENT_END
Identifies that the event firing corresponds to the end of the element in question. |
(package private) static int |
EVENT_END_FRAMES
Identifies the moment right before another class begins. |
(package private) static int |
EVENT_EXAMPLE
Identifies that the event is for an example. |
(package private) static int |
EVENT_FILE
Identifies that the event is for a single XML file. |
(package private) static int |
EVENT_FRAME
Identifies that the event is for a frame. |
(package private) static int |
EVENT_MEMBER
Identifies that the event is for a single member (verb). |
(package private) static int |
EVENT_PROGRAM
Identifies that the event is for the entire program. |
(package private) static int |
EVENT_SEMANTIC_PRED
Identifies that the event is for a single semantic predicate. |
(package private) static int |
EVENT_START
Identifies that the event firing corresponds to the beginning of the element in question. |
(package private) static int |
EVENT_SUBCLASS
Identifies that the event is for a subclass. |
(package private) static int |
EVENT_SYNTAX
Identifies that the event is for syntax. |
(package private) static int |
EVENT_THEMROLE
Identifies that the event is for a thematic role. |
(package private) static int |
EVENT_VF_PAIR
Identifies that the event is for a verb-frame pair. |
private static ArrayList |
myLexicon
Holds all the lexical entries for our TOYLEX lexicon. |
private static PrintStream |
originalStdOut
The original stdout stream reference from the System class. |
private static String |
verb
A temporary variable to store the verb of a verb-frame pair when its 'start' event is fired until it can be used when the 'start' event for syntax is fired. |
Constructor Summary | |
---|---|
private |
EventManager()
This constructor is private because the class is not intended to ever be instantiated. |
Method Summary | |
---|---|
(package private) static void |
fireEvent(int type,
int startOrEnd,
String curFile,
String curClass,
String text,
Element n,
Element nExtra)
Captures events from the Inspector scanning system and looks for possible mappings (matches) between the VerbNet data and TOYLEX. |
(package private) static void |
fireEventMaybe(int type,
int startOrEnd,
String curFile,
String curClass,
String text,
Node n,
Node nExtra)
Fires an event if events are enabled for this execution of the Inspector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static String verb
private static ArrayList myLexicon
static final int EVENT_START
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_END
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_PROGRAM
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_FILE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_CLASS
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SUBCLASS
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_MEMBER
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_THEMROLE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_FRAME
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_EXAMPLE
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SYNTAX
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_SEMANTIC_PRED
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_VF_PAIR
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesstatic final int EVENT_END_FRAMES
fireEvent(int, int, String, String, String, Element, Element)
,
Constant Field Valuesprivate static PrintStream originalStdOut
System
class.
This is saved in the static initializer for this class and exists just in case
the stdout stream is reset to a custom file in the
fireEvent(int, int, String, String, String, Element, Element)
.
A researcher can use this reference to reset the System
class's stdout
stream back to the original stream whenever desired.
System.out
,
System.setOut(PrintStream)
Constructor Detail |
---|
private EventManager()
Method Detail |
---|
static void fireEvent(int type, int startOrEnd, String curFile, String curClass, String text, Element n, Element nExtra)
type
- the type of element to which this event corresponds
(EVENT_PROGRAM
, EVENT_FILE
, etc.)startOrEnd
- whether this event is for the beginning of the
element or the end of the element
(EVENT_START
or EVENT_END
)curFile
- the name of the file currently being processed (i.e. approve-77.xml). This argument is
null
for the PROGRAM element.curClass
- the name of the class or subclass currently being processed (i.e. devour-39.4-1).
This argument is null
for the PROGRAM and FILE elements.text
- the simple-text representation of the element to which this
event corresponds. This text is equivalent to the text that would be
printed for this element had it been printed by the Inspector under the
view options -Vab (full output). For the PROGRAM element, this argument is
equal to the concatenation of all the command line elements with spaces.n
- the XML node corresponding to the element being visited. This argument is
null
for the PROGRAM and FILE elements. For verb-frame pairs,
this is the XML node corresponding to the MEMBER element in the verb-frame
pair.nExtra
- the XML node corresponding to the FRAME element in the verb-frame
pair being visited. This argument is null
for all other elements.static void fireEventMaybe(int type, int startOrEnd, String curFile, String curClass, String text, Node n, Node nExtra)
fireEvent
method. It also makes a quick conversion between
Node
s and Element
s for code simplification
purposes only. Do not modify this method.
type
- the type of element to which this event corresponds
(EVENT_PROGRAM
, EVENT_FILE
, etc.)startOrEnd
- whether this event is for the beginning of the
element or the end of the element
(EVENT_START
or EVENT_END
)curFile
- the name of the file currently being processed (i.e. approve-77.xml). This argument is
null
for the PROGRAM element.curClass
- the name of the class or subclass currently being processed (i.e. devour-39.4-1).
This argument is null
for the PROGRAM and FILE elements.text
- the simple-text representation of the element to which this
event corresponds. This text is equivalent to the text that would be
printed for this element had it been printed by the Inspector under the
view options -Vab (full output). For the PROGRAM element, this argument is
equal to the concatenation of all the command line elements with spaces.n
- the XML node corresponding to the element being visited. This argument is
null
for the PROGRAM and FILE elements. For verb-frame pairs,
this is the XML node corresponding to the MEMBER element in the verb-frame
pair.nExtra
- the XML node corresponding to the FRAME element in the verb-frame
pair being visited. This argument is null
for all other elements.fireEvent(int, int, String, String, String, Element, Element)
,
Inspector.flSuppressEvents
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |