de.saar.chorus.domgraph.codec.domgraph
Class DomgraphUdrawOutputCodec

Object
  extended by OutputCodec
      extended by DomgraphUdrawOutputCodec

public class DomgraphUdrawOutputCodec
extends OutputCodec

An output codec that represents a dominance graph in the uDraw(Graph) format. uDraw(Graph) is a tool for displaying and editing graphs which was developed at the University of Bremen.

This codec can be run into two modes. By default, it computes an uDraw representation which is suitable for loading into uDraw(Graph) via the File/Open menu. Alternatively, you can pass the boolean option "pipe" to it. If "pipe" is set to true, the codec will compute a uDraw graph drawing command which can be fed to uDraw(Graph) via a pipe, e.g.

utool convert -O domgraph-udraw --output-codec-options pipe | uDraw -pipe

Note: This codec is not suitable for printing a list of graphs, e.g. in the context of printing the solved forms computed by the solve command.

The name of this codec is domgraph-udraw, and its associated file extension is .dg.udg.

Author:
Alexander Koller

Constructor Summary
DomgraphUdrawOutputCodec(boolean pipe)
           
 
Method Summary
 void encode(DomGraph graph, NodeLabels labels, Writer writer)
          Encodes a dominance graph into a string representation for this output codec.
 void print_footer(Writer writer)
          Prints a footer at the end of a file to which the USR is written.
 void print_header(Writer writer)
          Prints a header at the beginning of a file to which the USR is written.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomgraphUdrawOutputCodec

public DomgraphUdrawOutputCodec(boolean pipe)
Method Detail

encode

public void encode(DomGraph graph,
                   NodeLabels labels,
                   Writer writer)
            throws IOException,
                   MalformedDomgraphException
Description copied from class: OutputCodec
Encodes a dominance graph into a string representation for this output codec. The dominance graph is defined by the arguments graph and labels. The USR is written to the writer.

Specified by:
encode in class OutputCodec
Parameters:
graph - the dominance graph
labels - the node labels for this dominance graph
writer - the writer to which the encoded USR will be written
Throws:
IOException - if an I/O error occurred while writing to the writer
MalformedDomgraphException - if the graph cannot be encoded by this codec

print_header

public void print_header(Writer writer)
                  throws IOException
Description copied from class: OutputCodec
Prints a header at the beginning of a file to which the USR is written.

Specified by:
print_header in class OutputCodec
Parameters:
writer - the writer
Throws:
IOException - if an I/O error occurred

print_footer

public void print_footer(Writer writer)
                  throws IOException
Description copied from class: OutputCodec
Prints a footer at the end of a file to which the USR is written.

Specified by:
print_footer in class OutputCodec
Parameters:
writer - the writer
Throws:
IOException - if an I/O error occurred