Parsing Engine

danbikel.parser
Class GapEvent

java.lang.Object
  extended by danbikel.parser.GapEvent
All Implemented Interfaces:
TrainerEvent, Serializable, Cloneable

public class GapEvent
extends Object
implements TrainerEvent, Cloneable

A class to represent the gap generation event implicit in the models supported by this parsing package. The class Trainer counts such events, from which other events are derived.

See Also:
Serialized Form

Field Summary
static Symbol toHead
          The symbol representing a gap passed from a parent to its head.
static Symbol toLeft
          The symbol representing a gap passed from a parent to one of the premodifiers of its head child.
static Symbol toRight
          The symbol representing a gap passed from a parent to one of the postmodifiers of its head child.
 
Constructor Summary
GapEvent(Sexp sexp)
          Contructs a new object from the specified S-expression.
GapEvent(Symbol direction, Word headWord, Symbol parent, Symbol head)
          Constructs a new GapEvent object, setting all its data members to the specified values.
 
Method Summary
 Object clone()
          Returns a deep copy of this object.
 TrainerEvent copy()
          Returns a deep copy of this object.
 Symbol direction()
          Returns the direction of this gap event: one of {toHead, toLeft, toRight}.
 boolean equals(Object o)
          Returns true if the specified object is an instance of a GapEvent object containing data members which are all pairwise-equal with the data members of this GapEvent object, according to each data member's equals(Object) method.
 int hashCode()
          Returns the hash code of this object, calculated from the hash codes of all its data members.
 Symbol head()
          Returns the head nonterminal label.
 Word headWord()
          Returns the head word.
 Word modHeadWord()
          Returns null, as gap events do not deal with modifier words.
 Symbol parent()
          Returns the parent nonterminal label.
 void setHeadWord(Word word)
          Sets the head word of this event, or does nothing if this TrainerEvent has no such object.
 TrainerEvent shallowCopy()
          Returns a shallow copy of this event of the same run-time type.
 boolean side()
          Throws an UnsupportedOperationException, as this is not a modifier event.
 String toString()
          Returns an S-expression of the form accepted by GapEvent(Sexp).
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

toHead

public static final Symbol toHead
The symbol representing a gap passed from a parent to its head.


toLeft

public static final Symbol toLeft
The symbol representing a gap passed from a parent to one of the premodifiers of its head child.


toRight

public static final Symbol toRight
The symbol representing a gap passed from a parent to one of the postmodifiers of its head child.

Constructor Detail

GapEvent

public GapEvent(Sexp sexp)
Contructs a new object from the specified S-expression. The Sexp must be an instance of a list with the following format:
 (direction headWord parent head) 
where

GapEvent

public GapEvent(Symbol direction,
                Word headWord,
                Symbol parent,
                Symbol head)
Constructs a new GapEvent object, setting all its data members to the specified values.

Parameters:
direction - a symbol specifying the direction of the gap (trace) relative to the head child; this symbol must be one of {toHead, toLeft, toRight}
headWord - the head word
parent - the parent nonterminal label
head - the head nonterminal label
Method Detail

direction

public Symbol direction()
Returns the direction of this gap event: one of {toHead, toLeft, toRight}.


head

public Symbol head()
Returns the head nonterminal label.


headWord

public Word headWord()
Returns the head word.

Specified by:
headWord in interface TrainerEvent

parent

public Symbol parent()
Returns the parent nonterminal label.

Specified by:
parent in interface TrainerEvent

modHeadWord

public Word modHeadWord()
Returns null, as gap events do not deal with modifier words.

Specified by:
modHeadWord in interface TrainerEvent

side

public boolean side()
Throws an UnsupportedOperationException, as this is not a modifier event.

Specified by:
side in interface TrainerEvent
Throws:
UnsupportedOperationException - because this is not a modifier event

setHeadWord

public void setHeadWord(Word word)
Description copied from interface: TrainerEvent
Sets the head word of this event, or does nothing if this TrainerEvent has no such object.

Specified by:
setHeadWord in interface TrainerEvent
Parameters:
word - the word to set as the head word of this event

equals

public boolean equals(Object o)
Returns true if the specified object is an instance of a GapEvent object containing data members which are all pairwise-equal with the data members of this GapEvent object, according to each data member's equals(Object) method.

Overrides:
equals in class Object

toString

public String toString()
Returns an S-expression of the form accepted by GapEvent(Sexp).

Overrides:
toString in class Object

hashCode

public int hashCode()
Returns the hash code of this object, calculated from the hash codes of all its data members.

Overrides:
hashCode in class Object

clone

public Object clone()
Returns a deep copy of this object.

Overrides:
clone in class Object

copy

public TrainerEvent copy()
Returns a deep copy of this object.

Specified by:
copy in interface TrainerEvent

shallowCopy

public TrainerEvent shallowCopy()
Description copied from interface: TrainerEvent
Returns a shallow copy of this event of the same run-time type.

Specified by:
shallowCopy in interface TrainerEvent

Parsing Engine

Author: Dan Bikel.