Ejemplo n.º 1
0
        /// <summary>
        ///     Creates a copy of the rule in the designated dictionary. The namespace structure is copied over.
        ///     The new rule is set to update this one.
        /// </summary>
        /// <param name="dictionary">The target dictionary of the copy</param>
        /// <returns></returns>
        public Rule CreateRuleUpdate(Dictionary dictionary)
        {
            Rule retVal = (Rule)Duplicate();

            retVal.SetUpdateInformation(this);
            retVal.ClearAllRequirements();

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();

            if (Enclosing is NameSpace)
            {
                NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
                nameSpace.appendRules(retVal);
            }
            else
            {
                String[] nameSpaceRef = names.Take(names.Count() - 1).ToArray();

                if (EnclosingStateMachine != null)
                {
                    StateMachine stateMachine = EnclosingStateMachine.CreateSubStateMachineUpdate(dictionary);
                    stateMachine.appendRules(retVal);
                }
                else if (EnclosingStructure != null)
                {
                    NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);
                    Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace)nameSpace.Updates);
                    structure.appendRules(retVal);
                }
            }

            return(retVal);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates a rule and a rule condition in the namespace
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected RuleCondition CreateRuleAndCondition(NameSpace enclosing, string name)
        {
            Rule rule = (Rule)Factory.createRule();

            enclosing.appendRules(rule);
            rule.Name = name;
            rule.setPriority(acceptor.RulePriority.aProcessing);

            return(CreateRuleCondition(rule, name));
        }
        /// <summary>
        ///     Creates a rule and a rule condition in the namespace
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected RuleCondition CreateRuleAndCondition(NameSpace enclosing, string name)
        {
            Rule rule = (Rule) Factory.createRule();
            enclosing.appendRules(rule);
            rule.Name = name;

            return CreateRuleCondition(rule, name);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Creates a rule and a rule condition in the namespace
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected RuleCondition CreateRuleAndCondition(NameSpace enclosing, string name)
        {
            Rule rule = (Rule) Factory.createRule();
            enclosing.appendRules(rule);
            rule.Name = name;
            rule.setPriority(acceptor.RulePriority.aProcessing);

            return CreateRuleCondition(rule, name);
        }