abstractrule.java
来自「虽然商业的规则引擎和BPM系统有许多优点」· Java 代码 · 共 42 行
JAVA
42 行
package util;
/** TODO 3
* Created by IntelliJ IDEA.
* User: gexian
*在其execute()方法中,AbstractAction调用由子类实现的makeDecision()方法,
* 然后根据方法的返回值,调用组件定义的肯定或否定结果的方法。
*/
public abstract class AbstractRule extends AbstractComponent {
private AbstractComponent positiveOutcomeStep;
private AbstractComponent negativeOutcomeStep;
public void execute(Object arg) throws Exception {
boolean outcome = makeDecision(arg);
if(outcome)
positiveOutcomeStep.execute(arg);
else
negativeOutcomeStep.execute(arg);
}
protected abstract boolean makeDecision(Object arg) throws Exception;
public AbstractComponent getPositiveOutcomeStep() {
return positiveOutcomeStep;
}
public void setPositiveOutcomeStep(AbstractComponent positiveOutcomeStep) {
this.positiveOutcomeStep = positiveOutcomeStep;
}
public AbstractComponent getNegativeOutcomeStep() {
return negativeOutcomeStep;
}
public void setNegativeOutcomeStep(AbstractComponent negativeOutcomeStep) {
this.negativeOutcomeStep = negativeOutcomeStep;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?