Exemplo n.º 1
0
        public IEntity ResolveCallableReference(NodeCollection args, IEntity[] candidates)
        {
            _scores.Clear();

            CalculateScores(candidates, args);

            if (1 == _scores.Count)
            {
                return(((CallableScore)_scores[0]).Entity);
            }

            if (_scores.Count > 1)
            {
                CallableScore score = GetBiggerScore();
                if (null != score)
                {
                    return(score.Entity);
                }

                ReScoreByHierarchyDepth();
                score = GetBiggerScore();
                if (null != score)
                {
                    return(score.Entity);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
            override public bool Equals(object other)
            {
                CallableScore score = other as CallableScore;

                return(null == score
                                        ? false
                                        : Entity == score.Entity);
            }
Exemplo n.º 3
0
        CallableScore GetBiggerScore()
        {
            _scores.Sort();
            CallableScore first  = (CallableScore)_scores[0];
            CallableScore second = (CallableScore)_scores[1];

            return(first.Score > second.Score
                                ? first
                                : null);
        }