dk.brics.servletvalidator.balancing
Class BalanceChecker

java.lang.Object
  extended by dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
      extended by dk.brics.servletvalidator.balancing.AbstractBalancingVisitor
          extended by dk.brics.servletvalidator.balancing.BalanceChecker
All Implemented Interfaces:
GrammarEntityVisitor

public class BalanceChecker
extends AbstractBalancingVisitor

The visitor checks that the language is balanced and assigns a value for the function c and d for each NonTerminal in the Grammar.


Field Summary
 
Fields inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
marked
 
Constructor Summary
BalanceChecker(ParenthesisModel model)
           
 
Method Summary
 void apply(Grammar g)
           
 Integer c(NonTerminal n)
          Returns the value of the c function for the nonterminal n.
 Integer d(NonTerminal d)
           
 int d0(NonTerminal n)
           
 int dSample(NonTerminal n)
           
 void setC(NonTerminal n, Integer c)
           
 void setD(NonTerminal n, Integer d)
          Sets the d value for the non terminal n to d
 
Methods inherited from class dk.brics.servletvalidator.balancing.AbstractBalancingVisitor
c, c, c, d, d, d
 
Methods inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
apply, apply, apply, getPath, in, in, in, isMarked, mark, out, out, out, print, shouldPrettyPrint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BalanceChecker

public BalanceChecker(ParenthesisModel model)
Method Detail

apply

public void apply(Grammar g)
Specified by:
apply in interface GrammarEntityVisitor
Overrides:
apply in class AbstractGrammarEntityVisitor

c

public Integer c(NonTerminal n)
Description copied from class: AbstractBalancingVisitor
Returns the value of the c function for the nonterminal n. May return null if the c value is unknown for n (I.E if the non terminal was added after the c values were calculated)

Specified by:
c in class AbstractBalancingVisitor
Returns:

d

public Integer d(NonTerminal d)
Specified by:
d in class AbstractBalancingVisitor

d0

public int d0(NonTerminal n)

dSample

public int dSample(NonTerminal n)

setC

public void setC(NonTerminal n,
                 Integer c)
Specified by:
setC in class AbstractBalancingVisitor

setD

public void setD(NonTerminal n,
                 Integer d)
Description copied from class: AbstractBalancingVisitor
Sets the d value for the non terminal n to d

Specified by:
setD in class AbstractBalancingVisitor


Copyright © 2008 Mathias Schwarz.