Esempio n. 1
0
File: FTree.cs Progetto: Luxg520/L01
    public bool Process(char[] chs, int offset, ref int result)
    {
        FNode nextNode = null;

        result = -1;

        int index = offset;

        while (index < chs.Length)
        {
            ushort key = (ushort)chs[index++];

            if (nextNode == null)
            {
                nextNode = FTreeHelper.BinarySearch(key, childs);
            }
            else
            {
                nextNode = nextNode.BinarySearch(key);
            }

            if (nextNode == null)
            {
                break;
            }

            if (nextNode.terminated)
            {
                result = index;
            }
        }

        return(result != -1);
    }