dk.brics.grammar
Class Production

java.lang.Object
  extended by dk.brics.grammar.Production

public class Production
extends Object

A grammar production.


Constructor Summary
Production(String nonterminal, List<Entity> entities, boolean unordered, ProductionID id, int priority)
          Constructs a new grammar production.
 
Method Summary
 List<Entity> getEntities()
          Returns the entities.
 ProductionID getID()
          Returns the production ID.
 String getNonterminal()
          Returns the left-hand-side nonterminal.
 int getPriority()
          Returns the priority of this production.
 boolean isUnfolded()
          Checks whether this production results from grammar unfolding.
 boolean isUnordered()
          Returns true if this is a unordered production.
 String print(Collection<Entity> remaining)
          Prints this production.
 void setEntities(List<Entity> entities)
          Sets the entities.
 void setUnfolded()
          Marks this production as one that results from grammr unfolding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Production

public Production(String nonterminal,
                  List<Entity> entities,
                  boolean unordered,
                  ProductionID id,
                  int priority)
Constructs a new grammar production.

Parameters:
nonterminal - nonterminal
entities - entity list
unordered - true if 'unordered' production, false if 'ordered' production
id - production ID
priority - priority
Method Detail

getEntities

public List<Entity> getEntities()
Returns the entities.

Returns:
entities

getID

public ProductionID getID()
Returns the production ID.

Returns:
production ID

getNonterminal

public String getNonterminal()
Returns the left-hand-side nonterminal.

Returns:
nonterminal

getPriority

public int getPriority()
Returns the priority of this production.

Returns:
priority

isUnfolded

public boolean isUnfolded()
Checks whether this production results from grammar unfolding. (Such productions are not checked for ambiguity.)


isUnordered

public boolean isUnordered()
Returns true if this is a unordered production.

Returns:
true if this is a unordered production

print

public String print(Collection<Entity> remaining)
Prints this production.

Parameters:
remaining - remaining entities
Returns:
string representation

setEntities

public void setEntities(List<Entity> entities)
Sets the entities.

Parameters:
entities - new entities

setUnfolded

public void setUnfolded()
Marks this production as one that results from grammr unfolding.



Copyright © 2005-2008 Anders Møller.