Esempio n. 1
0
        private IQueryNode ApplyModifier(IQueryNode node, IQueryNode parent)
        {
            if (this.usingAnd)
            {
                if (parent is OrQueryNode)
                {
                    if (node is ModifierQueryNode)
                    {
                        ModifierQueryNode modNode = (ModifierQueryNode)node;

                        if (modNode.Modifier == Modifier.MOD_REQ)
                        {
                            return(modNode.GetChild());
                        }
                    }
                }
                else
                {
                    if (node is ModifierQueryNode)
                    {
                        ModifierQueryNode modNode = (ModifierQueryNode)node;

                        if (modNode.Modifier == Modifier.MOD_NONE)
                        {
                            return(new BooleanModifierNode(modNode.GetChild(), Modifier.MOD_REQ));
                        }
                    }
                    else
                    {
                        return(new BooleanModifierNode(node, Modifier.MOD_REQ));
                    }
                }
            }
            else
            {
                if (node.Parent is AndQueryNode)
                {
                    if (node is ModifierQueryNode)
                    {
                        ModifierQueryNode modNode = (ModifierQueryNode)node;

                        if (modNode.Modifier == Modifier.MOD_NONE)
                        {
                            return(new BooleanModifierNode(modNode.GetChild(), Modifier.MOD_REQ));
                        }
                    }
                    else
                    {
                        return(new BooleanModifierNode(node, Modifier.MOD_REQ));
                    }
                }
            }

            return(node);
        }
Esempio n. 2
0
        private IQueryNode ApplyModifier(IQueryNode node, Modifier mod)
        {
            // check if modifier is not already defined and is default
            if (!(node is ModifierQueryNode))
            {
                return(new ModifierQueryNode(node, mod));
            }
            else
            {
                ModifierQueryNode modNode = (ModifierQueryNode)node;

                if (modNode.Modifier == Modifier.MOD_NONE)
                {
                    return(new ModifierQueryNode(modNode.GetChild(), mod));
                }
            }

            return(node);
        }