|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The ContextFreeSet
interface is an optimized version
of the ContextFreeGrammar
object used by
DPA
construction algorithms. The absolute number of
each type of element is available via the named method like
'terminals()
'. The start Production
is
available via the method of the same name. Although the name
'ContextFreeSet
' is not a term that is used often (or
at all, for that matter) in theoretical books about these kinds of
things, it makes a nice parallel to RegularSet
, which
is a relatively common term.
Method Summary | |
ContextFreeGrammar |
getContextFreeGrammar()
Returns the parent ContextFreeGrammar . |
GrammarSymbol |
getGrammarSymbol(int id)
Returns the GrammarSymbol with the given id. |
Item |
getItem(int id)
Returns the Item with the given id. |
NonTerminal |
getNonTerminal(int id)
Returns the NonTerminal with the given id. |
Production |
getProduction(int id)
Returns the Production with the given id. |
Production |
getStart()
Returns the Production designated as the start. |
Terminal |
getTerminal(int id)
Returns the Terminal with the given id. |
int |
items()
Returns the number of Item s in the grammar. |
int |
nonTerminals()
Returns the number of NonTerminal s in the grammar. |
int |
productions()
Returns the number of Production s in the grammar. |
int |
terminals()
Returns the number of Terminal s in the grammar. |
Method Detail |
public ContextFreeGrammar getContextFreeGrammar()
ContextFreeGrammar
.public int terminals()
Terminal
s in the grammar.public int nonTerminals()
NonTerminal
s in the grammar.public int productions()
Production
s in the grammar.public int items()
Item
s in the grammar.public Terminal getTerminal(int id)
Terminal
with the given id. If the id
is not known, implementations may either return
null
or throw a RuntimeException
.public NonTerminal getNonTerminal(int id)
NonTerminal
with the given id. If the
id is not known, implementations may either return
null
or throw a RuntimeException
.public Production getProduction(int id)
Production
with the given id. If the
id is not known, implementations may either return
null
or throw a RuntimeException
.public GrammarSymbol getGrammarSymbol(int id)
GrammarSymbol
with the given id. If
the id is not known, implementations may either return
null
or throw a RuntimeException
.public Item getItem(int id)
Item
with the given id. If the id is
not known, implementations may either return null
or throw a RuntimeException
.public Production getStart()
Production
designated as the start.
Note that this production is generally not the same as the one
given in
ContextFreeLanguage.toGrammar(Production)
, as the
start Production
is typically 'augmented'.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |