|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectChart
public class Chart
A chart for storing intermediate results of the graph-chart solver. This data structure assigns to a weakly connected subgraph G of the original dominance graph a list of splits for G. A split records the choice of a fragment F of G as the root fragment of a solved form of G, and how the other fragments of G must be distributed over the holes of F. That is, it splits G into a root fragment F and the weakly connected components that remain after F is removed.
This class supports the dynamic addition and removal of splits and subgraphs, and maintains the invariant that all subgraphs and splits in the chart can be used in some solved form -- if they can't, they are removed from the chart. It uses reference counters to keep track of this; to initialise them, the user must specify one or more subgraphs as "top-level" subgraphs, which receive a reference count of 1. One important limitation is that it is not allowed to delete a subgraph (or the last split in the subgraph) if this subgraph is still referenced from elsewhere. The relevant methods throw an UnsupportedOperationException if you attempt this.
Constructor Summary | |
---|---|
Chart()
The constructor. |
Method Summary | |
---|---|
void |
addSplit(Set<String> subgraph,
Split split)
Adds a split for the given subgraph. |
void |
addToplevelSubgraph(Set<String> subgraph)
Adds a top-level subgraph. |
Object |
clone()
Computes a clone of the chart. |
boolean |
containsSplitFor(Set<String> subgraph)
Checks whether the chart contains a split for the given subgraph. |
BigInteger |
countSolvedForms()
Returns the number of solved forms represented by this chart. |
BigInteger |
countSolvedFormsFor(Set<String> subgraph)
|
int |
countSubgraphs()
|
void |
deleteSubgraph(Set<String> subgraph)
Deletes a subgraph and all of its splits from the chart. |
List<Split> |
getSplitsFor(Set<String> subgraph)
Returns the list of all splits for the given subgraph. |
List<Set<String>> |
getToplevelSubgraphs()
Returns the list of all top-level subgraphs. |
void |
setSplitsForSubgraph(Set<String> subgraph,
List<Split> splits)
Sets the splits for a given subgraph. |
int |
size()
Returns the number of splits in the entire chart. |
String |
toString()
Returns a string representation of the chart. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Chart()
Method Detail |
---|
public void addSplit(Set<String> subgraph, Split split)
subgraph
- a subgraph of some dominance graphsplit
- a split of this subgraphpublic int countSubgraphs()
public void setSplitsForSubgraph(Set<String> subgraph, List<Split> splits)
subgraph
- a subgraphsplits
- the new splits for this subgraph
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.public void deleteSubgraph(Set<String> subgraph)
subgraph
- a subgraph
UnsupportedOperationException
- - if you try to delete a subgraph
that is still referenced from some split. If this happens, the chart
remains unchanged.public List<Split> getSplitsFor(Set<String> subgraph)
subgraph
- a subgraph
public boolean containsSplitFor(Set<String> subgraph)
subgraph
- a subgraph
public int size()
public String toString()
toString
in class Object
public List<Set<String>> getToplevelSubgraphs()
public void addToplevelSubgraph(Set<String> subgraph)
subgraph
- a weakly connected subgraph.public BigInteger countSolvedForms()
The method assumes that the chart belongs to a solvable dominance
graph, i.e. that it represents any solved forms in the first place.
You can assume this for all charts that were generated by
ChartSolver#solve with a return value of true
.
public BigInteger countSolvedFormsFor(Set<String> subgraph)
public Object clone()
clone
in class Object
Chart
object which is a clone of the current
chart
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |