Search in sources :

Example 1 with Deleteable

use of jcog.pri.Deleteable in project narchy by automenta.

the class RTreeBeliefTable method findEvictable.

private static boolean findEvictable(Space<TaskRegion> tree, Node<TaskRegion, ?> next, Top2<Leaf<TaskRegion>> mergeVictims) {
    if (next instanceof Leaf) {
        Leaf l = (Leaf) next;
        for (Object _x : l.data) {
            if (_x == null)
                // end of list
                break;
            TaskRegion x = (TaskRegion) _x;
            if (((Deleteable) x).isDeleted()) {
                // found a deleted task in the leaf, we need look no further
                boolean removed = tree.remove(x);
                // }
                assert (removed);
                return false;
            }
        }
        mergeVictims.accept(l);
    } else {
        // if (next instanceof Branch)
        Branch b = (Branch) next;
        for (Node ww : b.data) {
            if (ww == null)
                // end of list
                break;
            else if (!findEvictable(tree, ww, mergeVictims))
                return false;
        }
    }
    return true;
}
Also used : Deleteable(jcog.pri.Deleteable) TaskRegion(nars.task.util.TaskRegion)

Aggregations

Deleteable (jcog.pri.Deleteable)1 TaskRegion (nars.task.util.TaskRegion)1