public final class _IfF extends _Goto
If the (indirect) condition is true, set the program counter of the state machine.
SMBuilder smb = new SMBuilder(); smb._if(new BooleanFunc() { public boolean get(StateMachine sm) { return true; } }, "skip"); smb._set(new ObjectFunc() { public Object get(StateMachine sm) { System.out.println("does not print"); return null; } }); smb._label("skip"); smb._set(new ObjectFunc() { public Object get(StateMachine stateMachine) { System.out.println("Hello world!"); return null; } }); smb.call(rp); Output: Hello world!
Constructor and Description |
---|
_IfF(_SMBuilder parentSMB,
BooleanFunc condition,
String label)
Create an _IfF
|
public _IfF(_SMBuilder parentSMB, BooleanFunc condition, String label)
parentSMB
- The parent builder.condition
- The condition.label
- The identifier of where to go to.public void call(SimpleMachine stateMachine, RP rp) throws Exception
call
in interface _Operation
call
in class _Goto
stateMachine
- The state machine driving the operation.rp
- The response processor.Exception
- Any uncaught exceptions raised while performing the operation.Copyright © 2012. All Rights Reserved.