Пример #1
0
        private static List getNextGrammarNodesWithWords(GrammarNode grammarNode)
        {
            ArrayList arrayList = new ArrayList();

            GrammarArc[] successors = grammarNode.getSuccessors();
            int          num        = successors.Length;

            for (int i = 0; i < num; i++)
            {
                GrammarArc  grammarArc   = successors[i];
                GrammarNode grammarNode2 = grammarArc.getGrammarNode();
                if (grammarNode2.getAlternatives().Length == 0)
                {
                    if (grammarNode2.isFinalNode())
                    {
                        arrayList.add(grammarNode2);
                    }
                    else
                    {
                        arrayList.addAll(GrammarPoint.getNextGrammarNodesWithWords(grammarNode2));
                    }
                }
                else
                {
                    arrayList.add(grammarNode2);
                }
            }
            return(arrayList);
        }
Пример #2
0
        private static void addNextGrammarPointsWithWords(GrammarNode grammarNode, List list)
        {
            Iterator iterator = GrammarPoint.getNextGrammarNodesWithWords(grammarNode).iterator();

            while (iterator.hasNext())
            {
                GrammarNode grammarNode2 = (GrammarNode)iterator.next();
                for (int i = 0; i < grammarNode2.getAlternatives().Length; i++)
                {
                    GrammarPoint grammarPoint = new GrammarPoint(grammarNode2, i, 0, 0, 0);
                    list.add(grammarPoint);
                }
            }
        }