vn
Class EventManager

java.lang.Object
  extended by vn.EventManager

public class EventManager
extends Object

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
VerbSemantics
runhorizontal movement
walkhorizontal movement
jumpvertical movement
springvertical movement
pushmove by force
shovemove by force

This stand-alone application is invoked with
   java vn.Inspector xml/ -q
The 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.

The output of this program is essentially the mapping between VerbNet and TOYLEX. A single line of text is printed for each VerbNet-TOYLEX match. The matches are determined by seeing if various rules apply to pairs of VerbNet and TOYLEX data.

Version:
1.0, 2006.10.18
Author:
Derek Trumbo
See Also:
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

verb

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.


myLexicon

private static ArrayList myLexicon
Holds all the lexical entries for our TOYLEX lexicon. See the static initializer for more information.


EVENT_START

static final int EVENT_START
Identifies that the event firing corresponds to the beginning of the element in question.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_END

static final int EVENT_END
Identifies that the event firing corresponds to the end of the element in question.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_PROGRAM

static final int EVENT_PROGRAM
Identifies that the event is for the entire program.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_FILE

static final int EVENT_FILE
Identifies that the event is for a single XML file.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_CLASS

static final int EVENT_CLASS
Identifies that the event is for a main class.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_SUBCLASS

static final int EVENT_SUBCLASS
Identifies that the event is for a subclass.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_MEMBER

static final int EVENT_MEMBER
Identifies that the event is for a single member (verb).

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_THEMROLE

static final int EVENT_THEMROLE
Identifies that the event is for a thematic role.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_FRAME

static final int EVENT_FRAME
Identifies that the event is for a frame.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_EXAMPLE

static final int EVENT_EXAMPLE
Identifies that the event is for an example.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_SYNTAX

static final int EVENT_SYNTAX
Identifies that the event is for syntax.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_SEMANTIC_PRED

static final int EVENT_SEMANTIC_PRED
Identifies that the event is for a single semantic predicate. There are no events that fire for the SEMANTICS element as a whole, only one for each semantic predicate.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_VF_PAIR

static final int EVENT_VF_PAIR
Identifies that the event is for a verb-frame pair.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

EVENT_END_FRAMES

static final int EVENT_END_FRAMES
Identifies the moment right before another class begins. This is synonymous with </FRAMES> but not synonymous with end of class. So a special event is needed. This event only has an 'end' event.

See Also:
fireEvent(int, int, String, String, String, Element, Element), Constant Field Values

originalStdOut

private static PrintStream originalStdOut
The original stdout stream reference from the 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.

See Also:
System.out, System.setOut(PrintStream)
Constructor Detail

EventManager

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

Method Detail

fireEvent

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. The only events this method needs to act on to make this happen (at least for our toy lexicon) is 'start' verb-frame pair and 'start' semantics predicate. Just like the 'start' events for frames, the 'start' events for verb-frame pairs fire before the events for the examples, syntax, and semantic predicates that are contained within.

Parameters:
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.

fireEventMaybe

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. This method exists only to implement the "suppress all events" option (-e) of the Inspector. Events are enabled by default. This option must be supplied to prevent them from firing. If the events are not being suppressed, this method simply hands the arguments given to it to the real fireEvent method. It also makes a quick conversion between Nodes and Elements for code simplification purposes only. Do not modify this method.

Parameters:
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.
See Also:
fireEvent(int, int, String, String, String, Element, Element), Inspector.flSuppressEvents