|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Subcat
Specification for a collection of required arguments to be generated by a parser, also known as a subcategorization frame. In the parsing models supported by this package, a subcategorization frame, or simply subcat, has a slightly modified semantics, more general in one sense, more specific in another: it is the collection of requirements on a particular side of a head child of some parent nonterminal that have yet to be met, where a requirement is typically an argument nonterminal to be generated, but may also include other elements generated by the parser, such as traces (gaps). Thus, the subcats specified by this interface are dynamic, in that they start off with a full set of requirements that gets diminished as parsing proceeds.
Implementations of this interface may choose the manner in which
these requirements are met via their implementations of the
add
and remove
methods. For example, a
very simple implementation might simply increment an internal
counter for every call to add
, decrementing this
counter for every call to remove
, causing the
semantics for subcat frames to be simply a requirement on the
number of modifying nonterminals generated, regardless of
their labels. A more sophisticated implementation might insist on
generating all arguments in the order in which they were added to
this subcat frame. In general, no implementation should require more
calls to remove
than the number of requirements added
via invocations of add
and addAll
.
At minimum, all implementing classes should have a no-argument
default constructor and a one-argument constructor that accepts a
SexpList
containing only Symbol
objects,
to be passed to the addAll(SexpList)
method.
Subcats
Method Summary | |
---|---|
Subcat |
add(Symbol requirement)
Adds the specified nonterminal to the required arguments of this subcat frame. |
boolean |
addAll(SexpList list)
Adds the specified list of nonterminals (symbols) to the required arguments of this subcat frame. |
void |
become(Subcat other)
Causes this subcat to be equal to the specified subcat by copying the specified subcat's data to this subcat. |
boolean |
contains(Symbol requirement)
Returns true if this subcat frame contains the
specified requirement. |
boolean |
empty()
Returns true if all requirements of this subcat frame have
been met. |
boolean |
equals(Object obj)
Compares the specified object with this subcat frame for equality. |
Subcat |
getCanonical(boolean copyInto,
Map<Subcat,Subcat> map)
Returns a canonical instance of this object using the specified map (optional operation). |
int |
hashCode()
Returns a hash code of this object. |
Iterator |
iterator()
Returns an iterator over the requirements contained in this subcat frame. |
boolean |
remove(Symbol requirement)
Attempt to remove the specified symbol from the set of requirements in this subcat frame. |
int |
size()
Returns the number of required arguments contained in this subcat frame. |
Sexp |
toSexp()
Returns a list view of the information contained in this subcat, such that an equivalent subcat would result if a new Subcat object of this run-time type were constructed
and its addAll(SexpList) method were invoked with the
list returned by this method. |
Methods inherited from interface danbikel.parser.MutableEvent |
---|
add, add, clear, ensureCapacity, ensureCapacity |
Methods inherited from interface danbikel.parser.Event |
---|
canonicalize, copy, get, getClass, numComponents, numComponents, numTypes, typeIndex |
Method Detail |
---|
Subcat add(Symbol requirement)
Training.isArgumentFast(Symbol)
) or be
the gap augmentation symbol.
requirement
- the requirement to add to this subcat frame (typically
an argument nonterminal)
Subcat
objectTraining.defaultArgAugmentation()
,
Training.gapAugmentation()
,
Training.isArgumentFast(Symbol)
boolean addAll(SexpList list)
list
- the list of requirements to be added to this subcat frame
boolean remove(Symbol requirement)
empty()
returns true
.
requirement
- the element that has been generated by the parser
and is thus a candidate for removal from this subcat
true
if the specified requirement can be removed
from this subcatcontains(Symbol)
int size()
boolean empty()
true
if all requirements of this subcat frame have
been met. This method should return true
if and only if
size() == 0
.
boolean contains(Symbol requirement)
true
if this subcat frame contains the
specified requirement.
requirement
- the requirement for which membership in this
subcat is to be checked
true
if this subcat contains requirement
,
that is, returns true
if and only if remove(Symbol)
would remove the specified symbol from this subcatIterator iterator()
int hashCode()
hashCode
in interface Event
hashCode
in class Object
boolean equals(Object obj)
true
if and
only if the specified object is the same run-time type as this
object and contains identical requirements in an identical order,
if order is relevant to the implementation of this interface.
equals
in interface Event
equals
in class Object
Subcat getCanonical(boolean copyInto, Map<Subcat,Subcat> map)
map
- the reflexive map to use for canonicalization: the key-value
pair of (this, this
) should be added to map
if this object is not already a key in map
copyInto
- specifies whether to copy this subcat before inserting
into the canonical map
Sexp toSexp()
Subcat
object of this run-time type were constructed
and its addAll(SexpList)
method were invoked with the
list returned by this method.
toSexp
in interface SexpConvertible
void become(Subcat other)
other
- the subcat that this subcat is to become
ClassCastException
- if the specified subcat is not of the same
run-time type as this subcat
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |