FileDocCategorySizeDatePackage
OneShotScheduler.javaAPI DocAndroid 5.1 API2547Thu Mar 12 22:22:30 GMT 2015android.filterfw.core

OneShotScheduler

public class OneShotScheduler extends android.filterfw.core.RoundRobinScheduler
This OneShotScheduler only schedules source filters at most once. All other filters will be scheduled, and possibly repeatedly, until there is no filter that can be scheduled.
hide

Fields Summary
private HashMap
scheduled
private final boolean
mLogVerbose
private static final String
TAG
Constructors Summary
public OneShotScheduler(FilterGraph graph)


       
        super(graph);
        scheduled = new HashMap<String, Integer>();
        mLogVerbose = Log.isLoggable(TAG, Log.VERBOSE);
    
Methods Summary
public voidreset()

        super.reset();
        scheduled.clear();
    
public android.filterfw.core.FilterscheduleNextNode()

        Filter first = null;
        // return the first filter that is not scheduled before.
        while (true) {
            Filter filter = super.scheduleNextNode();
            if (filter == null) {
                if (mLogVerbose) Log.v(TAG, "No filters available to run.");
                return null;
            }
            if (!scheduled.containsKey(filter.getName())) {
                if (filter.getNumberOfConnectedInputs() == 0)
                    scheduled.put(filter.getName(),1);
                if (mLogVerbose) Log.v(TAG, "Scheduling filter \"" + filter.getName() + "\" of type " + filter.getFilterClassName());
                return filter;
            }
            // if loop back, nothing available
            if (first == filter) {
                break;
            }
            // save the first scheduled one
            if (first == null) first = filter;
        }
        if (mLogVerbose) Log.v(TAG, "One pass through graph completed.");
        return null;