Пример #1
0
        static public Edge Find(UserActionList theString, Dictionary <int, Edge> edges, int node, UserAction c)
        {
            int i = Hash(node, c);

            for (; ;)
            {
                if (!edges.ContainsKey(i))
                {
                    edges.Add(i, new Edge(theString));
                }
                if (edges[i].startNode == node)
                {
                    //if (c == theString[edges[i].indexOfFirstCharacter])
                    //{
                    //    return edges[i];
                    //}
                    if (c.Equals(theString[edges[i].indexOfFirstCharacter]))
                    {
                        return(edges[i]);
                    }
                }
                if (edges[i].startNode == -1)
                {
                    return(edges[i]);
                }
                i = ++i % HASH_TABLE_SIZE;
            }
            //return null;
        }