se.chalmers.cs.gf.parse.chart
Class NonTerminalRule

java.lang.Object
  extended by se.chalmers.cs.gf.parse.chart.Rule
      extended by se.chalmers.cs.gf.parse.chart.NonTerminalRule

public class NonTerminalRule
extends Rule

A CF grammar prodcution whose right hand side is a list of non-terminals.


Constructor Summary
NonTerminalRule(Category cat, java.util.List<Category> rhs, java.lang.String fun, java.util.List<Profile> profile)
           
 
Method Summary
 boolean equals(NonTerminalRule r)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getFun()
          Get the function name use to construct an abstract syntax tree from this rule.
 java.util.List<Profile> getProfile()
           
 java.util.List<Category> getRhs()
          Get the right hand side of the rule.
 int getSize()
          Get the number of terminals or non-terminal on the RHS.
 int hashCode()
           
 boolean isTerminal()
          Checks if the right hand side of this rule consists of a single terminal.
 Tree makeTree(Tree[] children, int startIndex, int endIndex)
           
 boolean startsWith(Category c)
          Checks if the right hand side of rule starts with the given non-terminal.
 java.lang.String toString()
           
 
Methods inherited from class se.chalmers.cs.gf.parse.chart.Rule
getCategory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonTerminalRule

public NonTerminalRule(Category cat,
                       java.util.List<Category> rhs,
                       java.lang.String fun,
                       java.util.List<Profile> profile)
Method Detail

getRhs

public java.util.List<Category> getRhs()
Get the right hand side of the rule. Do not modify the returned list.


getFun

public java.lang.String getFun()
Description copied from class: Rule
Get the function name use to construct an abstract syntax tree from this rule.

Specified by:
getFun in class Rule

getProfile

public java.util.List<Profile> getProfile()

startsWith

public boolean startsWith(Category c)
Checks if the right hand side of rule starts with the given non-terminal.


getSize

public int getSize()
Description copied from class: Rule
Get the number of terminals or non-terminal on the RHS.

Specified by:
getSize in class Rule

isTerminal

public boolean isTerminal()
Checks if the right hand side of this rule consists of a single terminal.


makeTree

public Tree makeTree(Tree[] children,
                     int startIndex,
                     int endIndex)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(NonTerminalRule r)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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