dk.brics.servletvalidator.balancing
Class AbstractBalancingVisitor

java.lang.Object
  extended by dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
      extended by dk.brics.servletvalidator.balancing.AbstractBalancingVisitor
All Implemented Interfaces:
GrammarEntityVisitor
Direct Known Subclasses:
BalanceChecker, DecoratingBalancingVisitor

public abstract class AbstractBalancingVisitor
extends AbstractGrammarEntityVisitor

Super class for the classes that assign c and d values to grammar entities.


Field Summary
 
Fields inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
marked
 
Constructor Summary
protected AbstractBalancingVisitor(ParenthesisModel model)
           
 
Method Summary
 int c(AlphabetSymbol a)
           
protected  int c(List<? extends AlphabetSymbol> s)
          Returns the value of the c function for the string represented as parametger s.
abstract  Integer c(NonTerminal n)
          Returns the value of the c function for the nonterminal n.
 int c(Terminal t)
           
protected  Integer d(List<AlphabetSymbol> string)
          Calculates d for at string assuming that d is well defined and fixed for all non terminals in the string
 int d(List<Terminal> list)
           
abstract  Integer d(NonTerminal d)
           
 int d(Terminal t)
           
abstract  void setC(NonTerminal n, Integer c)
           
abstract  void setD(NonTerminal n, Integer d)
          Sets the d value for the non terminal n to d
 
Methods inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
apply, 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

AbstractBalancingVisitor

protected AbstractBalancingVisitor(ParenthesisModel model)
Method Detail

c

public int c(AlphabetSymbol a)

c

protected int c(List<? extends AlphabetSymbol> s)
Returns the value of the c function for the string represented as parametger s.

Parameters:
s -
Returns:

c

public abstract Integer c(NonTerminal n)
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)

Parameters:
n -
Returns:

c

public int c(Terminal t)

d

protected Integer d(List<AlphabetSymbol> string)
Calculates d for at string assuming that d is well defined and fixed for all non terminals in the string

Parameters:
string -

d

public int d(List<Terminal> list)

d

public abstract Integer d(NonTerminal d)

d

public int d(Terminal t)

setC

public abstract void setC(NonTerminal n,
                          Integer c)

setD

public abstract void setD(NonTerminal n,
                          Integer d)
Sets the d value for the non terminal n to d

Parameters:
n -
d -


Copyright © 2008 Mathias Schwarz.