当前位置: 首页>>代码示例>>Java>>正文


Java FactHandle类代码示例

本文整理汇总了Java中org.drools.runtime.rule.FactHandle的典型用法代码示例。如果您正苦于以下问题:Java FactHandle类的具体用法?Java FactHandle怎么用?Java FactHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FactHandle类属于org.drools.runtime.rule包,在下文中一共展示了FactHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exec

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
public void exec(FrameTask ctx) {
	StatefulKnowledgeSession kbsess = kb.newStatefulKnowledgeSession();
	try {
		// this knowledge session will be the session for all Drools rules
		kbsess.insert(ctx.getTriggerEvent());
		kbsess.setGlobal("DAO", ctx.getResource(IGenericPatientObjectDAO.class));
		kbsess.fireAllRules();
		
		// Harvest all the actions out of working memory
		ObjectFilter frameActionFilter = new ObjectFilter() {
			@Override
			public boolean accept(Object object) {
				return object instanceof FrameAction;
			}
		};
		Collection<FactHandle> actions = kbsess.getFactHandles(frameActionFilter);
		for (FactHandle handle : actions) {
			FrameAction action = (FrameAction) kbsess.getObject(handle);
			ctx.addAction(action);
		}
	} finally {
		// clear working memory for next transaction
		kbsess.dispose();
	}
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:27,代码来源:AdapterFrame.java

示例2: updateFact

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
   public synchronized void updateFact(Object objeto) {
       if (depuracionHechosModificados)
trazas.aceptaNuevaTraza(new InfoTraza(agentId,"MRuleEngine: new fact updated: "+ objeto,
                                              InfoTraza.NivelTraza.debug));
       
       if (objeto==null){
                   trazas.aceptaNuevaTraza(new InfoTraza(agentId, "Motor de Reglas : Se intenta insertar en el motor un objeto null : ",
                                                   InfoTraza.NivelTraza.error));
               }else {
               FactHandle fh2 = entrypoint.insert(objeto);    
               entrypoint.update(fh2,objeto);       
               kSesion.fireAllRules();
                }
     
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:17,代码来源:MotorDeReglasDroolsImp5.java

示例3: printFactHandlesMonitoring

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
private void printFactHandlesMonitoring(String str, String rule){
        Collection<FactHandle> cFH;
	    String s;
	    Iterator it;
	    cFH = kSesion.getFactHandles();
	    s = "";
	    it = cFH.iterator();
	    while( it.hasNext() ) {
		     s = s + " \n " + it.next() ;
	    }
	    
	    if (str.equals("afterActivationFired")){
	    	s = s + " \n ";
	    }
	    
	    String info = "FactHandles WM _ " + str + " dispararse la regla " + rule + 
	                  "( current size="+ kSesion.getFactHandles().size() + "): " + s + "\n";	    
	    try {
//			this.itfUsoRecursoDepuracionCognitivo.mostrarInfoAR(info);
                        trazas.aceptaNuevaTrazaActivReglas(agentId, info);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	    
	}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:26,代码来源:MotorDeReglasDroolsImp5.java

示例4: printFacts

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
public static void printFacts(StatefulKnowledgeSession ksession) {
	if (enabledDebugMode){
		for (FactHandle f: ksession.getFactHandles()){
			System.out.println("  "+ksession.getObject(f));				
		}			
	}		
}
 
开发者ID:goujonpa,项目名称:robodrools,代码行数:8,代码来源:DEBUG.java

示例5: variableChanged

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
    public void variableChanged(ReasonerVariable rVariable) {
//        Iterator<FactHandle> factIterator = session.getFactHandles().iterator();
//        while (factIterator.hasNext()) {
//            FactHandle fact = factIterator.next();
//            ReasonerVariable var = (ReasonerVariable) session.getObject(fact);
//            System.out.println(var.getName());
//        }
        FactHandle fact = null;
        try {
            if (rVariable.getParent() == null) {
                fact = session.getFactHandle(rVariable);
                session.update(fact, rVariable);
                LOGGER.debug("No parrent: " + session.getFactHandle(rVariable).toString() 
                    + " : " + rVariable.getName());               
            } else {
                fact = session.getFactHandle(rVariable.getParent());
                rVariable = rVariable.getParent();
                session.update(fact, rVariable);
                LOGGER.debug("Parent: " + session.getFactHandle(rVariable));
            }
        } finally {
            LOGGER.debug("Updating: " + rVariable.getName());
        }        
    }
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:26,代码来源:FactUpdater.java

示例6: addItem

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
public OrderLineDTO addItem(Integer itemID, BigDecimal quantity) throws TaskException {
    LOG.debug("Adding item %s q: %s", itemID, quantity);

    BasicItemManager helper = new BasicItemManager();
    OrderLineDTO oldLine = order.getLine(itemID);
    FactHandle h = null;
    if (oldLine != null) {
        h = handlers.get(oldLine);
    }
    helper.addItem(itemID, quantity, language, userId, entityId, currencyId, order, records);
    OrderLineDTO retValue = helper.getLatestLine();
    if (h != null) {
        LOG.debug("updating");
        session.update(h, retValue);
    } else {
        LOG.debug("inserting");
        handlers.put(retValue, session.insert(retValue));
    }

    LOG.debug("Now order line is %s , hash: %s", retValue, retValue.hashCode());
    return retValue;
}
 
开发者ID:maxdelo77,项目名称:replyit-master-3.2-final,代码行数:23,代码来源:RulesItemManager.java

示例7: executeStatefulRules

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
protected void executeStatefulRules(StatefulKnowledgeSession session, List context) {
    handlers = new Hashtable<Object, FactHandle>();
    for (Object o : context) {
        if (o != null) {
            LOG.debug("inserting object " + o);
            handlers.put(o, session.insert(o));
        } else {
            LOG.warn("Attempted to insert a NULL object into the working memeory");
        }

    }

    session.fireAllRules();
    session.dispose();
    handlers.clear();
    handlers = null;
}
 
开发者ID:maxdelo77,项目名称:replyit-master-3.2-final,代码行数:18,代码来源:RulesBaseTask.java

示例8: retracttFact

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
   public synchronized void retracttFact(Object objeto) {
       if (depuracionHechosModificados)
	trazas.aceptaNuevaTraza(new InfoTraza( agentId,"MRuleEngine: new fact retracted: "+ objeto,
						                    InfoTraza.NivelTraza.debug) );
                if (objeto==null){
                   trazas.aceptaNuevaTraza(new InfoTraza(agentId, "Motor de Reglas : Se intenta insertar en el motor un objeto null : ",
                                                   InfoTraza.NivelTraza.error));
               }else {
               FactHandle fh2 = entrypoint.insert(objeto);    
               entrypoint.retract(fh2);       
               kSesion.fireAllRules();
                }
       
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:16,代码来源:MotorDeReglasDroolsImp5.java

示例9: retractFactWithoutFireRules

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
    public synchronized void retractFactWithoutFireRules(Object objeto) {
        if (depuracionHechosModificados)
	trazas.aceptaNuevaTraza(new InfoTraza(agentId,"MRuleEngine: retractFactWithoutFireRules -> new fact retracted: "+ objeto,
                                                        InfoTraza.NivelTraza.debug));
        if (objeto==null){
                    trazas.aceptaNuevaTraza(new InfoTraza(agentId, "Motor de Reglas : Se intenta insertar en el motor un objeto null : ",
                                                    InfoTraza.NivelTraza.error));
                }else {
                FactHandle fh2 = entrypoint.insert(objeto);    
                entrypoint.retract(fh2);       
//                kSesion.fireAllRules();
                 }
        
	}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:16,代码来源:MotorDeReglasDroolsImp5.java

示例10: updateFactWithoutFireRules

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
    public synchronized void updateFactWithoutFireRules(Object objeto) {
    	        if (depuracionHechosModificados)  
		trazas.aceptaNuevaTraza(new InfoTraza( agentId,"MRuleEngine: updateFactWithoutFireRules-> new fact updated: "+ objeto,
                                                        InfoTraza.NivelTraza.debug));
    if (objeto==null){
                    trazas.aceptaNuevaTraza(new InfoTraza(agentId, "Motor de Reglas : Se intenta insertar en el motor un objeto null : ",
                                                    InfoTraza.NivelTraza.error));
                }else {
                FactHandle fh2 = entrypoint.insert(objeto);    
                entrypoint.update(fh2,objeto);       
//                kSesion.fireAllRules();
                 }
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:MotorDeReglasDroolsImp5.java

示例11: trazarFactHandlesForRuleDebugging

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
private void trazarFactHandlesForRuleDebugging(String ruleId,String beforOrAfterRuleActivation ){       
String infoAmostrar= "" ;
       Boolean obtenerFactHandles = false;

           if (factHandlesMonitoring_beforeActivationFired_DEBUGGING &&
               beforOrAfterRuleActivation.equals(NombresPredefinidos.DROOLS_Debugging_BEFORE_RuleFired)){
               obtenerFactHandles= true;
    	infoAmostrar = "FactHandles WM _ ANTES de  dispararse la regla " + ruleId + 
                  "( current size="+ kSesion.getFactHandles().size() + "): " +"\n";
    }else if (factHandlesMonitoring_afterActivationFired_DEBUGGING &&
               beforOrAfterRuleActivation.equals(NombresPredefinidos.DROOLS_Debugging_AFTER_RuleFired)){
               obtenerFactHandles= true;
               infoAmostrar = "FactHandles WM _ DESPUES de  dispararse la regla " + ruleId + 
                       "( current size="+ kSesion.getFactHandles().size() + "): " +"\n";
               }       
           if (obtenerFactHandles){
               Collection<FactHandle> cFH;
               Iterator it;
               cFH = kSesion.getFactHandles();
               it = cFH.iterator();
               while( it.hasNext() ) {
	     infoAmostrar = infoAmostrar + it.next()+ " \n "  ;
               }
                try {
//		this.itfUsoRecursoDepuracionCognitivo.mostrarInfoAR(infoAmostrar);
                       trazas.aceptaNuevaTrazaActivReglas(agentId, infoAmostrar);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
           }
   }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:33,代码来源:MotorDeReglasDroolsImp5.java

示例12: reinicializarSesion

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
@Override
    public void reinicializarSesion() {
//        Iterator it;
	Collection<FactHandle> cFH = kSesion.getFactHandles();
	Iterator<FactHandle>    it = cFH.iterator();
	    while( it.hasNext() ) {
                kSesion.retract(it.next());
            }
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:10,代码来源:MotorDeReglasDroolsImp5.java

示例13: loadEvents

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
public void loadEvents() {
	ScannedRobotEvent e = new ScannedRobotEvent("pepe", 100, 10, 10, 10, 10);
       FactHandle referencedFact = ksession.insert(e);
       currentReferencedFacts.add(referencedFact);
       // add more facts ....
       
       DEBUG.message("Facts in active memory");
       DEBUG.printFacts(ksession);
       ksession.fireAllRules();
       List<Action> actions = loadActions();
       DEBUG.message("Resulting actions");
       DEBUG.printActions(actions);
       
}
 
开发者ID:goujonpa,项目名称:robodrools,代码行数:15,代码来源:RulesChecker.java

示例14: cleanAnteriorFacts

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
private void cleanAnteriorFacts() {
	DEBUG.message("clean anterior facts");
    for (FactHandle referencedFact : this.currentReferencedFacts) {
        ksession.retract(referencedFact);
    }
    this.currentReferencedFacts.clear();
}
 
开发者ID:goujonpa,项目名称:robodrools,代码行数:8,代码来源:BaguetteSOLO.java

示例15: evaluate

import org.drools.runtime.rule.FactHandle; //导入依赖的package包/类
private FactHandle evaluate(StatefulKnowledgeSession ksession, FactHandle handle, Object obj) {
    if (handle == null) {
        ksession.setGlobal("delegator", new RuleTasksDelegator());
        handle = ksession.insert(obj);
    } else {
        ksession.update(handle, obj);
    }
    ksession.fireAllRules();
    if (log.isDebugEnabled()) {
        log.debug(String.format("Rule executed for: %s ", obj));
    }
    return handle;
}
 
开发者ID:apache,项目名称:stratos,代码行数:14,代码来源:ClusterMonitor.java


注:本文中的org.drools.runtime.rule.FactHandle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。