public void setVarOrder(String ordering) { List result = new LinkedList(); int nDomains = numberOfDomains(); StringTokenizer st = new StringTokenizer(ordering, "x_", true); boolean[] done = new boolean[nDomains]; List last = null; for (int i=0; ; ++i) { String s = st.nextToken(); BDDDomain d; for (int j=0; ; ++j) { if (j == nDomains) throw new BDDException("bad domain: "+s); d = getDomain(j); if (s.equals(d.getName())) break; } if (done[d.getIndex()]) throw new BDDException("duplicate domain: "+s); done[d.getIndex()] = true; if (last != null) last.add(d); if (st.hasMoreTokens()) { s = st.nextToken(); if (s.equals("x")) { if (last == null) { last = new LinkedList(); last.add(d); result.add(last); } } else if (s.equals("_")) { if (last == null) { result.add(d); } last = null; } else { throw new BDDException("bad token: "+s); } } else { if (last == null) { result.add(d); } break; } }  for (int i=0; i<done.length; ++i) { if (!done[i]) { throw new BDDException("missing domain #"+i+": "+getDomain(i)); } }  setVarOrder(result); }
public void setVarOrder(int[] neworder) { bdd_setvarorder(neworder); }
    public void setVarOrder(String ordering) {        List result = new LinkedList();        int nDomains = numberOfDomains();        StringTokenizer st = new StringTokenizer(ordering, "x_", true);        boolean[] done = new boolean[nDomains];        List last = null;        for (int i=0; ; ++i) {            String s = st.nextToken();            BDDDomain d;            for (int j=0; ; ++j) {                if (j == nDomains)                    throw new BDDException("bad domain: "+s);                d = getDomain(j);                if (s.equals(d.getName())) break;            }            if (done[d.getIndex()])                throw new BDDException("duplicate domain: "+s);            done[d.getIndex()] = true;            if (last != null) last.add(d);            if (st.hasMoreTokens()) {                s = st.nextToken();                if (s.equals("x")) {                    if (last == null) {                        last = new LinkedList();                        last.add(d);                        result.add(last);                    }                } else if (s.equals("_")) {                    if (last == null) {                        result.add(d);                    }                    last = null;                } else {                    throw new BDDException("bad token: "+s);                }            } else {                if (last == null) {                    result.add(d);                }                break;            }        }                for (int i=0; i<done.length; ++i) {            if (!done[i]) {                throw new BDDException("missing domain #"+i+": "+getDomain(i));            }        }                setVarOrder(result);    }