Class BaseExporter<V,​E>

java.lang.Object
org.jgrapht.nio.BaseExporter<V,​E>
Type Parameters:
V - the graph vertex type
E - the graph edge type
Direct Known Subclasses:
CSVExporter, DIMACSExporter, DOTExporter, GEXFExporter, GmlExporter, GraphMLExporter, JSONExporter, LemonExporter, MatrixExporter, VisioExporter

public abstract class BaseExporter<V,​E>
extends java.lang.Object
Base implementation for an exporter.
Author:
Dimitrios Michail
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Optional<java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>>> edgeAttributeProvider
    An edge attribute provider
    protected java.util.Optional<java.util.function.Function<E,​java.lang.String>> edgeIdProvider
    An edge id provider
    protected java.util.Optional<java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>>> graphAttributeProvider
    A graph attribute provider
    protected java.util.Optional<java.util.function.Supplier<java.lang.String>> graphIdProvider
    A graph id provider
    protected java.util.Optional<java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>>> vertexAttributeProvider
    A vertex attribute provider
    protected java.util.function.Function<V,​java.lang.String> vertexIdProvider
    A vertex id provider
  • Constructor Summary

    Constructors 
    Constructor Description
    BaseExporter​(java.util.function.Function<V,​java.lang.String> vertexIdProvider)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    protected java.util.Optional<Attribute> getEdgeAttribute​(E e, java.lang.String key)
    Get an optional of an edge attribute
    java.util.Optional<java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>>> getEdgeAttributeProvider()
    Get the edge attribute provider
    protected java.util.Optional<java.util.Map<java.lang.String,​Attribute>> getEdgeAttributes​(E e)
    Get edge attributes
    protected java.util.Optional<java.lang.String> getEdgeId​(E e)
    Get an optional of the edge id
    java.util.Optional<java.util.function.Function<E,​java.lang.String>> getEdgeIdProvider()
    Get the edge id provider
    protected java.util.Optional<Attribute> getGraphAttribute​(java.lang.String key)
    Get an optional of a graph attribute
    java.util.Optional<java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>>> getGraphAttributeProvider()
    Get the graph attribute provider.
    protected java.util.Optional<java.lang.String> getGraphId()
    Get the graph id if present
    java.util.Optional<java.util.function.Supplier<java.lang.String>> getGraphIdProvider()
    Get the graph id provider.
    protected java.util.Optional<Attribute> getVertexAttribute​(V v, java.lang.String key)
    Get an optional of a vertex attribute
    java.util.Optional<java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>>> getVertexAttributeProvider()
    Get the vertex attribute provider
    protected java.util.Optional<java.util.Map<java.lang.String,​Attribute>> getVertexAttributes​(V v)
    Get vertex attributes
    protected java.lang.String getVertexId​(V v)
    Get the vertex id
    java.util.function.Function<V,​java.lang.String> getVertexIdProvider()
    Get vertex id provider.
    void setEdgeAttributeProvider​(java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>> edgeAttributeProvider)
    Set the edge attribute provider.
    void setEdgeIdProvider​(java.util.function.Function<E,​java.lang.String> edgeIdProvider)
    Set edge id provider
    void setGraphAttributeProvider​(java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>> graphAttributeProvider)
    Set the graph attribute provider.
    void setGraphIdProvider​(java.util.function.Supplier<java.lang.String> graphIdProvider)
    Set the graph id provider.
    void setVertexAttributeProvider​(java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>> vertexAttributeProvider)
    Set the vertex attribute provider
    void setVertexIdProvider​(java.util.function.Function<V,​java.lang.String> vertexIdProvider)
    Set the vertex id provider

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • graphIdProvider

      protected java.util.Optional<java.util.function.Supplier<java.lang.String>> graphIdProvider
      A graph id provider
    • graphAttributeProvider

      protected java.util.Optional<java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>>> graphAttributeProvider
      A graph attribute provider
    • vertexIdProvider

      protected java.util.function.Function<V,​java.lang.String> vertexIdProvider
      A vertex id provider
    • vertexAttributeProvider

      protected java.util.Optional<java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>>> vertexAttributeProvider
      A vertex attribute provider
    • edgeIdProvider

      protected java.util.Optional<java.util.function.Function<E,​java.lang.String>> edgeIdProvider
      An edge id provider
    • edgeAttributeProvider

      protected java.util.Optional<java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>>> edgeAttributeProvider
      An edge attribute provider
  • Constructor Details

    • BaseExporter

      public BaseExporter​(java.util.function.Function<V,​java.lang.String> vertexIdProvider)
      Constructor
      Parameters:
      vertexIdProvider - the vertex id provider to use. Cannot be null.
  • Method Details

    • getGraphIdProvider

      public java.util.Optional<java.util.function.Supplier<java.lang.String>> getGraphIdProvider()
      Get the graph id provider.
      Returns:
      the graph id provider as an Optional.
    • setGraphIdProvider

      public void setGraphIdProvider​(java.util.function.Supplier<java.lang.String> graphIdProvider)
      Set the graph id provider.
      Parameters:
      graphIdProvider - the graph id provider
    • getGraphAttributeProvider

      public java.util.Optional<java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>>> getGraphAttributeProvider()
      Get the graph attribute provider.
      Returns:
      the graph attribute provider as an Optional.
    • setGraphAttributeProvider

      public void setGraphAttributeProvider​(java.util.function.Supplier<java.util.Map<java.lang.String,​Attribute>> graphAttributeProvider)
      Set the graph attribute provider.
      Parameters:
      graphAttributeProvider - the graph attribute provider
    • getVertexIdProvider

      public java.util.function.Function<V,​java.lang.String> getVertexIdProvider()
      Get vertex id provider.
      Returns:
      the vertex id provider
    • setVertexIdProvider

      public void setVertexIdProvider​(java.util.function.Function<V,​java.lang.String> vertexIdProvider)
      Set the vertex id provider
      Parameters:
      vertexIdProvider - the vertex id provider
    • getVertexAttributeProvider

      public java.util.Optional<java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>>> getVertexAttributeProvider()
      Get the vertex attribute provider
      Returns:
      the vertex attribute provider as an Optional
    • setVertexAttributeProvider

      public void setVertexAttributeProvider​(java.util.function.Function<V,​java.util.Map<java.lang.String,​Attribute>> vertexAttributeProvider)
      Set the vertex attribute provider
      Parameters:
      vertexAttributeProvider - the vertex attribute provider
    • getEdgeIdProvider

      public java.util.Optional<java.util.function.Function<E,​java.lang.String>> getEdgeIdProvider()
      Get the edge id provider
      Returns:
      the edge id provider as an Optional.
    • setEdgeIdProvider

      public void setEdgeIdProvider​(java.util.function.Function<E,​java.lang.String> edgeIdProvider)
      Set edge id provider
      Parameters:
      edgeIdProvider - the edge id provider
    • getEdgeAttributeProvider

      public java.util.Optional<java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>>> getEdgeAttributeProvider()
      Get the edge attribute provider
      Returns:
      the edge attribute provider as an Optional
    • setEdgeAttributeProvider

      public void setEdgeAttributeProvider​(java.util.function.Function<E,​java.util.Map<java.lang.String,​Attribute>> edgeAttributeProvider)
      Set the edge attribute provider.
      Parameters:
      edgeAttributeProvider - the edge attribute provider
    • getGraphId

      protected java.util.Optional<java.lang.String> getGraphId()
      Get the graph id if present
      Returns:
      an Optional of the graph id
    • getVertexId

      protected java.lang.String getVertexId​(V v)
      Get the vertex id
      Parameters:
      v - the vertex
      Returns:
      the id of the vertex
    • getEdgeId

      protected java.util.Optional<java.lang.String> getEdgeId​(E e)
      Get an optional of the edge id
      Parameters:
      e - the edge
      Returns:
      the edge id
    • getVertexAttributes

      protected java.util.Optional<java.util.Map<java.lang.String,​Attribute>> getVertexAttributes​(V v)
      Get vertex attributes
      Parameters:
      v - the vertex v
      Returns:
      the vertex attributes as an Optional
    • getVertexAttribute

      protected java.util.Optional<Attribute> getVertexAttribute​(V v, java.lang.String key)
      Get an optional of a vertex attribute
      Parameters:
      v - the vertex v
      key - the attribute key
      Returns:
      the attribute as an Optional
    • getEdgeAttributes

      protected java.util.Optional<java.util.Map<java.lang.String,​Attribute>> getEdgeAttributes​(E e)
      Get edge attributes
      Parameters:
      e - the edge e
      Returns:
      the edge attributes as an Optional
    • getEdgeAttribute

      protected java.util.Optional<Attribute> getEdgeAttribute​(E e, java.lang.String key)
      Get an optional of an edge attribute
      Parameters:
      e - the edge e
      key - the attribute key
      Returns:
      the attribute as an Optional
    • getGraphAttribute

      protected java.util.Optional<Attribute> getGraphAttribute​(java.lang.String key)
      Get an optional of a graph attribute
      Parameters:
      key - the attribute key
      Returns:
      the attribute as an Optional