Beispiel #1
0
        public void AddEdge(String p_characters, int p_targetIndex)
        {
            if (p_characters.Equals(""))
            {
                FAEdge edge = new FAEdge(p_characters, p_targetIndex);
                m_edges.Add(edge);
            }
            else
            {
                int index = -1;
                int edgeCount = m_edges.Count;
				
                // find the edge with the specified index
                for (int n = 0; (n < edgeCount) && (index == -1); n++)
                {
                    FAEdge edge = (FAEdge)m_edges[n];
                    if (edge.TargetIndex == p_targetIndex)
                        index = n;
                }
				
                // if not found, create a new edge
                if (index == -1)
                {
                    FAEdge edge = new FAEdge(p_characters, p_targetIndex);
                    m_edges.Add(edge);
                }
                    // else add the characters to the existing edge
                else
                {
                    FAEdge edge = (FAEdge)m_edges[index];
                    edge.AddCharacters(p_characters);
                }
            }
        }
Beispiel #2
0
        public void AddEdge(String p_characters, int p_targetIndex)
        {
            if (p_characters.Equals(""))
            {
                FAEdge edge = new FAEdge(p_characters, p_targetIndex);
                m_edges.Add(edge);
            }
            else
            {
                int index     = -1;
                int edgeCount = m_edges.Count;

                // find the edge with the specified index
                for (int n = 0; (n < edgeCount) && (index == -1); n++)
                {
                    FAEdge edge = (FAEdge)m_edges[n];
                    if (edge.TargetIndex == p_targetIndex)
                    {
                        index = n;
                    }
                }

                // if not found, create a new edge
                if (index == -1)
                {
                    FAEdge edge = new FAEdge(p_characters, p_targetIndex);
                    m_edges.Add(edge);
                }
                // else add the characters to the existing edge
                else
                {
                    FAEdge edge = (FAEdge)m_edges[index];
                    edge.AddCharacters(p_characters);
                }
            }
        }