예제 #1
0
        private ExtractedResult LastWithUri(ExtractedResult desiredUri, IList <ExtractedResult> set, ref int fromIndex)
        {
            ExtractedResult lastMatch = null;

            // Find the first Result  at fromIndex or later with a Uri *after* the desired one, saving the last Result that matched as we go
            for (; fromIndex < set.Count; ++fromIndex)
            {
                int whereCmp = WhereComparer.CompareFirstArtifactUri(set[fromIndex], desiredUri);

                if (whereCmp == 0)
                {
                    lastMatch = set[fromIndex];
                }
                else if (whereCmp > 0)
                {
                    break;
                }
            }

            // Ensure the index ends at the last match
            if (fromIndex > 0)
            {
                fromIndex--;
            }

            return(lastMatch);
        }
예제 #2
0
        private ExtractedResult FirstWithUri(ExtractedResult desiredUri, IList <ExtractedResult> set, ref int fromIndex)
        {
            // Find the first Result at fromIndex or later with a Uri *matching* the desired one, or null if there aren't any
            for (; fromIndex < set.Count; ++fromIndex)
            {
                int whereCmp = WhereComparer.CompareFirstArtifactUri(set[fromIndex], desiredUri);

                if (whereCmp == 0)
                {
                    return(set[fromIndex]);
                }
                else if (whereCmp > 0)
                {
                    break;
                }
            }

            return(null);
        }