/// <summary>
        /// method compiles AndLiteralConstraint into alpha nodes
        /// </summary>
        /// <param name="cnstr">The CNSTR.</param>
        /// <param name="templ">The templ.</param>
        /// <param name="rule">The rule.</param>
        /// <returns></returns>
        public virtual BaseAlpha2 compileConstraint(AndLiteralConstraint cnstr, ITemplate templ, Rule.IRule rule)
        {
            BaseAlpha2 current = null;

            if (templ.getSlot(cnstr.Name) != null)
            {
                Slot2 sl = new Slot2(cnstr.Name);
                sl.Id = templ.getColumnIndex(cnstr.Name);
                Object sval = cnstr.Value;
                sl.Value = sval;
                if (rule.RememberMatch)
                {
                    current = new AlphaNodeAnd(engine.nextNodeId());
                }
                else
                {
                    current = new NoMemAnd(engine.nextNodeId());
                }
                current.Slot = sl;
                current.incrementUseCount();
                // we increment the node use count when when create a new
                // AlphaNode for the LiteralConstraint
                templ.getSlot(sl.Id).incrementNodeCount();
            }
            return(current);
        }
Beispiel #2
0
 /// <summary>
 /// method compiles AndLiteralConstraint into alpha nodes
 /// </summary>
 /// <param name="cnstr">The CNSTR.</param>
 /// <param name="templ">The templ.</param>
 /// <param name="rule">The rule.</param>
 /// <returns></returns>
 public virtual BaseAlpha2 compileConstraint(AndLiteralConstraint cnstr, ITemplate templ, Rule.IRule rule)
 {
     BaseAlpha2 current = null;
     if (templ.getSlot(cnstr.Name) != null)
     {
         Slot2 sl = new Slot2(cnstr.Name);
         sl.Id = templ.getColumnIndex(cnstr.Name);
         Object sval = cnstr.Value;
         sl.Value = sval;
         if (rule.RememberMatch)
         {
             current = new AlphaNodeAnd(engine.nextNodeId());
         }
         else
         {
             current = new NoMemAnd(engine.nextNodeId());
         }
         current.Slot = sl;
         current.incrementUseCount();
         // we increment the node use count when when create a new
         // AlphaNode for the LiteralConstraint
         templ.getSlot(sl.Id).incrementNodeCount();
     }
     return current;
 }