Esempio 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);
        }
Esempio n. 2
0
            override public bool Equals(object other)
            {
                CallableScore score = other as CallableScore;

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

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