示例#1
0
 /// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node.
 /// It uses the globally declared prevCE and prevJoinNode
 /// </summary>
 public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule)
 {
     TestCondition tc = (TestCondition) condition;
     ShellFunction fn = (ShellFunction) tc.Function;
     fn.lookUpFunction(ruleCompiler.Engine);
     IParameter[] oldpm = fn.Parameters;
     IParameter[] pms = new IParameter[oldpm.Length];
     for (int ipm = 0; ipm < pms.Length; ipm++)
     {
         if (oldpm[ipm] is ValueParam)
         {
             pms[ipm] = ((ValueParam) oldpm[ipm]).cloneParameter();
         }
         else if (oldpm[ipm] is BoundParam)
         {
             BoundParam bpm = (BoundParam) oldpm[ipm];
             // now we need to resolve and setup the BoundParam
             Binding b = rule.getBinding(bpm.VariableName);
             BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding);
             newpm.VariableName = bpm.VariableName;
             pms[ipm] = newpm;
         }
     }
     BaseJoin joinNode = null;
     if (tc.Negated)
     {
         joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     else
     {
         joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     ((TestNode) joinNode).lookUpFunction(ruleCompiler.Engine);
     return joinNode;
 }
示例#2
0
        /// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node.
        /// It uses the globally declared prevCE and prevJoinNode
        /// </summary>
        public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule)
        {
            TestCondition tc = (TestCondition)condition;
            ShellFunction fn = (ShellFunction)tc.Function;

            fn.lookUpFunction(ruleCompiler.Engine);
            IParameter[] oldpm = fn.Parameters;
            IParameter[] pms   = new IParameter[oldpm.Length];
            for (int ipm = 0; ipm < pms.Length; ipm++)
            {
                if (oldpm[ipm] is ValueParam)
                {
                    pms[ipm] = ((ValueParam)oldpm[ipm]).cloneParameter();
                }
                else if (oldpm[ipm] is BoundParam)
                {
                    BoundParam bpm = (BoundParam)oldpm[ipm];
                    // now we need to resolve and setup the BoundParam
                    Binding    b     = rule.getBinding(bpm.VariableName);
                    BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding);
                    newpm.VariableName = bpm.VariableName;
                    pms[ipm]           = newpm;
                }
            }
            BaseJoin joinNode = null;

            if (tc.Negated)
            {
                joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
            }
            else
            {
                joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
            }
            ((TestNode)joinNode).lookUpFunction(ruleCompiler.Engine);
            return(joinNode);
        }