/// <summary>
        /// method compiles OrLiteralConstraint 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(OrLiteralConstraint 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 AlphaNodeOr(engine.nextNodeId());
                }
                else
                {
                    current = new NoMemOr(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);
        }
Example #2
0
        /// <summary> A convienance method to clone slots
        /// </summary>
        public Object Clone()
        {
            Slot2 newslot = new Slot2();

            newslot.Id           = Id;
            newslot.Name         = Name;
            newslot.EqualList    = (EqualList);
            newslot.NotEqualList = (NotEqualList);
            newslot.ValueType    = ValueType;
            return(newslot);
        }
Example #3
0
 /// <summary>
 /// method compiles OrLiteralConstraint 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(OrLiteralConstraint 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 AlphaNodeOr(engine.nextNodeId());
         }
         else
         {
             current = new NoMemOr(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;
 }
Example #4
0
 /// <summary> A convienance method to clone slots
 /// </summary>
 public Object Clone()
 {
     Slot2 newslot = new Slot2();
     newslot.Id = Id;
     newslot.Name = Name;
     newslot.EqualList = (EqualList);
     newslot.NotEqualList = (NotEqualList);
     newslot.ValueType = ValueType;
     return newslot;
 }