예제 #1
0
파일: Node.cs 프로젝트: thisiscam/formula
        /// <summary>
        /// Returns true if this node satisfies the atomic predicate.
        /// </summary>
        protected virtual bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (pred.PredicateKind == NodePredicateKind.False ||
                (pred.TargetKind != NodeKind.AnyNodeKind && pred.TargetKind != NodeKind))
            {
                return(false);
            }

            if (pred.ChildContext != ChildContextKind.AnyChildContext && pred.ChildContext != context)
            {
                return(false);
            }

            if (pred.ChildContext == ChildContextKind.AnyChildContext &&
                (absPos < pred.ChildIndexLower || absPos > pred.ChildIndexUpper))
            {
                return(false);
            }

            if (pred.ChildContext != ChildContextKind.AnyChildContext &&
                (relPos < pred.ChildIndexLower || relPos > pred.ChildIndexUpper))
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        protected override bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (!base.EvalAtom(pred, context, absPos, relPos))
            {
                return(false);
            }

            return(pred.AttributePredicate == null ? true : pred.AttributePredicate(AttributeKind.Name, Name));
        }
예제 #3
0
        protected override bool EvalAtom(ASTQueries.NodePredAtom pred, ChildContextKind context, int absPos, int relPos)
        {
            if (!base.EvalAtom(pred, context, absPos, relPos))
            {
                return(false);
            }

            if (pred.AttributePredicate == null)
            {
                return(true);
            }

            return(pred.AttributePredicate(AttributeKind.Raw, Raw) &&
                   pred.AttributePredicate(AttributeKind.CnstKind, CnstKind));
        }