Exemplo n.º 1
0
 public virtual IReturnVector executeFunction(Rete engine, IParameter[] params_Renamed)
 {
     DefaultReturnVector rv = new DefaultReturnVector();
     if (params_Renamed != null && params_Renamed.Length >= 1)
     {
         for (int idx = 0; idx < params_Renamed.Length; idx++)
         {
             if (params_Renamed[idx] is BoundParam)
             {
                 BoundParam bp = (BoundParam) params_Renamed[idx];
                 Deffact fact = (Deffact) bp.Fact;
                 try
                 {
                     if (bp.ObjectBinding)
                     {
                         engine.retractObject(fact.ObjectInstance);
                     }
                     else
                     {
                         engine.retractFact(fact);
                     }
                     DefaultReturnValue rval = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, true);
                     rv.addReturnValue(rval);
                 }
                 catch (RetractException e)
                 {
                     DefaultReturnValue rval = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, false);
                     rv.addReturnValue(rval);
                 }
             }
             else if (params_Renamed[idx] is ValueParam)
             {
                 Decimal bi = params_Renamed[idx].BigDecimalValue;
                 try
                 {
                     engine.retractById(Decimal.ToInt64(bi));
                     DefaultReturnValue rval = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, true);
                     rv.addReturnValue(rval);
                 }
                 catch (RetractException e)
                 {
                     DefaultReturnValue rval = new DefaultReturnValue(Constants.BOOLEAN_OBJECT, false);
                     rv.addReturnValue(rval);
                 }
             }
         }
     }
     return rv;
 }