FileDocCategorySizeDatePackage
RoundRobinScheduler.javaAPI DocAndroid 5.1 API2071Thu Mar 12 22:22:30 GMT 2015android.filterfw.core

RoundRobinScheduler

public class RoundRobinScheduler extends android.filterfw.core.Scheduler
hide

Fields Summary
private int
mLastPos
Constructors Summary
public RoundRobinScheduler(FilterGraph graph)


       
        super(graph);
    
Methods Summary
public voidreset()

        mLastPos = -1;
    
public android.filterfw.core.FilterscheduleNextNode()

        Set<Filter> all_filters = getGraph().getFilters();
        if (mLastPos >= all_filters.size()) mLastPos = -1;
        int pos = 0;
        Filter first = null;
        int firstNdx = -1;
        for (Filter filter : all_filters) {
            if (filter.canProcess()) {
                if (pos <= mLastPos) {
                    if (first == null) {
                        // store the first available filter
                        first = filter;
                        firstNdx = pos;
                    }
                } else {
                    // return the next available filter since last
                    mLastPos = pos;
                    return filter;
                }
            }
            pos ++;
        }
        // going around from the beginning
        if (first != null ) {
            mLastPos = firstNdx;
            return first;
        }
        // if there is nothing to be scheduled, still keep the previous
        // position.
        return null;