Ejemplo n.º 1
0
        public static Better GetBetterCandidate(ApplicableFunction left, ApplicableFunction right)
        {
            if (!ArrayUtils.Equals(left.paramsSignature, right.paramsSignature))
            {
                throw new InvalidOperationException();
            }

            int leftBetter = 0, rightBetter = 0;

            for (int i = 0; i < left.appliedSignature.Length; i++)
            {
                Better better = GetBetterConversion(left.paramsSignature[i], left.appliedSignature[i], right.appliedSignature[i]);
                if (better == Better.Left)
                {
                    leftBetter++;
                }
                else if (better == Better.Right)
                {
                    rightBetter++;
                }

                if (leftBetter != 0 && rightBetter != 0)
                {
                    return(0);
                }
            }

            if (leftBetter > 0)
            {
                return(Better.Left);
            }
            if (rightBetter > 0)
            {
                return(Better.Right);
            }
            return(Better.Neither);
        }
Ejemplo n.º 2
0
 public bool SignatureEquals(ApplicableFunction other)
 {
     return(ArrayUtils.Equals(appliedSignature, other.appliedSignature));
 }