bcds.phison.io
Class SgfGraphReader<V extends GraphIONode,E>

java.lang.Object
  extended by bcds.phison.io.GraphReader<V,E>
      extended by bcds.phison.io.SgfGraphReader<V,E>
Direct Known Subclasses:
NetGraphReader

public class SgfGraphReader<V extends GraphIONode,E>
extends GraphReader<V,E>

Reads a topology file in .sgf format.

The format is described in detail here.

Author:
Juan Segovia S.

Constructor Summary
SgfGraphReader(java.lang.String fname, SimGraph<V,E> g)
          Creates a SgfGraphReader so that a later call to run() will populate the graph g from the file named fname.
 
Method Summary
 void run()
          Reads the file and populates the SimGraph g and the maps corresponding to edge or node pair attributes.
 
Methods inherited from class bcds.phison.io.GraphReader
getIdToNodeMap, getNode, markEdgeAttr, markNodePairAttr, raiseBadFormatEx, setInputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SgfGraphReader

public SgfGraphReader(java.lang.String fname,
                      SimGraph<V,E> g)
Creates a SgfGraphReader so that a later call to run() will populate the graph g from the file named fname.

Beware that this class cannot read from "-" (that is, stdin/System.in) because rewind is necessary to make multiple passes on the file, and stdin does not support that operation.

Throws:
AnyException - wrapping an IOException if opening fname for reading fails for any reason.
Method Detail

run

public void run()
Reads the file and populates the SimGraph g and the maps corresponding to edge or node pair attributes.

Specified by:
run in class GraphReader<V extends GraphIONode,E>
Throws:
BadFormatException - if there is a syntactic error, or if a value cannot be converted to number.