Ejemplo n.º 1
0
        override protected List <PossibleMatch> ImplementMatch(PossibleMatch State, MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            R.AddRange(Sub.Match(State, Context));
            if (R.Count == 0)
            {
                throw new CommandParser.MatchAborted(Message);
            }
            return(R);
        }
Ejemplo n.º 2
0
        public List <PossibleMatch> Match(PossibleMatch State, MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            R.AddRange(Sub.Match(State, Context));
            if (R.Count == 0)
            {
                R.Add(State);
            }
            return(R);
        }
Ejemplo n.º 3
0
        override protected List <PossibleMatch> ImplementMatch(PossibleMatch State, MatchContext Context)
        {
            var R = new List <PossibleMatch>();

            if (String.IsNullOrEmpty(BooleanProperty))
            {
                R.AddRange(Sub.Match(State, Context));
                if (R.Count == 0)
                {
                    R.Add(State);
                }
            }
            else
            {
                R.AddRange(Sub.Match(State, Context).Select(s => s.With(BooleanProperty, true)));
                if (R.Count == 0)
                {
                    R.Add(State.With(BooleanProperty, false));
                }
            }
            return(R);
        }
Ejemplo n.º 4
0
        public List <PossibleMatch> Match(PossibleMatch State, MatchContext Context)
        {
            var r = Sub.Match(State, Context);
            var highestScoreFound = MatchPreference.VeryUnlikely;

            foreach (var match in r)
            {
                var score = GetScore(match, ScoreArgument);
                if (score > highestScoreFound)
                {
                    highestScoreFound = score;
                }
            }
            return(new List <PossibleMatch>(r.Where(m => highestScoreFound == GetScore(m, ScoreArgument))));
        }