Package de.saar.chorus.domgraph.chart
Class ConcreteRegularTreeGrammar<E>
java.lang.Object
de.saar.chorus.domgraph.chart.RegularTreeGrammar<E>
de.saar.chorus.domgraph.chart.ConcreteRegularTreeGrammar<E>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Chart,WeightedRegularTreeGrammar
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intFields inherited from class de.saar.chorus.domgraph.chart.RegularTreeGrammar
numSolvedForms -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a split for the given subgraph.voidaddToplevelSubgraph(E subgraph) Adds a top-level subgraph.voidcleanup()voidclear()clone()booleancontainsSplitFor(E subgraph) Checks whether the chart contains a split for the given subgraph.intvoiddeleteSubgraph(E subgraph) Deletes a subgraph and all of its splits from the chart.getLabelForSplit(Split<E> split) getRootForSingleton(E nt) getSplitsFor(E subgraph) Returns the list of all splits for the given subgraph.voidReturns the list of all top-level subgraphs.booleanbooleanisSingleton(E nt) static <E> ConcreteRegularTreeGrammar<E>makeExplicit(RegularTreeGrammar<E> rtg) voidRecomputes the singleton subgraphs (in RTG language: the preterminal nonterminals) for the RTG.voidreduce()Removes all unproductive nonterminals and splits from this chart.voidvoidsetSplitsForSubgraph(E subgraph, List<Split<E>> splits) Sets the splits for a given subgraph.intsize()Returns the number of splits in the entire chart.Methods inherited from class de.saar.chorus.domgraph.chart.RegularTreeGrammar
countSolvedForms, countSolvedFormsFor, intersect, toString
-
Field Details
-
chart
-
refcount
-
size
protected int size -
toplevelSubgraphs
-
finalStates
-
singletons
-
-
Constructor Details
-
ConcreteRegularTreeGrammar
public ConcreteRegularTreeGrammar()The constructor.
-
-
Method Details
-
addSplit
Adds a split for the given subgraph.- Parameters:
subgraph- a subgraph of some dominance graphsplit- a split of this subgraph
-
clone
-
makeExplicit
-
getLabelForSplit
-
countSubgraphs
public int countSubgraphs() -
getAllNonterminals
- Specified by:
getAllNonterminalsin classRegularTreeGrammar<E>
-
recomputeSingletons
public void recomputeSingletons()Recomputes the singleton subgraphs (in RTG language: the preterminal nonterminals) for the RTG. It is expected that this method is called whenever the RTG changes. -
isSingleton
- Specified by:
isSingletonin classRegularTreeGrammar<E>
-
getRootForSingleton
- Specified by:
getRootForSingletonin classRegularTreeGrammar<E>
-
cleanup
public void cleanup() -
reduce
public void reduce()Removes all unproductive nonterminals and splits from this chart. A nonterminal is called unproductive if it isn't possible to derive a solved form from it (but it may still be inaccessible from the top-level subgraphs).This method accesses the precomputed preterminals of this RTG, and therefore assumes that recomputeSingletons() has been called since the latest change to the RTG.
- Parameters:
roots- the roots of the dominance graph on which this chart is based
-
setSplitsForSubgraph
Sets the splits for a given subgraph. If the subgraph already had splits, these are deleted first.- Parameters:
subgraph- a subgraphsplits- the new splits for this subgraph- Throws:
UnsupportedOperationException- - if you try to delete all splits of a subgraph that is still referenced from some other split. If this happens, the chart remains unchanged.
-
deleteSubgraph
Deletes a subgraph and all of its splits from the chart. This method updates the reference counts, and recursively deletes all other subgraphs that become unreachable.- Parameters:
subgraph- a subgraph- Throws:
UnsupportedOperationException- - if you try to delete a subgraph that is still referenced from some split. If this happens, the chart remains unchanged.
-
getSplitsFor
Returns the list of all splits for the given subgraph.- Specified by:
getSplitsForin classRegularTreeGrammar<E>- Parameters:
subgraph- a subgraph- Returns:
- the list of splits for this subgraph.
-
getSplitsFor
- Specified by:
getSplitsForin classRegularTreeGrammar<E>
-
containsSplitFor
Checks whether the chart contains a split for the given subgraph.- Specified by:
containsSplitForin classRegularTreeGrammar<E>- Parameters:
subgraph- a subgraph- Returns:
- true iff the chart contains any splits for this subgraph.
-
size
public int size()Returns the number of splits in the entire chart.- Specified by:
sizein classRegularTreeGrammar<E>- Returns:
- the number of splits
-
getToplevelSubgraphs
Returns the list of all top-level subgraphs.- Specified by:
getToplevelSubgraphsin classRegularTreeGrammar<E>- Returns:
- the top-level subgraphs.
-
addToplevelSubgraph
Adds a top-level subgraph. This should be one of the maximal weakly connected subgraphs of the dominance graph; if the entire graph is connected, then this should be the set of all nodes of the dominance graph.- Parameters:
subgraph- a weakly connected subgraph.
-
clear
public void clear() -
isFinal
-
setFinal
-