package uk.me.graphe.shared.messages.factories;


import uk.me.graphe.shared.Edge;
import uk.me.graphe.shared.Vertex;
import uk.me.graphe.shared.jsonwrapper.JSONException;
import uk.me.graphe.shared.jsonwrapper.JSONObject;
import uk.me.graphe.shared.messages.Message;
import uk.me.graphe.shared.messages.operations.AddEdgeOperation;

public class AddEdgeFactory implements ConversionFactory {

    @Override
    public Message make(JSONObject o) {
        try {
            Vertex v1 = new Vertex(o.getString("from"));
            Vertex v2 = new Vertex(o.getString("to"));
            return new AddEdgeOperation(new Edge(v1, v2));
        } catch (JSONException e) {
            throw new Error(e);
        }
    }

}

@@ -111,16 +111,60 @@
 Vertex;%0A
+import uk.me.graphe.shared.VertexDirection;%0A
 import u
@@ -607,24 +607,140 @@
 ing(%22to%22));%0A
+            VertexDirection dir = VertexDirection.valueOf(o.getString(%22dir%22));%0A            System.err.println(dir);%0A
             
@@ -782,16 +782,21 @@
 e(v1, v2
+, dir
 ));%0A    
@@ -823,24 +823,57 @@
 eption e) %7B%0A
+            e.printStackTrace();%0A
             

make addEdgeFactory direction aware