[Javabdd-checkins] JavaBDD/net/sf/javabdd JFactory.java,1.27,1.28 BDDFactory.java,1.16,1.17
Brought to you by:
joewhaley
From: John W. <joe...@us...> - 2005-09-27 22:56:29
|
Update of /cvsroot/javabdd/JavaBDD/net/sf/javabdd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17374/net/sf/javabdd Modified Files: JFactory.java BDDFactory.java Log Message: Added support for variable translation during load. Index: BDDFactory.java =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/net/sf/javabdd/BDDFactory.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** BDDFactory.java 11 Jul 2005 22:48:52 -0000 1.16 --- BDDFactory.java 27 Sep 2005 22:56:19 -0000 1.17 *************** *** 486,489 **** --- 486,503 ---- */ public BDD load(BufferedReader ifile) throws IOException { + return load(ifile, null); + } + + /** + * <p>Loads a BDD from the given input, translating BDD variables according + * to the given map.</p> + * + * <p>Compare to bdd_load.</p> + * + * @param ifile reader + * @param translate variable translation map + * @return BDD + */ + public BDD load(BufferedReader ifile, int[] translate) throws IOException { tokenizer = null; *************** *** 520,523 **** --- 534,539 ---- int key = Integer.parseInt(readNext(ifile)); int var = Integer.parseInt(readNext(ifile)); + if (translate != null) + var = translate[var]; int lowi = Integer.parseInt(readNext(ifile)); int highi = Integer.parseInt(readNext(ifile)); Index: JFactory.java =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/net/sf/javabdd/JFactory.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** JFactory.java 21 May 2005 08:47:09 -0000 1.27 --- JFactory.java 27 Sep 2005 22:56:18 -0000 1.28 *************** *** 4940,4945 **** * @see net.sf.javabdd.BDDFactory#load(java.io.BufferedReader) */ ! public BDD load(BufferedReader in) throws IOException { ! int result = bdd_load(in); return makeBDD(result); } --- 4940,4945 ---- * @see net.sf.javabdd.BDDFactory#load(java.io.BufferedReader) */ ! public BDD load(BufferedReader in, int[] translate) throws IOException { ! int result = bdd_load(in, translate); return makeBDD(result); } *************** *** 6126,6130 **** LoadHash[] lh_table; ! int bdd_load(BufferedReader ifile) throws IOException { int n, vnum, tmproot; int root; --- 6126,6130 ---- LoadHash[] lh_table; ! int bdd_load(BufferedReader ifile, int[] translate) throws IOException { int n, vnum, tmproot; int root; *************** *** 6158,6162 **** lh_freepos = 0; ! tmproot = bdd_loaddata(ifile); for (n = 0; n < lh_nodenum; n++) --- 6158,6162 ---- lh_freepos = 0; ! tmproot = bdd_loaddata(ifile, translate); for (n = 0; n < lh_nodenum; n++) *************** *** 6179,6183 **** } ! int bdd_loaddata(BufferedReader ifile) throws IOException { int key, var, low, high, root = 0, n; --- 6179,6183 ---- } ! int bdd_loaddata(BufferedReader ifile, int[] translate) throws IOException { int key, var, low, high, root = 0, n; *************** *** 6185,6188 **** --- 6185,6190 ---- key = Integer.parseInt(readNext(ifile)); var = Integer.parseInt(readNext(ifile)); + if (translate != null) + var = translate[var]; low = Integer.parseInt(readNext(ifile)); high = Integer.parseInt(readNext(ifile)); |