agg.parser
Class ExcludeParser

java.lang.Object
  extended by agg.parser.AbstractParser
      extended by agg.parser.ExcludeParser
All Implemented Interfaces:
Parser, java.lang.Runnable
Direct Known Subclasses:
LayeredExcludeParser, SimpleExcludeParser

public class ExcludeParser
extends AbstractParser
implements java.lang.Runnable

This class provides a parser which needs critical pairs. The criticl pair must be ExcludePair. So objects has to be instaciated with ExcludePairContainer. To be independent of a grammar it is necessary to instanciate a object with a host graph and stop graph seperately.


Field Summary
protected  boolean correct
           
protected  com.objectspace.jgl.Stack stack
          Main part of a backtracking algorithm
protected  boolean stop
           
 
Fields inherited from class agg.parser.AbstractParser
delay, grammar, graph, listener, pairContainer, stopGraph
 
Constructor Summary
ExcludeParser(GraGra grammar, Graph hostGraph, Graph stopGraph, ExcludePairContainer excludeContainer)
          Creates a new parser.
 
Method Summary
protected  void finalize()
          Clears some internal stuff.
protected  java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> findInclusions(Rule r1, int kind)
          Returns all inclusion of the overlapping of a given rule into the host graph.
protected  boolean isMatchCritic(Match m, java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> inclusions)
          Checks if a current match is critic.
protected  void makeLightContainer(java.util.Hashtable<Rule,java.util.Hashtable<Rule,Pair<java.lang.Boolean,java.util.Vector<Pair<Pair<OrdinaryMorphism,OrdinaryMorphism>,Pair<OrdinaryMorphism,OrdinaryMorphism>>>>>> in, java.util.Hashtable<Rule,java.util.Hashtable<Rule,Pair<java.lang.Boolean,java.util.Vector<Pair<Pair<OrdinaryMorphism,OrdinaryMorphism>,Pair<OrdinaryMorphism,OrdinaryMorphism>>>>>> out)
          A container stores all pairs with the information if two rules critic or not.
 boolean parse()
          Starts the parser.
 void run()
          Usually this method is invoked by the start method from the class Thread.
 void stop()
          Stops the running.
 boolean wasStopped()
           
 
Methods inherited from class agg.parser.AbstractParser
addParserEventListener, applyRule, findMatch, findMatch, fireParserEvent, getGraph, getHostGraph, getStopGraph, parseString, printGraph, printImageGraph, removeParserEventListener, setCriticalPairs, setDelayAfterApplyRule, setGrammar, setHostGraph, setStopGraph
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stack

protected com.objectspace.jgl.Stack stack
Main part of a backtracking algorithm


stop

protected boolean stop

correct

protected boolean correct
Constructor Detail

ExcludeParser

public ExcludeParser(GraGra grammar,
                     Graph hostGraph,
                     Graph stopGraph,
                     ExcludePairContainer excludeContainer)
Creates a new parser. This parser uses critical pair analysis for optimized parsing.

Parameters:
grammar - The graph grammar.
hostGraph - The host graph.
stopGraph - The stop graph.
excludeContainer - The critical pairs.
Method Detail

parse

public boolean parse()
Starts the parser. The result is true if the parser can parse the graph

Specified by:
parse in interface Parser
Specified by:
parse in class AbstractParser
Returns:
true if the graph can be parsed.

finalize

protected void finalize()
Clears some internal stuff.

Overrides:
finalize in class AbstractParser

makeLightContainer

protected void makeLightContainer(java.util.Hashtable<Rule,java.util.Hashtable<Rule,Pair<java.lang.Boolean,java.util.Vector<Pair<Pair<OrdinaryMorphism,OrdinaryMorphism>,Pair<OrdinaryMorphism,OrdinaryMorphism>>>>>> in,
                                  java.util.Hashtable<Rule,java.util.Hashtable<Rule,Pair<java.lang.Boolean,java.util.Vector<Pair<Pair<OrdinaryMorphism,OrdinaryMorphism>,Pair<OrdinaryMorphism,OrdinaryMorphism>>>>>> out)
A container stores all pairs with the information if two rules critic or not. This method filters all pairs that are not critic.

Parameters:
in - The complete container.
out - The new filtered container.

findInclusions

protected java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> findInclusions(Rule r1,
                                                                                   int kind)
Returns all inclusion of the overlapping of a given rule into the host graph.

Parameters:
r1 - The rule
kind - The critical pair algorithm.
Returns:
A set of morphisms from the overlapping graph into the host graph.

isMatchCritic

protected boolean isMatchCritic(Match m,
                                java.util.Vector<Pair<OrdinaryMorphism,OrdinaryMorphism>> inclusions)
Checks if a current match is critic.

Parameters:
m - The match.
inclusions - The set of inclusions from overlapping graphs into the host graph.
Returns:
true if with this one rule exclude another rule.

run

public void run()
Usually this method is invoked by the start method from the class Thread. This method starts the parse method.

Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops the running.


wasStopped

public boolean wasStopped()