本文整理汇总了Java中org.kie.api.runtime.KieSession.getFactHandles方法的典型用法代码示例。如果您正苦于以下问题:Java KieSession.getFactHandles方法的具体用法?Java KieSession.getFactHandles怎么用?Java KieSession.getFactHandles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kie.api.runtime.KieSession
的用法示例。
在下文中一共展示了KieSession.getFactHandles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findpayPass
import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
/**
* Search the {@link KieSession} for pay passes.
*/
private RoutingInfo findpayPass(KieSession kieSession) {
// Find all PayStylePass facts and 1st generation child classes of PayStylePass.
ObjectFilter payPassFilter = new ObjectFilter() {
@Override
public boolean accept(Object object) {
if (RoutingInfo.class.equals(object.getClass())) return true;
if (RoutingInfo.class.equals(object.getClass().getSuperclass())) return true;
return false;
}
};
// printFactsMessage(kieSession);
List<RoutingInfo> facts = new ArrayList<RoutingInfo>();
for (FactHandle handle : kieSession.getFactHandles(payPassFilter)) {
facts.add((RoutingInfo) kieSession.getObject(handle));
}
if (facts.size() == 0) {
return null;
}
// Assumes that the rules will always be generating a single pay pass.
return facts.get(0);
}
示例2: findBusPass
import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
/**
* Search the {@link KieSession} for bus passes.
*/
private BusPass findBusPass(KieSession kieSession) {
// Find all BusPass facts and 1st generation child classes of BusPass.
ObjectFilter busPassFilter = new ObjectFilter() {
@Override
public boolean accept(Object object) {
if (BusPass.class.equals(object.getClass())) return true;
if (BusPass.class.equals(object.getClass().getSuperclass())) return true;
return false;
}
};
// printFactsMessage(kieSession);
List<BusPass> facts = new ArrayList<BusPass>();
for (FactHandle handle : kieSession.getFactHandles(busPassFilter)) {
facts.add((BusPass) kieSession.getObject(handle));
}
if (facts.size() == 0) {
return null;
}
// Assumes that the rules will always be generating a single bus pass.
return facts.get(0);
}
示例3: printFactsMessage
import org.kie.api.runtime.KieSession; //导入方法依赖的package包/类
/**
* Print out details of all facts in working memory.
* Handy for debugging.
*/
@SuppressWarnings("unused")
private void printFactsMessage(KieSession kieSession) {
Collection<FactHandle> allHandles = kieSession.getFactHandles();
String msg = "\nAll facts:\n";
for (FactHandle handle : allHandles) {
msg += " " + kieSession.getObject(handle) + "\n";
}
System.out.println(msg);
}