コード例 #1
0
        // ----------------------------------------------------------------------
        /// Computes the type score for the given string.
        public void ComputeTypeRawScore()
        {
            var searchString = myTypeFilter.filterUpper;

            ForEach(
                l => {
                if (l is LibraryType)
                {
                    var libraryType = l as LibraryType;
                    if (myTypeFilter.filterLength == 0)
                    {
                        libraryType.rawScore     = 1f;
                        libraryType.searchLength = 0;
                    }
                    else
                    {
                        libraryType.rawScore     = FuzzyString.GetScore(searchString, libraryType.nodeName.ToUpper());
                        libraryType.searchLength = myTypeFilter.filterLength;
                    }
                    return(false);
                }
                return(true);
            }
                );
        }
コード例 #2
0
        // ----------------------------------------------------------------------
        /// Computes the member score for the given string.
        public void ComputeMemberRawScore()
        {
            var searchString = myMemberFilter.filterUpper;
            var filterLen    = myMemberFilter.filterLength;

            ForEach(
                l => {
                if (l is LibraryTypeMember)
                {
                    var libraryMember = l as LibraryObject;
                    if (filterLen == 0)
                    {
                        libraryMember.rawScore     = 1f;
                        libraryMember.searchLength = 0;
                    }
                    else
                    {
                        libraryMember.rawScore     = FuzzyString.GetScore(searchString, libraryMember.nodeName.ToUpper());
                        libraryMember.searchLength = filterLen;
                    }
                    return(false);
                }
                return(true);
            }
                );
        }
コード例 #3
0
        // ======================================================================
        // Filtering
        // ----------------------------------------------------------------------
        /// Computes the type score for the given string.
        public void ComputeNamespaceRawScore()
        {
            var searchString = myNamespaceFilter.filterUpper;

            ForEach(
                l => {
                if (l is LibraryChildNamespace)
                {
                    var libraryObject = l as LibraryObject;
                    var rootNamespace = libraryObject.parent as LibraryObject;
                    if (myNamespaceFilter.filterLength == 0)
                    {
                        libraryObject.rawScore     = 1f;
                        libraryObject.searchLength = 0;
                    }
                    else
                    {
                        var childScore             = FuzzyString.GetScore(searchString, libraryObject.nodeName.ToUpper());
                        var rootScore              = FuzzyString.GetScore(searchString, rootNamespace.nodeName.ToUpper());
                        libraryObject.rawScore     = Mathf.Max(childScore, rootScore);
                        libraryObject.searchLength = myNamespaceFilter.filterLength;
                    }
                    return(false);
                }
                return(true);
            }
                );
        }