Parallel

The parallel node. Tries to tick all of its children in parallel. Returns true if and only if there were more then Y successful ticks. If there were less successful ticks, returns false, if there were more then N failure ticks. Otherwise returns running.

Constructors

this
this(size_t s, size_t f)
Undocumented in source.
this
this(size_t s, size_t f, T m)
Undocumented in source.

Members

Functions

opCall
auto opCall(U args)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

F
size_t F;
Undocumented in source.
S
size_t S;
Undocumented in source.
members
T members;
Undocumented in source.
states
Ternary[T.length] states;
Undocumented in source.

Examples

Functor v; 

size_t successes = 1; 
size_t failures = 4; 

auto p = Parallel!(
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process)
)(successes,failures);

assert(p.S == successes); 
assert(p.F == failures); 

v = 10;
auto res = p(v, 0); 
assert(v == 10); 
assert(res == Ternary.no); 

v = 10; 
res = p(v, 10); 
assert(v == 500); 
assert(res == Ternary.unknown); 

failures = 3; 
p = Parallel!(
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process),
	Action!(Leaf!Ternary, process)
)(successes,failures);
assert(p.S == successes); 
assert(p.F == failures); 
v = 10; 
res = p(v, 10); 
assert(v == 500); 
assert(res == Ternary.no); 

v = 10; 
res = p(v, 15); 
assert(v == 70); 
assert(res == Ternary.yes); 

Meta