All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.scce.addlib.traverser.PostorderTreeIterator Maven / Gradle / Ivy

Go to download

The Java Library for Algebraic Decision Diagrams, Code Generation, and Layouting

There is a newer version: 3.1.0
Show newest version
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;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy