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

org.qbicc.graph.schedule.Loop Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.graph.schedule;

import java.util.BitSet;
import java.util.HashSet;
import java.util.Set;

@SuppressWarnings("serial")
final class Loop extends BitSet {
    final int number;
    final Loop parent;
    final int exit;
    final Set children = new HashSet<>();

    Loop(final int number, final Loop parent, final int exit) {
        this.number = number;
        this.parent = parent;
        this.exit = exit;
        if (parent != null) {
            parent.children.add(this);
        }
    }

    int getLevel() {
        return parent == null ? 0 : parent.getLevel() + 1;
    }

    int getExit() {
        return exit;
    }

    void addMember(final int index) {
        set(index);
        if (parent != null) {
            parent.addMember(index);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy