de.saar.chorus.domgraph.chart
Class SolvedFormIterator

Object
  extended by SolvedFormIterator
All Implemented Interfaces:
Iterator<List<DomEdge>>

public class SolvedFormIterator
extends Object
implements Iterator<List<DomEdge>>

An iterator over the different solved forms represented by a Chart. The chart is passed to the constructor of an object of this class. Then you can iterate over the solved forms of this chart using hasNext() and next() as usual.

Each successful call to next() will return an object of class List<DomEdge>, i.e. a list of dominance edge representations. This list can e.g. be passed to the encode method of OutputCodec or one of its subclasses.

This class implements a transition system for states consisting of an agenda of subgraphs that must currently be resolved, and a stack of splits that still need to be processed. This algorithm is dramatically faster than a naive algorithm which simply computes the sets of solved forms of a graph by computing the Cartesian product of the sets of solved forms of its subgraphs, but quite a bit more complicated.

Author:
Alexander Koller, Michaela Regneri

Constructor Summary
SolvedFormIterator(Chart ch, DomGraph graph)
           
 
Method Summary
 Chart getChart()
           
 List<DomEdge> getSolvedForm(int sf)
          This returns a solved form represented by a List of DomEdge objects.
 boolean hasNext()
          convenience methods for implementing Iterator
 List<DomEdge> next()
           
 void remove()
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolvedFormIterator

public SolvedFormIterator(Chart ch,
                          DomGraph graph)
Method Detail

hasNext

public boolean hasNext()
convenience methods for implementing Iterator

Specified by:
hasNext in interface Iterator<List<DomEdge>>

next

public List<DomEdge> next()
Specified by:
next in interface Iterator<List<DomEdge>>

getSolvedForm

public List<DomEdge> getSolvedForm(int sf)
This returns a solved form represented by a List of DomEdge objects. The form is accessed via its index. Forms with indices exceeding the range of int have to be extracted manually by calling next() as often as necessary.

Parameters:
sf - index of the solved form to extract
Returns:
the solved form

remove

public void remove()
Specified by:
remove in interface Iterator<List<DomEdge>>

getChart

public Chart getChart()