- java.lang.Object
-
- org.jgrapht.nio.BaseExporter<V,E>
-
- org.jgrapht.nio.lemon.LemonExporter<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
GraphExporter<V,E>
public class LemonExporter<V,E> extends BaseExporter<V,E> implements GraphExporter<V,E>
Exports a graph into Lemon graph format (LGF).This is the custom graph format used in the Lemon graph library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LemonExporter.Parameter
Parameters that affect the behavior of theLemonExporter
exporter.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CREATOR
private static java.lang.String
DELIM
private java.util.Set<LemonExporter.Parameter>
parameters
private static java.lang.String
TAB1
private static java.lang.String
VERSION
-
Fields inherited from class org.jgrapht.nio.BaseExporter
edgeAttributeProvider, edgeIdProvider, graphAttributeProvider, graphIdProvider, vertexAttributeProvider, vertexIdProvider
-
-
Constructor Summary
Constructors Constructor Description LemonExporter()
Constructs a new exporter.LemonExporter(java.util.function.Function<V,java.lang.String> vertexIdProvider)
Constructs a new exporter with a given vertex id provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
exportEdges(java.io.PrintWriter out, Graph<V,E> g)
void
exportGraph(Graph<V,E> g, java.io.Writer writer)
Export a graph using the givenWriter
.private void
exportHeader(java.io.PrintWriter out)
private void
exportVertices(java.io.PrintWriter out, Graph<V,E> g)
boolean
isParameter(LemonExporter.Parameter p)
Return if a particular parameter of the exporter is enabledprivate java.lang.String
prepareId(java.lang.String s)
void
setParameter(LemonExporter.Parameter p, boolean value)
Set the value of a parameter of the exporter-
Methods inherited from class org.jgrapht.nio.BaseExporter
getEdgeAttribute, getEdgeAttributeProvider, getEdgeAttributes, getEdgeId, getEdgeIdProvider, getGraphAttribute, getGraphAttributeProvider, getGraphId, getGraphIdProvider, getVertexAttribute, getVertexAttributeProvider, getVertexAttributes, getVertexId, getVertexIdProvider, setEdgeAttributeProvider, setEdgeIdProvider, setGraphAttributeProvider, setGraphIdProvider, setVertexAttributeProvider, setVertexIdProvider
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jgrapht.nio.GraphExporter
exportGraph, exportGraph
-
-
-
-
Field Detail
-
CREATOR
private static final java.lang.String CREATOR
- See Also:
- Constant Field Values
-
VERSION
private static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
DELIM
private static final java.lang.String DELIM
- See Also:
- Constant Field Values
-
TAB1
private static final java.lang.String TAB1
- See Also:
- Constant Field Values
-
parameters
private final java.util.Set<LemonExporter.Parameter> parameters
-
-
Constructor Detail
-
LemonExporter
public LemonExporter()
Constructs a new exporter.
-
LemonExporter
public LemonExporter(java.util.function.Function<V,java.lang.String> vertexIdProvider)
Constructs a new exporter with a given vertex id provider.- Parameters:
vertexIdProvider
- for generating vertex IDs. Must not be null.
-
-
Method Detail
-
exportGraph
public void exportGraph(Graph<V,E> g, java.io.Writer writer)
Description copied from interface:GraphExporter
Export a graph using the givenWriter
.It is the callers responsibility to ensure the
Writer
is closed after this method returned.- Specified by:
exportGraph
in interfaceGraphExporter<V,E>
- Parameters:
g
- the graph to exportwriter
- the output writer
-
isParameter
public boolean isParameter(LemonExporter.Parameter p)
Return if a particular parameter of the exporter is enabled- Parameters:
p
- the parameter- Returns:
true
if the parameter is set,false
otherwise
-
setParameter
public void setParameter(LemonExporter.Parameter p, boolean value)
Set the value of a parameter of the exporter- Parameters:
p
- the parametervalue
- the value to set
-
prepareId
private java.lang.String prepareId(java.lang.String s)
-
exportHeader
private void exportHeader(java.io.PrintWriter out)
-
-