Source Code Cross Referenced for SimpleNode.java in  » Code-Analyzer » beautyJ » de » gulden » util » javasource » jjt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » beautyJ » de.gulden.util.javasource.jjt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
002:
003:        package de.gulden.util.javasource.jjt;
004:
005:        public class SimpleNode implements  Node {
006:            protected Node parent;
007:            protected Node[] children;
008:            protected int id;
009:            protected Parser parser;
010:
011:            public SimpleNode(int i) {
012:                id = i;
013:            }
014:
015:            public SimpleNode(Parser p, int i) {
016:                this (i);
017:                parser = p;
018:            }
019:
020:            public void jjtOpen() {
021:            }
022:
023:            public void jjtClose() {
024:            }
025:
026:            public void jjtSetParent(Node n) {
027:                parent = n;
028:            }
029:
030:            public Node jjtGetParent() {
031:                return parent;
032:            }
033:
034:            public void jjtAddChild(Node n, int i) {
035:                if (children == null) {
036:                    children = new Node[i + 1];
037:                } else if (i >= children.length) {
038:                    Node c[] = new Node[i + 1];
039:                    System.arraycopy(children, 0, c, 0, children.length);
040:                    children = c;
041:                }
042:                children[i] = n;
043:            }
044:
045:            public Node jjtGetChild(int i) {
046:                return children[i];
047:            }
048:
049:            public int jjtGetNumChildren() {
050:                return (children == null) ? 0 : children.length;
051:            }
052:
053:            /* You can override these two methods in subclasses of SimpleNode to
054:               customize the way the node appears when the tree is dumped.  If
055:               your output uses more than one line you should override
056:               toString(String), otherwise overriding toString() is probably all
057:               you need to do. */
058:
059:            public String toString() {
060:                return ParserTreeConstants.jjtNodeName[id];
061:            }
062:
063:            public String toString(String prefix) {
064:                return prefix + toString();
065:            }
066:
067:            /* Override this method if you want to customize how the node dumps
068:               out its children. */
069:
070:            public void dump(String prefix) {
071:                System.out.println(toString(prefix));
072:                if (children != null) {
073:                    for (int i = 0; i < children.length; ++i) {
074:                        SimpleNode n = (SimpleNode) children[i];
075:                        if (n != null) {
076:                            n.dump(prefix + " ");
077:                        }
078:                    }
079:                }
080:            }
081:
082:            /*** added by Jens *********************************************************/
083:
084:            private final static Node[] EMPTY = new Node[0];
085:
086:            protected String value;
087:            protected Token[] tokenRange = new Token[2];
088:            protected TextImage textImage;
089:            protected String source;
090:
091:            public int getId() {
092:                return id;
093:            }
094:
095:            /**
096:             * Get first child with id.
097:             */
098:            public Node getChild(int id) {
099:                if (children != null) {
100:                    for (int i = 0; i < children.length; i++) {
101:                        if (children[i].getId() == id) {
102:                            return children[i];
103:                        }
104:                    }
105:                }
106:                return null;
107:            }
108:
109:            public boolean hasChild(int id) {
110:                return (getChild(id) != null);
111:            }
112:
113:            public Node[] getChildren(int id) {
114:                if (children != null) {
115:                    java.util.Vector v = new java.util.Vector(5);
116:                    for (int i = 0; i < children.length; i++) {
117:                        if (children[i].getId() == id) {
118:                            v.addElement(children[i]);
119:                        }
120:                    }
121:                    Node[] n = new Node[v.size()];
122:                    v.copyInto(n);
123:                    return n;
124:                } else {
125:                    return EMPTY;
126:                }
127:            }
128:
129:            public Node[] getAllChildren() {
130:                if (children != null) {
131:                    return children;
132:                } else {
133:                    return EMPTY;
134:                }
135:            }
136:
137:            public String getValue() {
138:                return value;
139:            }
140:
141:            public void setValue(String v) {
142:                //System.out.print(v+" ");  	
143:                value = v;
144:            }
145:
146:            public String getName() {
147:                Node node = getChild(ParserTreeConstants.JJT_NAME);
148:                if (node != null) {
149:                    return node.retrieveName();
150:                } else {
151:                    return null;
152:                }
153:            }
154:
155:            public String retrieveName() {
156:                String name;
157:                int num = jjtGetNumChildren();
158:                if (num == 1) // optimization: single child node _IDENTIFIER
159:                {
160:                    Node n = jjtGetChild(0);
161:                    name = n.getValue();
162:                } else // general case: name identifiers joined by dots
163:                {
164:                    StringBuffer sb = new StringBuffer();
165:                    for (int i = 0; i < num; i += 2) {
166:                        //Node child=node.jjtGetChild(i).getValue();
167:                        String n = jjtGetChild(i).getValue();
168:                        sb.append(n);
169:                        if (i + 1 < num) {
170:                            // next one must be _DOT
171:                            sb.append(".");
172:                        }
173:                    }
174:                    name = sb.toString();
175:                }
176:                return name;
177:            }
178:
179:            public void setStartToken(Token t) {
180:                tokenRange[0] = t;
181:            }
182:
183:            public void setEndToken(Token t) {
184:                tokenRange[1] = t;
185:            }
186:
187:            public Token getStartToken() {
188:                return tokenRange[0];
189:            }
190:
191:            public Token getEndToken() {
192:                return tokenRange[1];
193:            }
194:
195:            public void setTextImage(TextImage ti) {
196:                textImage = ti;
197:            }
198:
199:            public TextImage getTextImage() {
200:                return textImage;
201:            }
202:
203:            public String getSource() {
204:                return source;
205:            }
206:
207:            public void setSource(String source) {
208:                this .source = source;
209:            }
210:
211:            public int[] getSourcePosition() {
212:                int[] pos = { getStartToken().beginLine,
213:                        getStartToken().beginColumn };
214:                return pos;
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.