Ejemplo n.º 1
0
Archivo: FTree.cs Proyecto: 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);
    }