helix.graph.io
Class DimacsExtendedReader

java.lang.Object
  extended by helix.graph.io.AbstractGraphReader
      extended by helix.graph.io.DimacsReader
          extended by helix.graph.io.DimacsExtendedReader
All Implemented Interfaces:
GraphReader

public class DimacsExtendedReader
extends DimacsReader

a Dimacs format reader with additional capabilities to read attributes attached to Graph, Vertices or Edges.
Attributes are specified as :
key=value with key = alpha+ value = any+ | "qany+" alpha = [a-z] | [A-Z] | [0-9] | '_' any = [^ |"] qany = [^"] note: Please note that the '-' (dash) character is not allowed in key and is only allowed in values if it is quoted.
note: You cannot backquote the '"' in values... sorry

examples: -- for graph p Label=MyGraph -- for Vertex n Label=one Colors=1011 Genes="g1 g2 g3 g4" -- for Edges e 1 4 Label="one to four" Colors=1011
When found, attributes are registered in Vertex or Edge Registry with the corresponding key. The reader try to choose the most appropriate type for RegistryValue (i.e. will use RInteger for value 123) but this has no special effect since all ImmutableRegistryValue's are interconvertible (including for the equals() comparison).
in addition, for the following special keys, the value is further transformed :


  key          RegistryValue type
  ----------------------------------
  Colors       ColorSet
  Color        integer
  Label        String
  Comment      String
  
  // for genes
  Rank         Integer
  Orientation  String   (converted to "+" or "-")
  
  
note: the special keys are recognized case-insensitive.
note: the IsDirect key is readOnly and is a shortcut for Orientation == "+"


Constructor Summary
DimacsExtendedReader(Reader reader, GraphFactory factory)
           
DimacsExtendedReader(Reader reader, GraphFactory factory, Logger logger)
           
 
Method Summary
 Graph read()
           
 
Methods inherited from class helix.graph.io.AbstractGraphReader
getLogger
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimacsExtendedReader

public DimacsExtendedReader(Reader reader,
                            GraphFactory factory)

DimacsExtendedReader

public DimacsExtendedReader(Reader reader,
                            GraphFactory factory,
                            Logger logger)
Method Detail

read

public Graph read()
           throws IOException
Specified by:
read in interface GraphReader
Overrides:
read in class DimacsReader
Throws:
IOException