net.sourceforge.chaperon.model.grammar
Class Production

java.lang.Object
  extended bynet.sourceforge.chaperon.model.grammar.Production
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Production
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class presents a production of a grammar

Version:
CVS $Id: Production.java,v 1.8 2004/01/18 01:36:29 benedikta Exp $
Author:
Stephan Michels
See Also:
Serialized Form

Constructor Summary
Production()
          Create an empty production.
Production(Nonterminal ntsymbol)
          Create a production.
Production(Nonterminal ntsymbol, SymbolList definition)
          Create a production.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
          Compares the production with another production.
 SymbolList getDefinition()
          Return the definition.
 int getLength()
          Return the the length of the Definition
 java.lang.String getLocation()
          Returns the location from the input source.
 Terminal getPrecedence()
          Return the precedence symbol.
 java.lang.String getPrecedenceAsString()
           
 Nonterminal getSymbol()
          Return the symbol from this production
 java.lang.String getSymbolName()
           
 SymbolSet getSymbols()
          Return all used symbols in this production
 boolean hasPrecedence()
          If the production contains a precedence symbol.
 void setDefinition(SymbolList definition)
          Set the definition for this production
 void setLocation(java.lang.String location)
          Set the location from the input source.
 void setPrecedence(Terminal tsymbol)
          Set the precedence for this production by a terminal symbol
 void setPrecedenceAsString(java.lang.String name)
           
 void setSymbol(Nonterminal ntsymbol)
          Set the symbol for this production
 void setSymbolName(java.lang.String name)
           
 java.lang.String toString()
          Return a string representation of the production.
 Violations validate()
          Validates the production.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Production

public Production()
Create an empty production.


Production

public Production(Nonterminal ntsymbol)
Create a production.

Parameters:
ntsymbol - The symbol of this production.

Production

public Production(Nonterminal ntsymbol,
                  SymbolList definition)
Create a production.

Parameters:
ntsymbol - The symbol of this production.
definition - Definition of the production.
Method Detail

setSymbol

public void setSymbol(Nonterminal ntsymbol)
Set the symbol for this production

Parameters:
ntsymbol - Non terminal symbol

setSymbolName

public void setSymbolName(java.lang.String name)

getSymbol

public Nonterminal getSymbol()
Return the symbol from this production

Returns:
Nonterminal symbol

getSymbolName

public java.lang.String getSymbolName()

setDefinition

public void setDefinition(SymbolList definition)
Set the definition for this production

Parameters:
definition - A list of symbols, which the definition of this production represented.

getDefinition

public SymbolList getDefinition()
Return the definition.

Returns:
A list of Symbols, which the definition of this production represented.

getLength

public int getLength()
Return the the length of the Definition

Returns:
Lengt of the Definition

setPrecedence

public void setPrecedence(Terminal tsymbol)
Set the precedence for this production by a terminal symbol

Parameters:
tsymbol - Terminal symbol

setPrecedenceAsString

public void setPrecedenceAsString(java.lang.String name)

getPrecedence

public Terminal getPrecedence()
Return the precedence symbol.

Returns:
Terminal symbol.

getPrecedenceAsString

public java.lang.String getPrecedenceAsString()

hasPrecedence

public boolean hasPrecedence()
If the production contains a precedence symbol.

Returns:
True, if a precedence symbol is defined.

getSymbols

public SymbolSet getSymbols()
Return all used symbols in this production

Returns:
Set of symbols.

setLocation

public void setLocation(java.lang.String location)
Set the location from the input source.

Parameters:
location - Location in the input source.

getLocation

public java.lang.String getLocation()
Returns the location from the input source.

Returns:
Location in the input source.

validate

public Violations validate()
Validates the production.

Returns:
Return a list of violations, if this object isn't valid.

equals

public boolean equals(java.lang.Object o)
Compares the production with another production.

Parameters:
o - Other object.
Returns:
True, if the production are equal.

toString

public java.lang.String toString()
Return a string representation of the production.

Returns:
String representation of the production.

clone

public java.lang.Object clone()
Returns:
Throws:
java.lang.CloneNotSupportedException


Copyright ? 2003 Chaperon project. All Rights Reserved.