ifaction.java
字号:
package piy.action;
import piy.*;
import java.io.Serializable;
/**
* Special action (required by PIY) to allow condition branches in an action list.
* @author David Vivash
* @version 1.0, 17/03/01
*/
public class IfAction implements PIYAction, Serializable {
private ActionList trueList;
private ActionList falseList;
private BooleanComparable ex = null;
public IfAction() {
trueList = new ActionList();
falseList = new ActionList();
}
public BooleanComparable getExpression() { return ex; }
public void setExpression(BooleanComparable val) { ex = val; }
public Object execute() {
if (ex == null) return null;
if (ex.evaluate()) trueList.execute(); else falseList.execute();
return null;
}
public ActionList getTrueList() { return trueList; }
public ActionList getFalseList() { return falseList; }
public Class getReturnType() { return null; }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -