org.ourgrid.common.spec.grammar
Class Rule

java.lang.Object
  extended by org.ourgrid.common.spec.grammar.Rule
All Implemented Interfaces:
java.io.Serializable

public class Rule
extends java.lang.Object
implements java.io.Serializable

Project: Caymman(DSC/UFCG) Description: This class represents a rule of a grammar.

Version:
1.0 Created on Sep 25, 2003 Last update: Sep 25, 2003
See Also:
Serialized Form

Constructor Summary
Rule(int id, Symbol head, Symbol[] body)
          Constructor
 
Method Summary
 Symbol[] getBody()
          Gets the body of the rule.
 Symbol getHead()
          Gets the head of the rule.
 int getID()
          Gets the identification of the rule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rule

public Rule(int id,
            Symbol head,
            Symbol[] body)
     throws InvalidRuleException
Constructor

Parameters:
id - The identification of the rule.
head - The head of the rule. A head is the leftmost side of a rule in a grammar.
body - The body of the rule. A body is the leftmost side of a rule in a grammar.
Throws:
InvalidRuleException
Method Detail

getBody

public Symbol[] getBody()
Gets the body of the rule. For example, in the rule ::=read, the body is read.

Returns:
The body of the rule.

getHead

public Symbol getHead()
Gets the head of the rule. For example, in the rule ::=read, the head is .

Returns:
The head of the rule.

getID

public int getID()
Gets the identification of the rule. A identification is just a number.

Returns:
The identification of the rule.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object