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); }
override public bool Equals(object other) { CallableScore score = other as CallableScore; return(null == score ? false : Entity == score.Entity); }
CallableScore GetBiggerScore() { _scores.Sort(); CallableScore first = (CallableScore)_scores[0]; CallableScore second = (CallableScore)_scores[1]; return(first.Score > second.Score ? first : null); }