package uk.me.graphe.server;

import java.util.HashMap;
import java.util.Map;

import uk.me.graphe.graphmanagers.OTGraphManager2d;
import uk.me.graphe.graphmanagers.OTGraphManagerFactory;

public class DataManager {

    private static Map<Integer, OTGraphManager2d> sGraphs = new HashMap<Integer, OTGraphManager2d>();
    private static int sHighestId = 0;
    
    public static OTGraphManager2d getGraph(int mGraphId) {
        return sGraphs.get(mGraphId);
    }

    public static void save(OTGraphManager2d graph) {
        sGraphs.remove(graph.getGraphId());
        sGraphs.put(graph.getGraphId(), graph);
        
    }
    
    public static int create() {
        int id = ++sHighestId;
        sGraphs.put(id, OTGraphManagerFactory.newInstance(id));
        return id;
    }

}

@@ -779,12 +779,116 @@
 d;%0A    %7D
+%0A    %0A    public static void flush() %7B%0A        sGraphs = new HashMap%3CInteger, OTGraphManager2d%3E();%0A    %7D
 %0A%0A%7D%0A

add a function to flush all the data in the datamanager