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;