public final class _IfV extends _Goto
If the condition is true, set the program counter of the state machine.
SMBuilder smb = new SMBuilder(); boolean condition = true; smb._if(condition, "skip"); condition = false; 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 |
---|
_IfV(_SMBuilder parentSMB,
boolean condition,
String label)
Create an _IfV
|
public _IfV(_SMBuilder parentSMB, boolean 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.