Methods Summary |
---|
public int | addGraph(android.filterfw.core.FilterGraph graph)Add a graph to the environment. Consider using loadGraph() if you are loading a graph from
a graph file.
GraphHandle graphHandle = new GraphHandle(graph);
mGraphs.add(graphHandle);
return mGraphs.size() - 1;
|
public void | addReferences(java.lang.Object references)Add graph references to resolve during graph reading. The references added here are shared
among all graphs.
getGraphReader().addReferencesByKeysAndValues(references);
|
public android.filterfw.core.FilterGraph | getGraph(int graphId)Access a specific graph of this environment given a graph ID (previously returned from
loadGraph() or addGraph()). Throws an InvalidArgumentException if no graph with the
specified ID could be found.
if (graphId < 0 || graphId >= mGraphs.size()) {
throw new IllegalArgumentException(
"Invalid graph ID " + graphId + " specified in runGraph()!");
}
return mGraphs.get(graphId).getGraph();
|
public android.filterfw.io.GraphReader | getGraphReader()Returns the used graph reader. This will create one, if a reader has not been set already.
if (mGraphReader == null) {
mGraphReader = new TextGraphReader();
}
return mGraphReader;
|
public android.filterfw.core.GraphRunner | getRunner(int graphId, int executionMode)Get a GraphRunner instance for the graph with the specified ID. The GraphRunner instance can
be used to execute the graph. Throws an InvalidArgumentException if no graph with the
specified ID could be found.
switch (executionMode) {
case MODE_ASYNCHRONOUS:
return mGraphs.get(graphId).getAsyncRunner(getContext());
case MODE_SYNCHRONOUS:
return mGraphs.get(graphId).getSyncRunner(getContext());
default:
throw new RuntimeException(
"Invalid execution mode " + executionMode + " specified in getRunner()!");
}
|
public int | loadGraph(android.content.Context context, int resourceId)Loads a graph file from the specified resource and adds it to this environment.
// Read the file into a graph
FilterGraph graph = null;
try {
graph = getGraphReader().readGraphResource(context, resourceId);
} catch (GraphIOException e) {
throw new RuntimeException("Could not read graph: " + e.getMessage());
}
// Add graph to our list of graphs
return addGraph(graph);
|