public abstract class ValueNode
extends java.lang.Object
DataFlowGraph
. Nodes are added to a DataFlowGraph
using by
creating a GraphBinding
and calling GraphBinding.addBinding(com.facebook.litho.dataflow.ValueNode, com.facebook.litho.dataflow.ValueNode, java.lang.String)
. The nodes will
actually be added to the graph when GraphBinding.activate()
is called.
The nodes in an active graph are visited on each frame in dependency order and given a chance to compute a new value based on frame time and their parent (dependency) nodes.
A ValueNode should be able to return its latest value at any point in time.
Sub-classes are expected to implement calculateValue(long)
, which handles calculating the
new value for this frame based on the node's parents (i.e. nodes it depends on) and the current
frame time.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_INPUT |
Constructor and Description |
---|
ValueNode() |
Modifier and Type | Method and Description |
---|---|
protected abstract float |
calculateValue(long frameTimeNanos)
This node should calculate and set a new value based on frame time and its parents (the nodes
it depends on).
|
protected ValueNode |
getInput() |
protected ValueNode |
getInput(java.lang.String name) |
float |
getValue() |
protected boolean |
hasInput() |
protected boolean |
hasInput(java.lang.String name) |
void |
setValue(float value)
Manually sets the current value.
|
public static final java.lang.String DEFAULT_INPUT
public float getValue()
calculateValue(long)
.public void setValue(float value)
protected abstract float calculateValue(long frameTimeNanos)
protected ValueNode getInput(java.lang.String name)
protected ValueNode getInput()
protected boolean hasInput(java.lang.String name)
protected boolean hasInput()