本文整理匯總了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);
}