T
- the input type.public class Engine<T> extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
Engine.EngineEdge<O>
An output-input relationship between two
Engine.EngineNode s. |
protected class |
Engine.EngineNode<I,O>
A computation node that is part of some topology of nodes.
|
protected static class |
Engine.ThrowableReferenceHandler
A subclass of
AtomicReference that doubles as an Thread.UncaughtExceptionHandler . |
Constructor and Description |
---|
Engine()
Alternate constructor.
|
Engine(int nThreads)
Alternate constructor.
|
Engine(int nThreads,
TraversalPolicy<Engine.EngineNode<?,?>,Engine.EngineEdge<?>> policy)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
<I,O> Handle<O> |
add(Calculator<I,O> calc,
boolean hasOutput,
Collection<? extends Calculator<?,? extends I>> calcDeps)
Adds a
Calculator along with its dependencies. |
<I,O> void |
add(Calculator<I,O> calc,
Calculator<?,? extends I>... calcDeps)
Adds a non-output
Calculator along with its dependencies. |
protected <O> void |
addEdge(Engine.EngineNode<?,? extends O> u,
Engine.EngineNode<? super O,?> v)
Links two
Engine.EngineNode s by an Engine.EngineEdge . |
<I,O> Handle<O> |
addOutput(Calculator<I,O> calc,
Calculator<?,? extends I>... calcDeps)
Adds an output
Calculator along with its dependencies. |
void |
execute(T engineInput)
Executes with the given input.
|
Calculator<? super Object,? extends T> |
getInput()
Gets the initial
Calculator , which does nothing aside from repeating input given to it. |
protected void |
invalidate()
Invalidates the current traversal ordering.
|
String |
toString()
Outputs human-readable directives for Dot graph generation.
|
protected void |
validate()
Computes a traversal ordering over the current configuration of
Engine.EngineNode s. |
public Engine()
Runtime.availableProcessors()
and LimitedMemoryPolicy
for its TraversalPolicy
.public Engine(int nThreads)
LimitedMemoryPolicy
for its TraversalPolicy
.nThreads
- the number of threads.public Engine(int nThreads, TraversalPolicy<Engine.EngineNode<?,?>,Engine.EngineEdge<?>> policy)
nThreads
- the number of threads.policy
- the TraversalPolicy
to apply when ordering nodes.public Calculator<? super Object,? extends T> getInput()
Calculator
, which does nothing aside from repeating input given to it.public <I,O> void add(Calculator<I,O> calc, Calculator<?,? extends I>... calcDeps)
Calculator
along with its dependencies.add(Calculator, boolean, Collection)
public <I,O> Handle<O> addOutput(Calculator<I,O> calc, Calculator<?,? extends I>... calcDeps)
Calculator
along with its dependencies.Handle
from which potential output can be retrieved.add(Calculator, boolean, Collection)
public <I,O> Handle<O> add(Calculator<I,O> calc, boolean hasOutput, Collection<? extends Calculator<?,? extends I>> calcDeps)
Calculator
along with its dependencies.I
- the Calculator
input type.O
- the Calculator
output type.calc
- the Calculator
.hasOutput
- whether this node has observable output.calcDeps
- the dependencies.Handle
from which potential output can be retrieved.public void execute(T engineInput)
engineInput
- the input.protected void validate()
Engine.EngineNode
s.protected void invalidate()
protected <O> void addEdge(Engine.EngineNode<?,? extends O> u, Engine.EngineNode<? super O,?> v)
Engine.EngineNode
s by an Engine.EngineEdge
.O
- the output-input type.