public void save(BufferedWriter out, BDD r) throws IOException { if (r.isOne() || r.isZero()) { out.write("0 0 " + (r.isOne()?1:0) + "\n"); return; }  out.write(r.nodeCount() + " " + varNum() + "\n");  for (int x = 0; x < varNum(); x++) out.write(var2Level(x) + " "); out.write("\n");  Map visited = new HashMap(); save_rec(out, visited, r);  for (Iterator it = visited.keySet().iterator(); it.hasNext(); ) { BDD b = (BDD) it.next(); if (b != r) b.free();
public void save(String filename, BDD var) throws IOException { BufferedWriter is = null; try { is = new BufferedWriter(new FileWriter(filename)); save(is, var); } finally { if (is != null) try { is.close(); } catch (IOException _) { }
    public void save(BufferedWriter out, BDD r) throws IOException {        if (r.isOne() || r.isZero()) {            out.write("0 0 " + (r.isOne()?1:0) + "\n");            return;        }        out.write(r.nodeCount() + " " + varNum() + "\n");        for (int x = 0; x < varNum(); x++)            out.write(var2Level(x) + " ");        out.write("\n");        Map visited = new HashMap();        save_rec(out, visited, r);                for (Iterator it = visited.keySet().iterator(); it.hasNext(); ) {            BDD b = (BDD) it.next();            if (b != r) b.free();        }    }