コード例 #1
0
        public bool IsMatch(Instruction instruction)
        {
            if (string.IsNullOrEmpty(Pattern))
            {
                return(false);
            }

            if (Pattern == ".") //Self, or same node
            {
                if (ContinueWith != null)
                {
                    return(ContinueWith.IsMatch(instruction));
                }
                else if (ContinueWithFunc != null)
                {
                    return(ContinueWithFunc(instruction));
                }
                else
                {
                    return(false);
                }
            }

            if (ContinueWith != null)
            {
                var result = instruction.Nearest(Pattern, Direction, Steps);
                return(ContinueWith.IsMatch(result));
            }
            else if (ContinueWithFunc != null)
            {
                var result = instruction.Nearest(Pattern, Direction, Steps);
                return(ContinueWithFunc(result));
            }
            else
            {
                return(instruction.IsNearMethod(Pattern, Direction, Steps));
            }
        }