|
@@ -12,6 +12,11 @@ import org.json.JSONObject;
|
|
|
import Model.LayeredGraphEdge;
|
|
|
import Model.LayeredGraphNode;
|
|
|
|
|
|
+/**
|
|
|
+ * Writes a {@link LayeredGraphNode} to a JSON file.
|
|
|
+ * @author kolja
|
|
|
+ *
|
|
|
+ */
|
|
|
public class Writer {
|
|
|
|
|
|
private String file;
|
|
@@ -21,6 +26,10 @@ public class Writer {
|
|
|
file = outputFileName;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Writes the given {@link LayeredGraphNode} to a JSON file.
|
|
|
+ * @param graph the graph that is to be saved.
|
|
|
+ */
|
|
|
public void writeOutputGraph( LayeredGraphNode graph )
|
|
|
{
|
|
|
try {
|
|
@@ -32,7 +41,7 @@ public class Writer {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public JSONObject parseNode( LayeredGraphNode graph ) throws JSONException
|
|
|
+ private JSONObject parseNode( LayeredGraphNode graph ) throws JSONException
|
|
|
{
|
|
|
JSONObject node = new JSONObject();
|
|
|
JSONArray layers = new JSONArray();
|
|
@@ -58,7 +67,7 @@ public class Writer {
|
|
|
return node;
|
|
|
}
|
|
|
|
|
|
- public JSONObject parseEdge( LayeredGraphEdge e ) throws JSONException
|
|
|
+ private JSONObject parseEdge( LayeredGraphEdge e ) throws JSONException
|
|
|
{
|
|
|
JSONObject edge = new JSONObject();
|
|
|
edge.put( "source", e.getSources().get( 0 ).getName() );
|