|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectagg.parser.AbstractParser
public abstract class AbstractParser
This parser eats graphs which are created by AGG. A parser needs a host graph and a stop graph. The graph grammar for parsing must contain reducing rules. This abstract parser provides some convenient methods for parsing.
Field Summary | |
---|---|
protected int |
delay
|
protected GraGra |
grammar
The grammar which can recognize a graph |
protected Graph |
graph
The Graph which will be parsed |
protected java.util.Vector<ParserEventListener> |
listener
All listerner which want to receive events |
protected PairContainer |
pairContainer
The set of critical pairs |
protected Graph |
stopGraph
The graph which stops the algorithm |
Constructor Summary | |
---|---|
AbstractParser(GraGra grammar,
Graph hostGraph,
Graph stopGraph,
PairContainer pairContainer)
Creates a new abstract parser. |
Method Summary | |
---|---|
void |
addParserEventListener(ParserEventListener l)
Adds a ParserEventListener. |
protected boolean |
applyRule(Match m)
Applys a rule on a host graph. |
protected void |
finalize()
Clears some internal stuff. |
protected Match |
findMatch(Graph g,
java.util.Enumeration<?> rules,
RuleInstances eri)
Finds a valid match for a set of rules. |
protected Match |
findMatch(Graph g,
java.util.Enumeration<Rule> rules)
Finds a valid match for a set of rules. |
protected void |
fireParserEvent(ParserEvent event)
Sends a event to all its listeners. |
Graph |
getGraph()
Returns the host graph from the parser. |
Graph |
getHostGraph()
Returns the host graph from the parser. |
Graph |
getStopGraph()
Returns the current stop graph of the parser. |
abstract boolean |
parse()
Starts the parser. |
void |
parseString()
Parse the methods and attributes of an UML-Diagram. |
protected void |
printGraph(Graph g)
|
protected void |
printImageGraph(Morphism m)
|
void |
removeParserEventListener(ParserEventListener l)
Removes a ParserEventListener |
void |
setCriticalPairs(PairContainer pairs)
Sets the critical pairs for the parser. |
void |
setDelayAfterApplyRule(int miliseconds)
|
void |
setGrammar(GraGra grammar)
Sets the grammar for the parser. |
void |
setHostGraph(Graph hostGraph)
Sets the host graph for the parser. |
void |
setStopGraph(Graph stopGraph)
Sets the stop graph for the parser. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected GraGra grammar
protected Graph graph
protected Graph stopGraph
protected PairContainer pairContainer
protected java.util.Vector<ParserEventListener> listener
protected int delay
Constructor Detail |
---|
public AbstractParser(GraGra grammar, Graph hostGraph, Graph stopGraph, PairContainer pairContainer)
grammar
- The graph grammar.hostGraph
- The host graph.stopGraph
- The stop graph.pairContainer
- The container of the critical pairs.Method Detail |
---|
public void setHostGraph(Graph hostGraph)
setHostGraph
in interface Parser
hostGraph
- The host graph.public void setStopGraph(Graph stopGraph)
setStopGraph
in interface Parser
stopGraph
- The stop graph.public void setCriticalPairs(PairContainer pairs)
setCriticalPairs
in interface Parser
pairs
- The critical pairs are holded in a container.public void setGrammar(GraGra grammar)
setGrammar
in interface Parser
grammar
- The grammar for the parser.public Graph getHostGraph()
getHostGraph
in interface Parser
public Graph getGraph()
getGraph
in interface Parser
public Graph getStopGraph()
getStopGraph
in interface Parser
public abstract boolean parse()
parse
in interface Parser
protected boolean applyRule(Match m)
m
- The match.protected Match findMatch(Graph g, java.util.Enumeration<?> rules, RuleInstances eri)
RuleInstances
.
g
- The graph to match into. Usually the host graph.rules
- This enumeration must contain rule objects.eri
- The rule instances.
protected Match findMatch(Graph g, java.util.Enumeration<Rule> rules)
g
- The graph to match into. Usually the host graph.rules
- This enumeration must contain rule objects.
findMatch(Graph g, Enumeration rules, RuleInstances eri)
protected void finalize()
finalize
in class java.lang.Object
public void parseString()
public void addParserEventListener(ParserEventListener l)
addParserEventListener
in interface Parser
l
- The listener.public void removeParserEventListener(ParserEventListener l)
removeParserEventListener
in interface Parser
l
- The listener.protected void fireParserEvent(ParserEvent event)
event
- The event which will be sentprotected void printImageGraph(Morphism m)
protected void printGraph(Graph g)
public void setDelayAfterApplyRule(int miliseconds)
setDelayAfterApplyRule
in interface Parser
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |