info.scce.addlib.traverser.PostorderTreeIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of addlib Show documentation
Show all versions of addlib Show documentation
The Java Library for Algebraic Decision Diagrams, Code Generation, and Layouting
package info.scce.addlib.traverser;
import info.scce.addlib.dd.DD;
import java.util.Collections;
import java.util.List;
public class PostorderTreeIterator> extends RecursiveTreeIterator {
public PostorderTreeIterator(D root) {
this(Collections.singletonList(root));
}
public PostorderTreeIterator(List root) {
super(root);
}
@Override
protected D processDD(D f, int i) {
switch (i) {
case 0:
if (!f.isConstant())
pushDD(f.e());
return null;
case 1:
if (!f.isConstant())
pushDD(f.t());
return null;
case 2:
return f;
default:
popDD();
return null;
}
}
}