📄 droolstest.java.template
字号:
package com.sample;
import org.drools.RuleBase;
import org.drools.WorkingMemory;
import org.drools.io.RuleBaseLoader;
public class DroolsTest {
public static final void main(String[] args) {
try {
// loading rule file rules.java.drl
RuleBase ruleBase = RuleBaseLoader.loadFromInputStream(
DroolsTest.class.getResourceAsStream("/Rules.java.drl"));
// creating working memory
WorkingMemory workingMemory = ruleBase.newWorkingMemory();
// insert elements in the working memory here
// e.g. workingMemory.assertObject(new Integer(10));
// Set application data here
// e.g. workingMemory.setApplicationData("myApplicationDataName", 12);
// firing all rules
workingMemory.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -