dk.brics.grammar.ambiguity
Class RegularApproximation

java.lang.Object
  extended by dk.brics.grammar.ambiguity.ApproximationStrategy
      extended by dk.brics.grammar.ambiguity.RegularApproximation
Direct Known Subclasses:
RegularApproximation2

public class RegularApproximation
extends ApproximationStrategy

Regular approximation based on Mohri & Nederhof's technique.


Field Summary
 
Fields inherited from class dk.brics.grammar.ambiguity.ApproximationStrategy
debug, g, HORIZONTAL_NOT_APPLICABLE, out, VERTICAL_NOT_APPLICABLE
 
Constructor Summary
RegularApproximation()
          Constructs a new approximator.
 
Method Summary
 HorizontalOverlapString checkHorizontalOverlap(Production p, int index)
          Conservatively checks horizontal overlap in a production.
 VerticalOverlapString checkVerticalOverlap(Production p1, Production p2)
          Conservatively checks vertical overlap of two productions of the same nonterminal.
 String getName()
          Returns the name "regular".
 void init()
          Initializes for the current grammar.
 void verticalDone()
          Invoked once per nonterminal when all its vertical checks are done (in the outer loop).
 
Methods inherited from class dk.brics.grammar.ambiguity.ApproximationStrategy
horizontalCheck, horizontalDone, init, printStatistics, verticalCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegularApproximation

public RegularApproximation()
Constructs a new approximator.

Method Detail

checkHorizontalOverlap

public HorizontalOverlapString checkHorizontalOverlap(Production p,
                                                      int index)
Description copied from class: ApproximationStrategy
Conservatively checks horizontal overlap in a production. This method is typically implemented in a subclass. The default implementation returns ApproximationStrategy.HORIZONTAL_NOT_APPLICABLE.

Overrides:
checkHorizontalOverlap in class ApproximationStrategy
Parameters:
p - a production
index - division point
Returns:
potential example string in overlap, null if definitely no overlap, ApproximationStrategy.HORIZONTAL_NOT_APPLICABLE can be used as a "don't know" value

checkVerticalOverlap

public VerticalOverlapString checkVerticalOverlap(Production p1,
                                                  Production p2)
Description copied from class: ApproximationStrategy
Conservatively checks vertical overlap of two productions of the same nonterminal. This method is typically implemented in a subclass. The default implementation returns ApproximationStrategy.VERTICAL_NOT_APPLICABLE.

Overrides:
checkVerticalOverlap in class ApproximationStrategy
Parameters:
p1 - one production
p2 - another production
Returns:
potential example string in overlap, null if definitely no overlap, ApproximationStrategy.VERTICAL_NOT_APPLICABLE can be used as a "don't know" value

getName

public String getName()
Returns the name "regular".

Returns:
approximation strategy name

init

public void init()
Description copied from class: ApproximationStrategy
Initializes for the current grammar. This method is typically implemented in a subclass. The default implementation does nothing. The grammar is available as ApproximationStrategy.g.

Overrides:
init in class ApproximationStrategy

verticalDone

public void verticalDone()
Description copied from class: ApproximationStrategy
Invoked once per nonterminal when all its vertical checks are done (in the outer loop). Default implementation does nothing.

Overrides:
verticalDone in class ApproximationStrategy


Copyright © 2005-2008 Anders Møller.