< T > int _findMapping ( T aNeedle , List < T > aMappings , Object aLineName , Object aColumnName , BinarySearch . Comparator < T > aComparator , BinarySearch . Bias aBias ) { // To return the position we are searching for, we must first find the // mapping for the given position and then return the opposite position it // points to. Because the mappings are sorted, we can use binary search to // find the best mapping. // if (aNeedle[aLineName] <= 0) { // throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]); // } // if (aNeedle[aColumnName] < 0) { // throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]); // } return BinarySearch . search ( aNeedle , aMappings , aComparator , aBias ) ; }
Find the mapping that best matches the hypothetical needle mapping that we are searching for in the given haystack of mappings .