net.sf.javabdd
Class BDD.BDDIterator

java.lang.Object
  extended by net.sf.javabdd.BDD.BDDIterator
All Implemented Interfaces:
Iterator
Enclosing class:
BDD

public static class BDD.BDDIterator
extends Object
implements Iterator

BDDIterator is used to iterate through the satisfying assignments of a BDD. It includes the ability to check if bits are dont-cares and skip them.

Version:
$Id: BDD.java 472 2006-12-03 10:32:26Z joewhaley $
Author:
jwhaley

Constructor Summary
BDD.BDDIterator(BDD bdd, BDDVarSet var)
          Construct a new BDDIterator on the given BDD.
 
Method Summary
 void fastForward(int var)
          Fast-forward the iteration such that the given variable number is true.
 void fastForward(int[] vars)
          Fast-forward the iteration such that the given set of variables are true.
protected  void gotoNext()
           
protected  boolean gotoNextA()
           
 boolean hasNext()
           
 boolean isDontCare(BDDDomain d)
          Returns true if the BDD variables in the given BDD domain are all dont-care's.
 boolean isDontCare(int var)
          Returns true if the given BDD variable number is a dont-care.
 Object next()
           
 BDD nextBDD()
          Return the next BDD in the iteration.
 boolean[] nextSat()
          Return the next single satisfying assignment in the iteration.
 BigInteger[] nextTuple()
          Return the next tuple of domain values in the iteration.
 BigInteger[] nextTuple2()
          An alternate implementation of nextTuple().
 BigInteger nextValue(BDDDomain dom)
           
 void remove()
           
 void skipDontCare(BDDDomain d)
          Assuming d is a dont-care, skip to the end of the iteration for d
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BDD.BDDIterator

public BDD.BDDIterator(BDD bdd,
                       BDDVarSet var)
Construct a new BDDIterator on the given BDD. The var argument is the set of variables that will be mentioned in the result.

Parameters:
bdd - BDD to iterate over
var - variable set to mention in result
Method Detail

gotoNext

protected void gotoNext()

gotoNextA

protected boolean gotoNextA()

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator

nextValue

public BigInteger nextValue(BDDDomain dom)

nextTuple

public BigInteger[] nextTuple()
Return the next tuple of domain values in the iteration.

Returns:
the next tuple of domain values in the iteration.

nextTuple2

public BigInteger[] nextTuple2()
An alternate implementation of nextTuple(). This may be slightly faster than the default if there are many domains.

Returns:
the next tuple of domain values in the iteration.

nextSat

public boolean[] nextSat()
Return the next single satisfying assignment in the iteration.

Returns:
the next single satisfying assignment in the iteration.

nextBDD

public BDD nextBDD()
Return the next BDD in the iteration.

Returns:
the next BDD in the iteration

remove

public void remove()
Specified by:
remove in interface Iterator

isDontCare

public boolean isDontCare(int var)

Returns true if the given BDD variable number is a dont-care. var must be a variable in the iteration set.

Parameters:
var - variable number to check
Returns:
if the given variable is a dont-care

isDontCare

public boolean isDontCare(BDDDomain d)

Returns true if the BDD variables in the given BDD domain are all dont-care's.

Parameters:
d - domain to check
Returns:
if the variables are all dont-cares
Throws:
BDDException - if d is not in the iteration set

fastForward

public void fastForward(int var)
Fast-forward the iteration such that the given variable number is true.

Parameters:
var - number of variable

fastForward

public void fastForward(int[] vars)
Fast-forward the iteration such that the given set of variables are true.

Parameters:
vars - set of variable indices

skipDontCare

public void skipDontCare(BDDDomain d)
Assuming d is a dont-care, skip to the end of the iteration for d

Parameters:
d - BDD domain to fast-forward past


Copyright © 2003-2007 John Whaley. All Rights Reserved.