|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
Grammar
A grammar is a set of GrammarRules.
Implementation note: Since the main use of a Grammar is looking up rules whose first constituent matches a newly-added entry, we maintain the grammar rules indexed by category of their first first rhs constituent.
Nested Class Summary |
Nested classes inherited from class java.util.HashMap |
|
Nested classes inherited from class java.util.AbstractMap |
|
Field Summary | |
(package private) java.lang.String |
description
The text description of this Grammar. |
Fields inherited from class java.util.HashMap |
|
Fields inherited from class java.util.AbstractMap |
|
Constructor Summary | |
Grammar()
Returns a new (empty) Grammar. |
Method Summary | |
void |
add(GrammarRule rule)
Adds the given GrammarRule to this Grammar. |
void |
dump()
Dump the contents of this Grammar to System.out. |
void |
dump(java.io.PrintStream stream)
Dump the contents of this Grammar to the given PrintStream. |
java.lang.String |
getDescription()
Returns the text description of this Grammar. |
java.util.List |
getRulesForConstituent(Constituent constit)
Retrieve the List of GrammarRules whose first rhs constituent matches the given Constituent. |
void |
readFile(java.lang.String filename)
Read the given filename and augment this Grammar. |
void |
setDescription(java.lang.String description)
Sets the text description of this Grammar. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode |
Field Detail |
java.lang.String description
Constructor Detail |
public Grammar()
Method Detail |
public void add(GrammarRule rule)
public java.util.List getRulesForConstituent(Constituent constit)
public void dump()
public void dump(java.io.PrintStream stream)
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
public void readFile(java.lang.String filename) throws java.io.IOException
java.io.IOException
GrammarFileHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |