T
- The parametrized output type of the Graph
.public class Graph<T>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Graph<T> |
action(Action1<T> action)
Attaches an
Action1Node with the given action to the current OutputNode . |
static <OUT> Graph<OUT> |
begin(java.util.List<OUT> list)
|
static <OUT> Graph<OUT> |
begin(OUT... items)
|
static <OUT> Graph<OUT> |
begin(OutputAction<OUT> action)
Begins this
Graph with an OutputActionNode as a begin node. |
static <OUT> Graph<OUT> |
begin(OutputNode<OUT> outputNode)
Begins this
Graph with the given OutputNode as a begin node. |
static <OUT> Graph<OUT> |
begin(RequestDelegate<OUT> delegate)
|
static <OUT> Graph<OUT> |
begin(Tag<OUT> tag,
java.util.List<OUT> list)
|
static <OUT> Graph<OUT> |
begin(Tag<OUT> tag,
OUT... items)
|
static <OUT> Graph<OUT> |
begin(Tag<OUT> tag,
OutputAction<OUT> action)
Begins this
Graph with a OutputActionNode as a begin node. |
static <OUT> Graph<OUT> |
begin(Tag<OUT> tag,
OutputNode<OUT> outputNode)
Begins this
Graph with the given OutputNode as a begin node. |
static <OUT> Graph<OUT> |
beginTimer(OUT input,
long delay)
|
static <OUT> Graph<OUT> |
beginTimer(OUT input,
long delay,
long interval,
int repeatCount)
|
boolean |
booleanValue()
Invokes emit on
Graph and converts the emitted output to boolean value. |
Graph<T> |
buffer(int capacity)
Attaches a
BufferNode with the given capacity value to the current OutputNode . |
byte |
byteValue()
Invokes emit on
Graph and converts the emitted output to byte value. |
char |
charValue()
Invokes emit on
Graph and converts the emitted output to char value. |
Graph<T> |
concat(OutputNode<T>... sources)
Attaches a
ConcatNode to the current OutputNode . |
Graph<java.lang.String> |
concatStrings()
Attaches a
ConcatStringsNode to the current OutputNode . |
Graph<java.lang.Integer> |
count()
Attaches a
CountNode to the current OutputNode . |
Graph<T> |
distinct()
Attaches a
DistinctNode to the current OutputNode . |
double |
doubleValue()
Invokes emit on
Graph and converts the emitted output to double value. |
<IN> Graph<IN> |
end(Action1<IN> action)
Adds the specified
Action1Node as and end nodes. |
<IN> Graph<IN> |
end(InputNode<IN> inputNode)
Adds the given
InputNode as an end node. |
Graph<T> |
filter(BooleanFunction<T> condition)
Attaches a
FilterNode with the given condition to the current OutputNode . |
<OUT> OutputNode<OUT> |
findNode(Tag<OUT> tag)
Finds a
OutputNode tagged with the given Tag . |
Graph<T> |
first()
Attaches a
FirstNode to the current OutputNode . |
Graph<T> |
first(BooleanFunction<T> condition)
Attaches a
FirstNode with the given condition to the current OutputNode . |
float |
floatValue()
Invokes emit on
Graph and converts the emitted output to float value. |
<T_Node extends OutputNode<?>> |
getBeginNode()
Gets the begin
OutputNode for this Graph . |
Tag<T> |
getBeginTag()
Gets the begin
Tag . |
<T_Node> T_Node |
getCurrentNode()
Gets the current
Node . |
int |
intValue()
Invokes emit on
Graph and converts the emitted output to int value. |
Graph<T> |
last()
Attaches a
LastNode to the current OutputNode . |
Graph<T> |
last(BooleanFunction<T> condition)
Attaches a
LastNode with the given condition to the current OutputNode . |
long |
longValue()
Invokes emit on
Graph and converts the emitted output to long value. |
<OUT> Graph<OUT> |
map(Function<T,OUT> function)
Attaches a
FunctionNode with the given mapping function to the current OutputNode . |
Graph<T> |
merge(OutputNode<T>... sources)
Attaches a
MergeNode to the current OutputNode . |
<OUT> Graph<OUT> |
node(Tag<OUT> tag)
Finds a
OutputNode tagged with the given Tag and sets it to be current node. |
Graph<T> |
nth(int index)
Attaches a
NthNode with the given index parameter value to the current OutputNode . |
Graph<T> |
observer(NodeObserver<T> observer)
|
static Graph<android.view.View> |
onClick(android.view.View view)
Attaches an
ViewNode for the given View to produce click outputs. |
protected void |
onEmit()
Invoked by
start() . |
protected void |
onReset()
Invoked by
reset() . |
static Graph<java.lang.String> |
onTextChanged(android.widget.TextView view)
Attaches an
TextViewNode for the given TextView to produce inputted text
as an output. |
Graph<T> |
repeat(int times)
Attaches a
RepeatNode with the given times parameter value to the current OutputNode . |
<OUT> Graph<OUT> |
request(RequestDelegate<OUT> delegate)
Attaches an
RequestNode for the given RequestDelegate . |
void |
reset()
Resets this
Graph by starting from the begin node. |
Graph<T> |
reverse()
Attaches a
ReverseNode to the current OutputNode . |
protected void |
setBeginNode(OutputNode<T> outputNode)
Sets the begin
OutputNode . |
protected void |
setBeginNode(Tag<T> tag,
OutputNode<T> outputNode)
Sets the begin
OutputNode with the given tag. |
short |
shortValue()
Invokes emit on
Graph and converts the emitted output to short value. |
Graph<T> |
skip(int steps)
Attaches a
SkipNode with the given steps parameter value to the current OutputNode . |
Graph<T> |
skipWhile(BooleanFunction<T> condition)
Attaches a
SkipWhileNode with the given condition to the current OutputNode . |
void |
start()
Invokes the begin node to emit its value(s).
|
Graph<java.lang.String> |
string()
Attaches a
StringNode to the current OutputNode . |
java.lang.String |
stringValue()
Invokes emit on
Graph and converts the emitted output to String value. |
Graph<java.lang.Double> |
sum()
Attaches a
SumNode to the current OutputNode . |
Graph<T> |
tag(Tag<T> tag)
|
Graph<T> |
take(int steps)
Attaches a
TakeNode with the given steps parameter value to the current OutputNode . |
Graph<T> |
timer(long delay)
Attaches a
TimerNode with the given delay to current OutputNode . |
Graph<T> |
timer(long delay,
long interval,
int repeatCount)
Attaches a
TimerNode with the given parameters to current OutputNode . |
<OUT> Graph<OUT> |
to(Node<T,OUT> node)
|
<OUT> Graph<OUT> |
to(Tag attachTag,
Node<T,OUT> node)
Attaches the given
Node to the specified OutputNode . |
java.util.List<T> |
toList()
Invokes emit on
Graph and converts the emitted outputs to List . |
Graph<T> |
toMain()
Transfers the execution to the main thread.
|
Graph<T> |
toWorker()
Transfers the execution to a worker thread.
|
public <T_Node extends OutputNode<?>> T_Node getBeginNode()
OutputNode
for this Graph
.OutputNode
.protected void setBeginNode(OutputNode<T> outputNode)
OutputNode
.outputNode
- A OutputNode
.protected void setBeginNode(Tag<T> tag, OutputNode<T> outputNode)
OutputNode
with the given tag.tag
- An attach Tag
.outputNode
- A OutputNode
.public static <OUT> Graph<OUT> begin(OutputAction<OUT> action)
Graph
with an OutputActionNode
as a begin node. The given
OutputAction
is used to create the OutputActionNode
.action
- The action as an OutputAction
.Graph
.public static <OUT> Graph<OUT> begin(Tag<OUT> tag, OutputAction<OUT> action)
Graph
with a OutputActionNode
as a begin node. The begin
node is tagged with the given Tag
. The given OutputAction
is used to create the OutputActionNode
.public static <OUT> Graph<OUT> begin(OutputNode<OUT> outputNode)
Graph
with the given OutputNode
as a begin node.outputNode
- A OutputNode
Graph
.public static <OUT> Graph<OUT> begin(RequestDelegate<OUT> delegate)
delegate
- A RequestDelegate
Graph
.public static <OUT> Graph<OUT> begin(Tag<OUT> tag, OutputNode<OUT> outputNode)
Graph
with the given OutputNode
as a begin node. The begin
node is tagged with the given Tag
.tag
- An attach tag Tag
.outputNode
- A OutputNode
Graph
.public static <OUT> Graph<OUT> begin(java.util.List<OUT> list)
list
- A List
Graph
.@SafeVarargs public static <OUT> Graph<OUT> begin(OUT... items)
items
- A variable length parameter of items for a List
Graph
.public static <OUT> Graph<OUT> beginTimer(OUT input, long delay)
input
- The input value.delay
- The delay in milliseconds.Graph
.public static <OUT> Graph<OUT> beginTimer(OUT input, long delay, long interval, int repeatCount)
input
- The input value.delay
- The delay in milliseconds.interval
- The interval in milliseconds for repeated timeouts.repeatCount
- The number of repeats.Graph
.public <OUT> Graph<OUT> node(Tag<OUT> tag)
OutputNode
tagged with the given Tag
and sets it to be current node.public <OUT> OutputNode<OUT> findNode(Tag<OUT> tag)
OutputNode
tagged with the given Tag
.OUT
- The output type of the OutputNode
.tag
- A Tag
.OutputNode
. May return null
.public Graph<T> action(Action1<T> action)
Action1Node
with the given action to the current OutputNode
.public Graph<java.lang.Integer> count()
CountNode
to the current OutputNode
.Graph
.public <OUT> Graph<OUT> map(Function<T,OUT> function)
FunctionNode
with the given mapping function to the current OutputNode
.public <OUT> Graph<OUT> to(Tag attachTag, Node<T,OUT> node)
Node
to the specified OutputNode
.
The attached Node
is tagged with the given tag Object
.public Graph<T> filter(BooleanFunction<T> condition)
FilterNode
with the given condition to the current OutputNode
.condition
- The condition as a BooleanFunction
.Graph
.public Graph<T> first()
FirstNode
to the current OutputNode
.Graph
.public Graph<T> first(BooleanFunction<T> condition)
FirstNode
with the given condition to the current OutputNode
.condition
- The condition as a BooleanFunction
.Graph
.public Graph<T> last()
LastNode
to the current OutputNode
.Graph
.public Graph<T> last(BooleanFunction<T> condition)
LastNode
with the given condition to the current OutputNode
.condition
- The condition as a BooleanFunction
.Graph
.public Graph<T> distinct()
DistinctNode
to the current OutputNode
.Graph
.public Graph<T> reverse()
ReverseNode
to the current OutputNode
.Graph
.public Graph<T> buffer(int capacity)
BufferNode
with the given capacity value to the current OutputNode
.capacity
- The buffer capacity value.Graph
.public Graph<T> observer(NodeObserver<T> observer)
observer
- A NodeObserver
.Graph
.public Graph<T> repeat(int times)
RepeatNode
with the given times parameter value to the current OutputNode
.times
- The steps value.Graph
.public Graph<T> skip(int steps)
SkipNode
with the given steps parameter value to the current OutputNode
.steps
- The steps value.Graph
.public Graph<T> skipWhile(BooleanFunction<T> condition)
SkipWhileNode
with the given condition to the current OutputNode
.condition
- The condition as a BooleanFunction
.Graph
.public Graph<java.lang.String> string()
StringNode
to the current OutputNode
.Graph
.public Graph<T> take(int steps)
TakeNode
with the given steps parameter value to the current OutputNode
.steps
- The steps value.Graph
.public Graph<T> nth(int index)
NthNode
with the given index parameter value to the current OutputNode
.index
- The index value.Graph
.public Graph<java.lang.Double> sum()
SumNode
to the current OutputNode
.Graph
.@SafeVarargs public final Graph<T> concat(OutputNode<T>... sources)
ConcatNode
to the current OutputNode
.Graph
.public Graph<java.lang.String> concatStrings()
ConcatStringsNode
to the current OutputNode
.Graph
.@SafeVarargs public final Graph<T> merge(OutputNode<T>... sources)
MergeNode
to the current OutputNode
.Graph
.public static Graph<android.view.View> onClick(android.view.View view)
ViewNode
for the given View
to produce click outputs.view
- A View
.Graph
.public static Graph<java.lang.String> onTextChanged(android.widget.TextView view)
TextViewNode
for the given TextView
to produce inputted text
as an output.view
- A TextView
.Graph
.public <OUT> Graph<OUT> request(RequestDelegate<OUT> delegate)
RequestNode
for the given RequestDelegate
.delegate
- A RequestDelegate
.Graph
.public Graph<T> timer(long delay)
TimerNode
with the given delay to current OutputNode
.delay
- The delay in milliseconds.Graph
.public Graph<T> timer(long delay, long interval, int repeatCount)
TimerNode
with the given parameters to current OutputNode
.delay
- The delay in milliseconds.interval
- The interval in milliseconds for repeated timeouts.repeatCount
- The number of repeats.Node
.public void reset()
Graph
by starting from the begin node.protected void onReset()
reset()
.public void start()
protected void onEmit()
start()
.public boolean booleanValue()
Graph
and converts the emitted output to boolean
value.boolean
value.public byte byteValue()
Graph
and converts the emitted output to byte
value.byte
value.public char charValue()
Graph
and converts the emitted output to char
value.char
value.public double doubleValue()
Graph
and converts the emitted output to double
value.double
value.public float floatValue()
Graph
and converts the emitted output to float
value.float
value.public int intValue()
Graph
and converts the emitted output to int
value.int
value.public long longValue()
Graph
and converts the emitted output to long
value.long
value.public short shortValue()
Graph
and converts the emitted output to short
value.short
value.public java.lang.String stringValue()
Graph
and converts the emitted output to String
value.short
value.public java.util.List<T> toList()
Graph
and converts the emitted outputs to List
.List
.public <IN> Graph<IN> end(InputNode<IN> inputNode)
InputNode
as an end node.inputNode
- An InputNode
.public <IN> Graph<IN> end(Action1<IN> action)
Action1Node
as and end nodes.action
- An Action1
specifying the added Action1Node
.