edu.claflin.finder.io.graph

## Class SIFGraphIO

- java.lang.Object
- - edu.claflin.finder.io.graph.SIFGraphIO

- All Implemented Interfaces:
    GraphReader, GraphWriter

      public final class SIFGraphIO
      extends java.lang.Object
      implements GraphReader, GraphWriter

  A class for reading and writing graphs in the SIF format. The SIF, or Simple Interaction File, format is outlined in detail here:
  Version:
    3.1.1 February 2, 2016
  Author:
    Charles Allen Schultz II

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.lang.String` | `defaultRelationship` Contains the String representation of the default relationship to use.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SIFGraphIO(java.lang.String defaultRelationship)` Constructs the SIFGraphIO object.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Graph` | `parseGraph(java.io.File source, boolean undirected)` Reads a graph from memory.
    `private static boolean` | `testFile(java.io.File file)` Tests to see if a File is a valid graph file.
    `private java.lang.String` | `verifyRelationship(java.lang.Object edgeData)` Verifies the relationship between edges.
    `void` | `writeGraph(Graph toWrite)` Writes graphs to memory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### defaultRelationship

          private final java.lang.String defaultRelationship

      Contains the String representation of the default relationship to use. The default relationship value is used when writing a graph and the graph being read does not use String objects to represent edges. Currently, String objects are being used for simplicity.

  - ### Constructor Detail

    - #### SIFGraphIO

          public SIFGraphIO(java.lang.String defaultRelationship)

      Constructs the SIFGraphIO object.
      Parameters:
        `defaultRelationship` - the String representing the default edge relationship.

  - ### Method Detail

    - #### parseGraph

          public Graph parseGraph(java.io.File source,
                                  boolean undirected)

      Reads a graph from memory. Reads SIF Style graphs.
      Specified by:
        `parseGraph` in interface `GraphReader`
      Parameters:
        `source` - the File object representing the graph in memory.
        `undirected` - This boolean is IGNORED as SIF graphs are NOT undirected.
      Returns:

    - #### writeGraph

          public void writeGraph(Graph toWrite)

      Writes graphs to memory. Writes SIF Style graphs.
      Specified by:
        `writeGraph` in interface `GraphWriter`
      Parameters:
        `toWrite` - the Graph object to write to memory.

    - #### testFile

          private static boolean testFile(java.io.File file)

      Tests to see if a File is a valid graph file. Currently only tests by checking to ensure the provided file is not a directory.
      Parameters:
        `file` - the File to test.
      Returns:
        the boolean value representing if the file is valid.

    - #### verifyRelationship

          private java.lang.String verifyRelationship(java.lang.Object edgeData)

      Verifies the relationship between edges. Checks to see that the Object used in the `Graph` for representing an edge is a String. If it not, the default relationship is used instead.
      Parameters:
        `edgeData` -
      Returns: