KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > process > extended > NonterminalStackNode


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 package net.sourceforge.chaperon.process.extended;
10
11 import net.sourceforge.chaperon.model.extended.Pattern;
12
13 public class NonterminalStackNode extends StackNode
14 {
15   public StackNodeList definition = null;
16
17   public NonterminalStackNode(StackNodeList definition, Pattern pattern, StackNode ancestor)
18   {
19     this.definition = definition;
20     this.pattern = pattern;
21     this.ancestor = ancestor;
22
23     if (definition!=null)
24     {
25       for (StackNodeList list = definition; list!=null; list = list.next)
26         if (list.next==null)
27           this.last = list.node.last;
28     }
29     else
30       this.last = ancestor.last;
31   }
32
33   public String JavaDoc getText()
34   {
35     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
36     for (StackNodeList list = definition; list!=null; list = list.next)
37       buffer.append(list.node.getText());
38
39     return buffer.toString();
40   }
41 }
42
Popular Tags