Source Code Cross Referenced for LineCountVisitor.java in  » UML » jrefactory » org » acm » seguin » summary » 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 » UML » jrefactory » org.acm.seguin.summary 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* ====================================================================
0002:         * The JRefactory License, Version 1.0
0003:         *
0004:         * Copyright (c) 2001 JRefactory.  All rights reserved.
0005:         *
0006:         * Redistribution and use in source and binary forms, with or without
0007:         * modification, are permitted provided that the following conditions
0008:         * are met:
0009:         *
0010:         * 1. Redistributions of source code must retain the above copyright
0011:         *    notice, this list of conditions and the following disclaimer.
0012:         *
0013:         * 2. Redistributions in binary form must reproduce the above copyright
0014:         *    notice, this list of conditions and the following disclaimer in
0015:         *    the documentation and/or other materials provided with the
0016:         *    distribution.
0017:         *
0018:         * 3. The end-user documentation included with the redistribution,
0019:         *    if any, must include the following acknowledgment:
0020:         *       "This product includes software developed by the
0021:         *        JRefactory (http://www.sourceforge.org/projects/jrefactory)."
0022:         *    Alternately, this acknowledgment may appear in the software itself,
0023:         *    if and wherever such third-party acknowledgments normally appear.
0024:         *
0025:         * 4. The names "JRefactory" must not be used to endorse or promote
0026:         *    products derived from this software without prior written
0027:         *    permission. For written permission, please contact seguin@acm.org.
0028:         *
0029:         * 5. Products derived from this software may not be called "JRefactory",
0030:         *    nor may "JRefactory" appear in their name, without prior written
0031:         *    permission of Chris Seguin.
0032:         *
0033:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0034:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0035:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0036:         * DISCLAIMED.  IN NO EVENT SHALL THE CHRIS SEGUIN OR
0037:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0038:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0039:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0040:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0041:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0042:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0043:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0044:         * SUCH DAMAGE.
0045:         * ====================================================================
0046:         *
0047:         * This software consists of voluntary contributions made by many
0048:         * individuals on behalf of JRefactory.  For more information on
0049:         * JRefactory, please see
0050:         * <http://www.sourceforge.org/projects/jrefactory>.
0051:         */
0052:        package org.acm.seguin.summary;
0053:
0054:        import net.sourceforge.jrefactory.parser.JavaParserVisitor;
0055:        import net.sourceforge.jrefactory.ast.Node;
0056:        import net.sourceforge.jrefactory.parser.Token;
0057:        import net.sourceforge.jrefactory.ast.SimpleNode;
0058:        import net.sourceforge.jrefactory.ast.ASTInterfaceBody;
0059:        import net.sourceforge.jrefactory.ast.ASTTryStatement;
0060:        import net.sourceforge.jrefactory.ast.ASTSynchronizedStatement;
0061:        import net.sourceforge.jrefactory.ast.ASTThrowStatement;
0062:        import net.sourceforge.jrefactory.ast.ASTReturnStatement;
0063:        import net.sourceforge.jrefactory.ast.ASTForUpdate;
0064:        import net.sourceforge.jrefactory.ast.ASTStatementExpressionList;
0065:        import net.sourceforge.jrefactory.ast.ASTForInit;
0066:        import net.sourceforge.jrefactory.ast.ASTForStatement;
0067:        import net.sourceforge.jrefactory.ast.ASTDoStatement;
0068:        import net.sourceforge.jrefactory.ast.ASTWhileStatement;
0069:        import net.sourceforge.jrefactory.ast.ASTIfStatement;
0070:        import net.sourceforge.jrefactory.ast.ASTSwitchLabel;
0071:        import net.sourceforge.jrefactory.ast.ASTSwitchStatement;
0072:        import net.sourceforge.jrefactory.ast.ASTEmptyStatement;
0073:        import net.sourceforge.jrefactory.ast.ASTBlockStatement;
0074:        import net.sourceforge.jrefactory.ast.ASTBlock;
0075:        import net.sourceforge.jrefactory.ast.ASTStatement;
0076:        import net.sourceforge.jrefactory.ast.ASTAllocationExpression;
0077:        import net.sourceforge.jrefactory.ast.ASTArgumentList;
0078:        import net.sourceforge.jrefactory.ast.ASTArguments;
0079:        import net.sourceforge.jrefactory.ast.ASTNullLiteral;
0080:        import net.sourceforge.jrefactory.ast.ASTPrimaryExpression;
0081:        import net.sourceforge.jrefactory.ast.ASTCastExpression;
0082:        import net.sourceforge.jrefactory.ast.ASTPreDecrementExpression;
0083:        import net.sourceforge.jrefactory.ast.ASTPreIncrementExpression;
0084:        import net.sourceforge.jrefactory.ast.ASTInstanceOfExpression;
0085:        import net.sourceforge.jrefactory.ast.ASTAndExpression;
0086:        import net.sourceforge.jrefactory.ast.ASTExclusiveOrExpression;
0087:        import net.sourceforge.jrefactory.ast.ASTInclusiveOrExpression;
0088:        import net.sourceforge.jrefactory.ast.ASTConditionalAndExpression;
0089:        import net.sourceforge.jrefactory.ast.ASTConditionalOrExpression;
0090:        import net.sourceforge.jrefactory.ast.ASTConditionalExpression;
0091:        import net.sourceforge.jrefactory.ast.ASTExpression;
0092:        import net.sourceforge.jrefactory.ast.ASTNameList;
0093:        import net.sourceforge.jrefactory.ast.ASTResultType;
0094:        import net.sourceforge.jrefactory.ast.ASTFormalParameters;
0095:        import net.sourceforge.jrefactory.ast.ASTVariableInitializer;
0096:        import net.sourceforge.jrefactory.ast.ASTVariableDeclarator;
0097:        import net.sourceforge.jrefactory.ast.ASTInterfaceMemberDeclaration;
0098:        import net.sourceforge.jrefactory.ast.ASTClassBodyDeclaration;
0099:        import net.sourceforge.jrefactory.ast.ASTClassBody;
0100:        import net.sourceforge.jrefactory.ast.ASTTypeDeclaration;
0101:        import net.sourceforge.jrefactory.ast.ASTCompilationUnit;
0102:        import net.sourceforge.jrefactory.ast.ASTPackageDeclaration;
0103:        import net.sourceforge.jrefactory.ast.ASTArrayInitializer;
0104:        import net.sourceforge.jrefactory.ast.ASTContinueStatement;
0105:        import net.sourceforge.jrefactory.ast.ASTBreakStatement;
0106:        import net.sourceforge.jrefactory.ast.ASTStatementExpression;
0107:        import net.sourceforge.jrefactory.ast.ASTLocalVariableDeclaration;
0108:        import net.sourceforge.jrefactory.ast.ASTBooleanLiteral;
0109:        import net.sourceforge.jrefactory.ast.ASTPrimarySuffix;
0110:        import net.sourceforge.jrefactory.ast.ASTPrimaryPrefix;
0111:        import net.sourceforge.jrefactory.ast.ASTPostfixExpression;
0112:        import net.sourceforge.jrefactory.ast.ASTUnaryExpressionNotPlusMinus;
0113:        import net.sourceforge.jrefactory.ast.ASTUnaryExpression;
0114:        import net.sourceforge.jrefactory.ast.ASTMultiplicativeExpression;
0115:        import net.sourceforge.jrefactory.ast.ASTAdditiveExpression;
0116:        import net.sourceforge.jrefactory.ast.ASTShiftExpression;
0117:        import net.sourceforge.jrefactory.ast.ASTRelationalExpression;
0118:        import net.sourceforge.jrefactory.ast.ASTEqualityExpression;
0119:        import net.sourceforge.jrefactory.ast.ASTAssignmentOperator;
0120:        import net.sourceforge.jrefactory.ast.ASTPrimitiveType;
0121:        import net.sourceforge.jrefactory.ast.ASTType;
0122:        import net.sourceforge.jrefactory.ast.ASTInitializer;
0123:        import net.sourceforge.jrefactory.ast.ASTExplicitConstructorInvocation;
0124:        import net.sourceforge.jrefactory.ast.ASTFormalParameter;
0125:        import net.sourceforge.jrefactory.ast.ASTFieldDeclaration;
0126:        import net.sourceforge.jrefactory.ast.ASTNestedInterfaceDeclaration;
0127:        import net.sourceforge.jrefactory.ast.ASTMethodDeclaration;
0128:        import net.sourceforge.jrefactory.ast.ASTInterfaceDeclaration;
0129:        import net.sourceforge.jrefactory.ast.ASTNestedClassDeclaration;
0130:        import net.sourceforge.jrefactory.ast.ASTVariableDeclaratorId;
0131:        import net.sourceforge.jrefactory.ast.ASTImportDeclaration;
0132:        import net.sourceforge.jrefactory.ast.ASTConstructorDeclaration;
0133:        import net.sourceforge.jrefactory.ast.ASTUnmodifiedInterfaceDeclaration;
0134:        import net.sourceforge.jrefactory.ast.ASTUnmodifiedClassDeclaration;
0135:        import net.sourceforge.jrefactory.ast.ASTLiteral;
0136:        import net.sourceforge.jrefactory.ast.ASTClassDeclaration;
0137:        import net.sourceforge.jrefactory.ast.ASTMethodDeclarator;
0138:        import net.sourceforge.jrefactory.ast.ASTLabeledStatement;
0139:        import net.sourceforge.jrefactory.ast.ASTArrayDimsAndInits;
0140:        import net.sourceforge.jrefactory.ast.ASTName;
0141:        import net.sourceforge.jrefactory.parser.JavaParserConstants;
0142:        import org.acm.seguin.util.FileSettings;
0143:        import org.acm.seguin.util.MissingSettingsException;
0144:        import net.sourceforge.jrefactory.ast.ASTAssertionStatement;
0145:
0146:        import net.sourceforge.jrefactory.ast.ASTTypeParameterList;
0147:        import net.sourceforge.jrefactory.ast.ASTTypeParameter;
0148:        import net.sourceforge.jrefactory.ast.ASTTypeArguments;
0149:        import net.sourceforge.jrefactory.ast.ASTReferenceTypeList;
0150:        import net.sourceforge.jrefactory.ast.ASTReferenceType;
0151:        import net.sourceforge.jrefactory.ast.ASTClassOrInterfaceType;
0152:        import net.sourceforge.jrefactory.ast.ASTActualTypeArgument;
0153:        import net.sourceforge.jrefactory.ast.ASTTypeParameters;
0154:        import net.sourceforge.jrefactory.ast.ASTGenericNameList;
0155:        import net.sourceforge.jrefactory.ast.ASTEnumDeclaration;
0156:        import net.sourceforge.jrefactory.ast.ASTEnumElement;
0157:        import net.sourceforge.jrefactory.ast.ASTIdentifier;
0158:        import net.sourceforge.jrefactory.ast.ASTAnnotation;
0159:        import net.sourceforge.jrefactory.ast.ASTMemberValuePairs;
0160:        import net.sourceforge.jrefactory.ast.ASTMemberValuePair;
0161:        import net.sourceforge.jrefactory.ast.ASTMemberValue;
0162:        import net.sourceforge.jrefactory.ast.ASTMemberValueArrayInitializer;
0163:        import net.sourceforge.jrefactory.ast.ASTAnnotationTypeDeclaration;
0164:        import net.sourceforge.jrefactory.ast.ASTAnnotationTypeMemberDeclaration;
0165:        import net.sourceforge.jrefactory.ast.ASTAnnotationMethodDeclaration;
0166:        import net.sourceforge.jrefactory.ast.ASTConstantDeclaration;
0167:        import net.sourceforge.jrefactory.ast.ASTAnnotation;
0168:        import net.sourceforge.jrefactory.ast.Node;
0169:        import net.sourceforge.jrefactory.ast.ASTJSPBody;
0170:
0171:        import java.io.*;
0172:        import java.util.Enumeration;
0173:
0174:        /**
0175:         *  This object counts the lines and labels them with specific data
0176:         *
0177:         *@author     Chris Seguin
0178:         *@author     Mike Atkinson
0179:         *@created    March 4, 1999
0180:         */
0181:        public class LineCountVisitor implements  JavaParserVisitor {
0182:            //  Instance Variables
0183:            private int lineCount;
0184:
0185:            /**
0186:             *  Constructor for the LineCountVisitor object
0187:             */
0188:            public LineCountVisitor() {
0189:                lineCount = 1;
0190:            }
0191:
0192:            /**
0193:             *  Description of the Method
0194:             *
0195:             *@param  node  Description of Parameter
0196:             *@param  data  Description of Parameter
0197:             *@return       Description of the Returned Value
0198:             */
0199:            public Object visit(SimpleNode node, Object data) {
0200:                node.childrenAccept(this , data);
0201:                return data;
0202:            }
0203:
0204:            /**
0205:             *  Description of the Method
0206:             *
0207:             *@param  node  Description of Parameter
0208:             *@param  data  Description of Parameter
0209:             *@return       Description of the Returned Value
0210:             */
0211:            public Object visit(ASTJSPBody node, Object data) {
0212:                node.childrenAccept(this , data);
0213:                return data;
0214:            }
0215:
0216:            public Object visit(ASTTypeParameterList node, Object data) {
0217:                int countChildren = node.jjtGetNumChildren();
0218:                for (int ndx = 0; ndx < countChildren; ndx++) {
0219:                    if (ndx > 0) {
0220:                        countLines(node.getSpecial("comma." + (ndx - 1)));
0221:                    }
0222:                    node.jjtGetChild(ndx).jjtAccept(this , data);
0223:                }
0224:                return data;
0225:            }
0226:
0227:            public Object visit(ASTTypeParameter node, Object data) {
0228:                int countChildren = node.jjtGetNumChildren();
0229:                for (int ndx = 0; ndx < countChildren; ndx++) {
0230:                    if (ndx == 1) {
0231:                        countLines(node.getSpecial("extends." + (ndx - 1)));
0232:                    }
0233:                    if (ndx > 1) {
0234:                        countLines(node.getSpecial("and." + (ndx - 1)));
0235:                    }
0236:                    node.jjtGetChild(ndx).jjtAccept(this , data);
0237:                }
0238:                return data;
0239:            }
0240:
0241:            public Object visit(ASTTypeArguments node, Object data) {
0242:                countLines(node.getSpecial("<."));
0243:                int countChildren = node.jjtGetNumChildren();
0244:                for (int ndx = 0; ndx < countChildren; ndx++) {
0245:                    if (ndx > 0) {
0246:                        countLines(node.getSpecial("comma." + (ndx - 1)));
0247:                    }
0248:                    node.jjtGetChild(ndx).jjtAccept(this , data);
0249:                }
0250:                countLines(node.getSpecial(">."));
0251:                return data;
0252:            }
0253:
0254:            public Object visit(ASTReferenceTypeList node, Object data) {
0255:                countLines(node.getSpecial("<."));
0256:                int countChildren = node.jjtGetNumChildren();
0257:                for (int ndx = 0; ndx < countChildren; ndx++) {
0258:                    if (ndx > 0) {
0259:                        countLines(node.getSpecial("comma." + (ndx - 1)));
0260:                    }
0261:                    Node child = node.jjtGetChild(ndx);
0262:                    child.jjtAccept(this , data);
0263:                }
0264:                countLines(node.getSpecial(">."));
0265:                return data;
0266:            }
0267:
0268:            public Object visit(ASTReferenceType node, Object data) {
0269:                node.childrenAccept(this , data); //  Traverse the children
0270:                //  Add the array
0271:                int count = node.getArrayCount();
0272:                for (int ndx = 0; ndx < count; ndx++) {
0273:                    countLines(node.getSpecial("[." + ndx));
0274:                    countLines(node.getSpecial("]." + ndx));
0275:                }
0276:                return data;
0277:            }
0278:
0279:            public Object visit(ASTClassOrInterfaceType node, Object data) {
0280:                node.childrenAccept(this , data); //  Traverse the children
0281:                //  Add the array
0282:                int count = node.getNameSize();
0283:                for (int ndx = 0; ndx < count; ndx++) {
0284:                    countLines(node.getSpecial("period." + ndx));
0285:                }
0286:                return data;
0287:            }
0288:
0289:            public Object visit(ASTActualTypeArgument node, Object data) {
0290:                countLines(node.getSpecial("?"));
0291:                countLines(node.getSpecial("extends"));
0292:                countLines(node.getSpecial("super"));
0293:                node.childrenAccept(this , data); //  Traverse the children
0294:                return data;
0295:            }
0296:
0297:            public Object visit(ASTTypeParameters node, Object data) {
0298:                countLines(node.getSpecial("<"));
0299:                node.childrenAccept(this , data); //  Traverse the children
0300:                countLines(node.getSpecial(">"));
0301:                return data;
0302:            }
0303:
0304:            public Object visit(ASTGenericNameList node, Object data) {
0305:                //  Traverse the children
0306:                int countChildren = node.jjtGetNumChildren();
0307:                for (int ndx = 0; ndx < countChildren; ndx++) {
0308:                    Node child = node.jjtGetChild(ndx);
0309:                    if (ndx > 0 && child instanceof  ASTClassOrInterfaceType) {
0310:                        countLines(node.getSpecial("comma." + (ndx - 1)));
0311:                    }
0312:                    child.jjtAccept(this , data);
0313:                }
0314:                return data;//  Return the data
0315:            }
0316:
0317:            public Object visit(ASTEnumDeclaration node, Object data) {
0318:                countLines(node.getSpecial("static"));
0319:                countLines(node.getSpecial("final"));
0320:                countLines(node.getSpecial("public"));
0321:                countLines(node.getSpecial("protected"));
0322:                countLines(node.getSpecial("private"));
0323:                countLines(node.getSpecial("@"));
0324:
0325:                countLines(node.getSpecial("enum"));
0326:                int childNo = node.skipAnnotations();
0327:                Node child = node.jjtGetFirstChild();
0328:                child.jjtAccept(this , data);
0329:                child = node.jjtGetChild(++childNo);
0330:                if (child instanceof  ASTGenericNameList) {
0331:                    countLines(node.getSpecial("implements"));
0332:                    child.jjtAccept(this , data);
0333:                    child = node.jjtGetChild(++childNo);
0334:                }
0335:
0336:                countLines(node.getSpecial("begin"));
0337:                int countChildren = node.jjtGetNumChildren();
0338:                for (int ndx = childNo; ndx < countChildren; ndx++) {
0339:                    if (node.jjtGetChild(ndx) instanceof  ASTEnumElement) {
0340:                        if (ndx > childNo) {
0341:                            countLines(node.getSpecial("comma."
0342:                                    + (ndx - childNo)));
0343:                        }
0344:                    }
0345:                    child = node.jjtGetChild(ndx);
0346:                    child.jjtAccept(this , data);
0347:                }
0348:                countLines(node.getSpecial("end"));
0349:
0350:                return data;
0351:            }
0352:
0353:            public Object visit(ASTEnumElement node, Object data) {
0354:                countLines(node.getSpecial("id"));
0355:                node.childrenAccept(this , data); //  Traverse the children
0356:                return data;
0357:            }
0358:
0359:            public Object visit(ASTIdentifier node, Object data) {
0360:                countLines(node.getSpecial("id"));
0361:                return data;
0362:            }
0363:
0364:            public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
0365:                countLines(node.getSpecial("public"));
0366:                countLines(node.getSpecial("abstract"));
0367:                countLines(node.getSpecial("strictfp"));
0368:                countLines(node.getSpecial("@"));
0369:                countLines(node.getSpecial("interface"));
0370:                countLines(node.getSpecial("{"));
0371:                node.childrenAccept(this , data); //  Traverse the children
0372:                countLines(node.getSpecial("}"));
0373:                return data;
0374:            }
0375:
0376:            public Object visit(ASTAnnotationTypeMemberDeclaration node,
0377:                    Object data) {
0378:                node.childrenAccept(this , data); //  Traverse the children
0379:                return data;
0380:            }
0381:
0382:            public Object visit(ASTAnnotationMethodDeclaration node, Object data) {
0383:                countLines(node.getSpecial("public"));
0384:                countLines(node.getSpecial("abstract"));
0385:                Node type = node.jjtGetFirstChild();
0386:                type.jjtAccept(this , data);
0387:                Node id = node.jjtGetChild(1);
0388:                id.jjtAccept(this , data);
0389:                countLines(node.getSpecial("("));
0390:                countLines(node.getSpecial(")"));
0391:                if (node.jjtGetNumChildren() > 2) {
0392:                    countLines(node.getSpecial("default"));
0393:                    Node next = node.jjtGetChild(2);
0394:                    next.jjtAccept(this , data);
0395:                }
0396:                countLines(node.getSpecial("semicolon"));
0397:                return data;
0398:            }
0399:
0400:            public Object visit(ASTConstantDeclaration node, Object data) {
0401:                countLines(node.getSpecial("public"));
0402:                countLines(node.getSpecial("static"));
0403:                countLines(node.getSpecial("final"));
0404:                Node type = node.jjtGetFirstChild();
0405:                type.jjtAccept(this , data);
0406:                Node var = node.jjtGetChild(1);
0407:                var.jjtAccept(this , data);
0408:                int lastIndex = node.jjtGetNumChildren();
0409:                for (int ndx = 2; ndx < lastIndex; ndx++) {
0410:                    Node next = node.jjtGetChild(ndx);
0411:                    next.jjtAccept(this , data);
0412:                    if (ndx < lastIndex - 1) {
0413:                        countLines(node.getSpecial("comma." + (ndx - 2)));
0414:                    }
0415:                }
0416:                countLines(node.getSpecial("semicolon"));
0417:                return data;
0418:            }
0419:
0420:            public Object visit(ASTAnnotation node, Object data) {
0421:                Node id = node.jjtGetFirstChild();
0422:                id.jjtAccept(this , data);
0423:                countLines(node.getSpecial("begin"));
0424:                int lastIndex = node.jjtGetNumChildren();
0425:                for (int ndx = 1; ndx < lastIndex; ndx++) {
0426:                    Node next = node.jjtGetChild(ndx);
0427:                    next.jjtAccept(this , data);
0428:                }
0429:                countLines(node.getSpecial("end"));
0430:                return data;
0431:            }
0432:
0433:            public Object visit(ASTMemberValuePairs node, Object data) {
0434:                node.childrenAccept(this , data); //  Traverse the children
0435:                int lastIndex = node.jjtGetNumChildren();
0436:                for (int ndx = 0; ndx < lastIndex; ndx++) {
0437:                    Node next = node.jjtGetChild(ndx);
0438:                    next.jjtAccept(this , data);
0439:                    if (ndx < lastIndex - 1) {
0440:                        countLines(node.getSpecial("comma." + ndx));
0441:                    }
0442:                }
0443:                return data;
0444:            }
0445:
0446:            public Object visit(ASTMemberValuePair node, Object data) {
0447:                Node id = node.jjtGetFirstChild();
0448:                id.jjtAccept(this , data);
0449:                countLines(node.getSpecial("="));
0450:                Node value = node.jjtGetChild(1);
0451:                id.jjtAccept(this , data);
0452:                return data;
0453:            }
0454:
0455:            public Object visit(ASTMemberValue node, Object data) {
0456:                countLines(node.getSpecial("@"));
0457:                node.childrenAccept(this , data); //  Traverse the children
0458:                return data;
0459:            }
0460:
0461:            public Object visit(ASTMemberValueArrayInitializer node, Object data) {
0462:                countLines(node.getSpecial("{"));
0463:                node.childrenAccept(this , data); //  Traverse the children
0464:                int lastIndex = node.jjtGetNumChildren();
0465:                for (int ndx = 0; ndx < lastIndex; ndx++) {
0466:                    Node next = node.jjtGetChild(ndx);
0467:                    next.jjtAccept(this , data);
0468:                    if (ndx < lastIndex - 1) {
0469:                        countLines(node.getSpecial("comma." + ndx));
0470:                    }
0471:                }
0472:                countLines(node.getSpecial("}"));
0473:                return data;
0474:            }
0475:
0476:            /**
0477:             *  Description of the Method
0478:             *
0479:             *@param  node  Description of Parameter
0480:             *@param  data  Description of Parameter
0481:             *@return       Description of the Returned Value
0482:             */
0483:            public Object visit(ASTCompilationUnit node, Object data) {
0484:                //  Accept the children
0485:                node.childrenAccept(this , data);
0486:
0487:                //  Visit EOF special token
0488:                countLines(node.getSpecial("EOF"));
0489:
0490:                //  Return the data
0491:                return data;
0492:            }
0493:
0494:            /**
0495:             *  Description of the Method
0496:             *
0497:             *@param  node  Description of Parameter
0498:             *@param  data  Description of Parameter
0499:             *@return       Description of the Returned Value
0500:             */
0501:            public Object visit(ASTPackageDeclaration node, Object data) {
0502:                //  Print any tokens
0503:                countLines(node.getSpecial("package"));
0504:
0505:                //  Traverse the children
0506:                node.childrenAccept(this , data);
0507:
0508:                //  Print any final tokens
0509:                countLines(node.getSpecial("semicolon"));
0510:
0511:                //  Return the data
0512:                return data;
0513:            }
0514:
0515:            /**
0516:             *  Description of the Method
0517:             *
0518:             *@param  node  Description of Parameter
0519:             *@param  data  Description of Parameter
0520:             *@return       Description of the Returned Value
0521:             */
0522:            public Object visit(ASTImportDeclaration node, Object data) {
0523:
0524:                //  Print any tokens
0525:                countLines(node.getSpecial("import"));
0526:                countLines(node.getSpecial("static")); // JDK1.5 static imports
0527:
0528:                //  Traverse the children
0529:                node.childrenAccept(this , data);
0530:
0531:                //  Print any final tokens
0532:                if (node.isImportingPackage()) {
0533:                    countLines(node.getSpecial("period"));
0534:                    countLines(node.getSpecial("star"));
0535:                    countLines(node.getSpecial("semicolon"));
0536:                } else {
0537:                    countLines(node.getSpecial("semicolon"));
0538:                }
0539:
0540:                //  Return the data
0541:                return data;
0542:            }
0543:
0544:            /**
0545:             *  Description of the Method
0546:             *
0547:             *@param  node  Description of Parameter
0548:             *@param  data  Description of Parameter
0549:             *@return       Description of the Returned Value
0550:             */
0551:            public Object visit(ASTTypeDeclaration node, Object data) {
0552:                if (node.hasAnyChildren()) {
0553:                    node.childrenAccept(this , data);
0554:                } else {
0555:                    countLines(node.getSpecial("semicolon"));
0556:                }
0557:                return data;
0558:            }
0559:
0560:            /**
0561:             *  Visit a class declaration
0562:             *
0563:             *@param  node  the class declaration
0564:             *@param  data  the print data
0565:             *@return       the result of visiting this node
0566:             */
0567:            public Object visit(ASTClassDeclaration node, Object data) {
0568:
0569:                //  Print any tokens
0570:                countLines(node.getSpecial("final"));
0571:                countLines(node.getSpecial("public"));
0572:                countLines(node.getSpecial("strictfp"));
0573:                countLines(node.getSpecial("abstract"));
0574:
0575:                //  Get the child
0576:                SimpleNode child = (SimpleNode) node.jjtGetFirstChild();
0577:                countLines(child.getSpecial("class"));
0578:
0579:                //  Traverse the children
0580:                node.childrenAccept(this , data);
0581:
0582:                //  Return the data
0583:                return data;
0584:            }
0585:
0586:            /**
0587:             *  Description of the Method
0588:             *
0589:             *@param  node  Description of Parameter
0590:             *@param  data  Description of Parameter
0591:             *@return       Description of the Returned Value
0592:             */
0593:            public Object visit(ASTUnmodifiedClassDeclaration node, Object data) {
0594:
0595:                //  Print any tokens
0596:                countLines(node.getSpecial("id"));
0597:
0598:                //  Traverse the children
0599:                int lastIndex = node.jjtGetNumChildren();
0600:                for (int ndx = 0; ndx < lastIndex; ndx++) {
0601:                    Node next = node.jjtGetChild(ndx);
0602:                    if (next instanceof  ASTClassOrInterfaceType) {
0603:                        countLines(node.getSpecial("extends"));
0604:                        next.jjtAccept(this , data);
0605:                    } else if (next instanceof  ASTGenericNameList) {
0606:                        countLines(node.getSpecial("implements"));
0607:                        next.jjtAccept(this , data);
0608:                    } else {
0609:                        next.jjtAccept(this , data);
0610:                    }
0611:                }
0612:
0613:                //  Return the data
0614:                return data;
0615:            }
0616:
0617:            /**
0618:             *  Description of the Method
0619:             *
0620:             *@param  node  Description of Parameter
0621:             *@param  data  Description of Parameter
0622:             *@return       Description of the Returned Value
0623:             */
0624:            public Object visit(ASTClassBody node, Object data) {
0625:                //  Print any tokens
0626:                countLines(node.getSpecial("begin"));
0627:
0628:                //  Traverse the children
0629:                node.childrenAccept(this , data);
0630:
0631:                //  Print any tokens
0632:                countLines(node.getSpecial("end"));
0633:
0634:                //  Return the data
0635:                return data;
0636:            }
0637:
0638:            /**
0639:             *  Description of the Method
0640:             *
0641:             *@param  node  Description of Parameter
0642:             *@param  data  Description of Parameter
0643:             *@return       Description of the Returned Value
0644:             */
0645:            public Object visit(ASTNestedClassDeclaration node, Object data) {
0646:
0647:                //  Print any tokens
0648:                countLines(node.getSpecial("final"));
0649:                countLines(node.getSpecial("public"));
0650:                countLines(node.getSpecial("protected"));
0651:                countLines(node.getSpecial("private"));
0652:                countLines(node.getSpecial("abstract"));
0653:                countLines(node.getSpecial("static"));
0654:                countLines(node.getSpecial("strictfp"));
0655:
0656:                //  Get the child
0657:                SimpleNode child = (SimpleNode) node.jjtGetFirstChild();
0658:                countLines(child.getSpecial("class"));
0659:
0660:                //  Traverse the children
0661:                node.childrenAccept(this , data);
0662:
0663:                //  Return the data
0664:                return data;
0665:            }
0666:
0667:            /**
0668:             *  Description of the Method
0669:             *
0670:             *@param  node  Description of Parameter
0671:             *@param  data  Description of Parameter
0672:             *@return       Description of the Returned Value
0673:             */
0674:            public Object visit(ASTClassBodyDeclaration node, Object data) {
0675:                node.childrenAccept(this , data);
0676:                return data;
0677:            }
0678:
0679:            /**
0680:             *  Description of the Method
0681:             *
0682:             *@param  node  Description of Parameter
0683:             *@param  data  Description of Parameter
0684:             *@return       Description of the Returned Value
0685:             */
0686:            public Object visit(ASTInterfaceDeclaration node, Object data) {
0687:
0688:                //  Print any special tokens
0689:                countLines(node.getSpecial("public"));
0690:                countLines(node.getSpecial("abstract"));
0691:                countLines(node.getSpecial("strictfp"));
0692:                countLines(node.getSpecial("@"));
0693:
0694:                //  Get the child
0695:                int childNo = node.skipAnnotations();
0696:                Node child = node.jjtGetChild(childNo);
0697:                countLines(((SimpleNode) child).getSpecial("interface"));
0698:
0699:                //  Traverse the children
0700:                node.childrenAccept(this , data);
0701:
0702:                //  Return the data
0703:                return data;
0704:            }
0705:
0706:            /**
0707:             *  Description of the Method
0708:             *
0709:             *@param  node  Description of Parameter
0710:             *@param  data  Description of Parameter
0711:             *@return       Description of the Returned Value
0712:             */
0713:            public Object visit(ASTNestedInterfaceDeclaration node, Object data) {
0714:
0715:                //  Print any tokens
0716:                countLines(node.getSpecial("static"));
0717:                countLines(node.getSpecial("abstract"));
0718:                countLines(node.getSpecial("strictfp"));
0719:                countLines(node.getSpecial("final"));
0720:                countLines(node.getSpecial("public"));
0721:                countLines(node.getSpecial("protected"));
0722:                countLines(node.getSpecial("private"));
0723:
0724:                //  Get the child
0725:                SimpleNode child = (SimpleNode) node.jjtGetFirstChild();
0726:                countLines(child.getSpecial("interface"));
0727:
0728:                //  Traverse the children
0729:                node.childrenAccept(this , data);
0730:
0731:                //  Finish this interface
0732:                //  Return the data
0733:                return data;
0734:            }
0735:
0736:            /**
0737:             *  Description of the Method
0738:             *
0739:             *@param  node  Description of Parameter
0740:             *@param  data  Description of Parameter
0741:             *@return       Description of the Returned Value
0742:             */
0743:            public Object visit(ASTUnmodifiedInterfaceDeclaration node,
0744:                    Object data) {
0745:                //  Local Variables
0746:                boolean first = true;
0747:
0748:                //  Print any tokens
0749:                countLines(node.getSpecial("id"));
0750:
0751:                //  Traverse the children
0752:                int nextIndex = 0;
0753:                Node next = node.jjtGetChild(nextIndex);
0754:                if (next instanceof  ASTGenericNameList) {
0755:                    countLines(node.getSpecial("extends"));
0756:                    next.jjtAccept(this , data);
0757:
0758:                    //  Get the next node
0759:                    nextIndex++;
0760:                    next = node.jjtGetChild(nextIndex);
0761:                }
0762:
0763:                //  Handle the interface body
0764:                next.jjtAccept(this , data);
0765:
0766:                //  Return the data
0767:                return data;
0768:            }
0769:
0770:            /**
0771:             *  Description of the Method
0772:             *
0773:             *@param  node  Description of Parameter
0774:             *@param  data  Description of Parameter
0775:             *@return       Description of the Returned Value
0776:             */
0777:            public Object visit(ASTInterfaceBody node, Object data) {
0778:                countLines(node.getSpecial("begin")); //  Begin the block
0779:                node.childrenAccept(this , data); //  Travers the children
0780:                countLines(node.getSpecial("end")); //  End the block
0781:                return data; //  Return the data
0782:            }
0783:
0784:            /**
0785:             *  Description of the Method
0786:             *
0787:             *@param  node  Description of Parameter
0788:             *@param  data  Description of Parameter
0789:             *@return       Description of the Returned Value
0790:             */
0791:            public Object visit(ASTInterfaceMemberDeclaration node, Object data) {
0792:                node.childrenAccept(this , data);
0793:                return data;
0794:            }
0795:
0796:            /**
0797:             *  Description of the Method
0798:             *
0799:             *@param  node  Description of Parameter
0800:             *@param  data  Description of Parameter
0801:             *@return       Description of the Returned Value
0802:             */
0803:            public Object visit(ASTFieldDeclaration node, Object data) {
0804:                //  Print any tokens
0805:                countLines(node.getSpecial("static"));
0806:                countLines(node.getSpecial("transient"));
0807:                countLines(node.getSpecial("volatile"));
0808:                countLines(node.getSpecial("strictfp"));
0809:                countLines(node.getSpecial("final"));
0810:                countLines(node.getSpecial("public"));
0811:                countLines(node.getSpecial("protected"));
0812:                countLines(node.getSpecial("private"));
0813:                countLines(node.getSpecial("@"));
0814:
0815:                //  Handle the first two children (which are required)
0816:                int childNo = 0;
0817:                Node next = node.jjtGetFirstChild();
0818:                next.jjtAccept(this , data);
0819:                while (next instanceof  ASTAnnotation) {
0820:                    next = node.jjtGetChild(++childNo);
0821:                    next.jjtAccept(this , data);
0822:                }
0823:                next = node.jjtGetChild(++childNo);
0824:                next.jjtAccept(this , data);
0825:
0826:                //  Traverse the rest of the children
0827:                for (int ndx = childNo + 1; ndx < node.jjtGetNumChildren(); ndx++) {
0828:                    countLines(node.getSpecial("comma." + (ndx - childNo - 1)));
0829:                    next = node.jjtGetChild(ndx);
0830:                    next.jjtAccept(this , data);
0831:                }
0832:
0833:                //  Finish the entry
0834:                countLines(node.getSpecial("semicolon"));
0835:
0836:                //  Return the data
0837:                return data;
0838:            }
0839:
0840:            /**
0841:             *  Description of the Method
0842:             *
0843:             *@param  node  Description of Parameter
0844:             *@param  data  Description of Parameter
0845:             *@return       Description of the Returned Value
0846:             */
0847:            public Object visit(ASTVariableDeclarator node, Object data) {
0848:
0849:                //  Handle the first child (which is required)
0850:                Node next = node.jjtGetFirstChild();
0851:                next.jjtAccept(this , data);
0852:
0853:                //  Traverse the rest of the children
0854:                if (node.jjtGetNumChildren() > 1) {
0855:                    countLines(node.getSpecial("equals"));
0856:                    next = node.jjtGetChild(1);
0857:                    next.jjtAccept(this , data);
0858:                }
0859:
0860:                //  Return the data
0861:                return data;
0862:            }
0863:
0864:            /**
0865:             *  Description of the Method
0866:             *
0867:             *@param  node  Description of Parameter
0868:             *@param  data  Description of Parameter
0869:             *@return       Description of the Returned Value
0870:             */
0871:            public Object visit(ASTVariableDeclaratorId node, Object data) {
0872:
0873:                //  Handle the first child (which is required)
0874:                countLines(node.getSpecial("id"));
0875:                int last = node.getArrayCount();
0876:                for (int ndx = 0; ndx < last; ndx++) {
0877:                    countLines(node.getSpecial("[." + ndx));
0878:                    countLines(node.getSpecial("]." + ndx));
0879:                }
0880:
0881:                //  Return the data
0882:                return data;
0883:            }
0884:
0885:            /**
0886:             *  Description of the Method
0887:             *
0888:             *@param  node  Description of Parameter
0889:             *@param  data  Description of Parameter
0890:             *@return       Description of the Returned Value
0891:             */
0892:            public Object visit(ASTVariableInitializer node, Object data) {
0893:                node.childrenAccept(this , data);
0894:                return data;
0895:            }
0896:
0897:            /**
0898:             *  Description of the Method
0899:             *
0900:             *@param  node  Description of Parameter
0901:             *@param  data  Description of Parameter
0902:             *@return       Description of the Returned Value
0903:             */
0904:            public Object visit(ASTArrayInitializer node, Object data) {
0905:
0906:                //  Handle the first child (which is required)
0907:                countLines(node.getSpecial("begin"));
0908:                int last = node.jjtGetNumChildren();
0909:                for (int ndx = 0; ndx < last; ndx++) {
0910:                    if (ndx > 0) {
0911:                        countLines(node.getSpecial("comma." + (ndx - 1)));
0912:                    }
0913:                    Node child = node.jjtGetChild(ndx);
0914:                    child.jjtAccept(this , data);
0915:                }
0916:                if (node.isFinalComma()) {
0917:                    countLines(node.getSpecial("comma." + (last - 1)));
0918:                }
0919:                countLines(node.getSpecial("end"));
0920:
0921:                //  Return the data
0922:                return data;
0923:            }
0924:
0925:            /**
0926:             *  Pretty prints the method declaration
0927:             *
0928:             *@param  node  the node in the parse tree
0929:             *@param  data  the print data
0930:             *@return       the print data
0931:             */
0932:            public Object visit(ASTMethodDeclaration node, Object data) {
0933:                //  Print any tokens
0934:                countLines(node.getSpecial("public"));
0935:                countLines(node.getSpecial("protected"));
0936:                countLines(node.getSpecial("private"));
0937:                countLines(node.getSpecial("static"));
0938:                countLines(node.getSpecial("abstract"));
0939:                countLines(node.getSpecial("final"));
0940:                countLines(node.getSpecial("native"));
0941:                countLines(node.getSpecial("strictfp"));
0942:                countLines(node.getSpecial("synchronized"));
0943:                countLines(node.getSpecial("@"));
0944:                int childNo = node.skipAnnotationsAndTypeParameters();
0945:                Node child = node.jjtGetChild(childNo);
0946:                countLines(getInitialToken((ASTResultType) child));
0947:
0948:                //  Handle the first two/three children (which are required)
0949:                childNo = 0;
0950:                Node next = node.jjtGetFirstChild();
0951:                next.jjtAccept(this , data);
0952:                while (next instanceof  ASTAnnotation) {
0953:                    next = node.jjtGetChild(++childNo);
0954:                    next.jjtAccept(this , data);
0955:                }
0956:                if (next instanceof  ASTTypeParameters) {
0957:                    next = node.jjtGetChild(++childNo);
0958:                    next.jjtAccept(this , data);
0959:                }
0960:
0961:                next = node.jjtGetChild(++childNo);
0962:                next.jjtAccept(this , data);
0963:
0964:                //  Traverse the rest of the children
0965:                int lastIndex = node.jjtGetNumChildren();
0966:                boolean foundBlock = false;
0967:                for (int ndx = childNo + 1; ndx < lastIndex; ndx++) {
0968:                    next = node.jjtGetChild(ndx);
0969:                    if (next instanceof  ASTNameList) {
0970:                        countLines(node.getSpecial("throws"));
0971:                        next.jjtAccept(this , data);
0972:                    } else if (next instanceof  ASTBlock) {
0973:                        foundBlock = true;
0974:                        next.jjtAccept(this , data);
0975:                    }
0976:                }
0977:
0978:                //  Finish if it is abstract
0979:                if (!foundBlock) {
0980:                    countLines(node.getSpecial("semicolon"));
0981:                }
0982:
0983:                //  Note the end of the method
0984:                //  Return the data
0985:                return data;
0986:            }
0987:
0988:            /**
0989:             *  Description of the Method
0990:             *
0991:             *@param  node  Description of Parameter
0992:             *@param  data  Description of Parameter
0993:             *@return       Description of the Returned Value
0994:             */
0995:            public Object visit(ASTMethodDeclarator node, Object data) {
0996:                //  Handle the first child (which is required)
0997:                countLines(node.getSpecial("id"));
0998:                node.childrenAccept(this , data);
0999:
1000:                int last = node.getArrayCount();
1001:                for (int ndx = 0; ndx < last; ndx++) {
1002:                    countLines(node.getSpecial("[." + ndx));
1003:                    countLines(node.getSpecial("]." + ndx));
1004:                }
1005:
1006:                //  Return the data
1007:                return data;
1008:            }
1009:
1010:            /**
1011:             *  Description of the Method
1012:             *
1013:             *@param  node  Description of Parameter
1014:             *@param  data  Description of Parameter
1015:             *@return       Description of the Returned Value
1016:             */
1017:            public Object visit(ASTFormalParameters node, Object data) {
1018:
1019:                //  Print any tokens
1020:                countLines(node.getSpecial("begin"));
1021:
1022:                //  Traverse the children
1023:                Node next;
1024:                int lastIndex = node.jjtGetNumChildren();
1025:                for (int ndx = 0; ndx < lastIndex; ndx++) {
1026:                    if (ndx > 0) {
1027:                        countLines(node.getSpecial("comma." + (ndx - 1)));
1028:                    }
1029:                    next = node.jjtGetChild(ndx);
1030:                    next.jjtAccept(this , data);
1031:                }
1032:
1033:                //  Finish it
1034:                countLines(node.getSpecial("end"));
1035:
1036:                //  Return the data
1037:                return data;
1038:            }
1039:
1040:            /**
1041:             *  Description of the Method
1042:             *
1043:             *@param  node  Description of Parameter
1044:             *@param  data  Description of Parameter
1045:             *@return       Description of the Returned Value
1046:             */
1047:            public Object visit(ASTFormalParameter node, Object data) {
1048:
1049:                //  Print any tokens
1050:                if (node.isUsingFinal()) {
1051:                    countLines(node.getSpecial("final"));
1052:                    countLines(node.getSpecial("@"));
1053:                }
1054:
1055:                //  Traverse the children
1056:                int childNo = 0;
1057:                Node next = node.jjtGetFirstChild();
1058:                next.jjtAccept(this , data);
1059:                while (next instanceof  ASTAnnotation) {
1060:                    next = node.jjtGetChild(++childNo);
1061:                    next.jjtAccept(this , data);
1062:                }
1063:                next = node.jjtGetChild(childNo + 1);
1064:                next.jjtAccept(this , data);
1065:
1066:                //  Return the data
1067:                return data;
1068:            }
1069:
1070:            /**
1071:             *  Description of the Method
1072:             *
1073:             *@param  node  Description of Parameter
1074:             *@param  data  Description of Parameter
1075:             *@return       Description of the Returned Value
1076:             */
1077:            public Object visit(ASTConstructorDeclaration node, Object data) {
1078:
1079:                //  Print any tokens
1080:                countLines(node.getSpecial("public"));
1081:                countLines(node.getSpecial("protected"));
1082:                countLines(node.getSpecial("private"));
1083:                countLines(node.getSpecial("id"));
1084:                countLines(node.getSpecial("@"));
1085:
1086:                //  Handle the first child (which is required)
1087:                int childNo = 0;
1088:                Node child = node.jjtGetFirstChild();
1089:                while (child instanceof  ASTAnnotation) {
1090:                    child.jjtAccept(this , data);
1091:                    child = node.jjtGetChild(++childNo);
1092:                }
1093:                if (child instanceof  ASTTypeParameters) {
1094:                    child.jjtAccept(this , data);
1095:                    child = node.jjtGetChild(++childNo);
1096:                }
1097:                child.jjtAccept(this , data);
1098:
1099:                //  Get the last index
1100:                int lastIndex = node.jjtGetNumChildren();
1101:                int startAt = childNo + 1;
1102:
1103:                //  Handle the name list if it is present
1104:                if (lastIndex > 1) {
1105:                    child = node.jjtGetChild(startAt);
1106:                    if (child instanceof  ASTNameList) {
1107:                        countLines(node.getSpecial("throws"));
1108:                        child.jjtAccept(this , data);
1109:                        startAt++;
1110:                    }
1111:                }
1112:
1113:                //  Print the starting block
1114:                countLines(node.getSpecial("begin"));
1115:
1116:                //  Traverse the rest of the children
1117:                boolean foundBlock = false;
1118:                for (int ndx = startAt; ndx < lastIndex; ndx++) {
1119:                    child = node.jjtGetChild(ndx);
1120:                    child.jjtAccept(this , data);
1121:                }
1122:
1123:                //  Print the end block
1124:                countLines(node.getSpecial("end"));
1125:
1126:                //  Return the data
1127:                return data;
1128:            }
1129:
1130:            /**
1131:             *  Description of the Method
1132:             *
1133:             *@param  node  Description of Parameter
1134:             *@param  data  Description of Parameter
1135:             *@return       Description of the Returned Value
1136:             */
1137:            public Object visit(ASTExplicitConstructorInvocation node,
1138:                    Object data) {
1139:
1140:                //  Print the name of the node
1141:                int startWith = 0;
1142:                if (node.jjtGetFirstChild() instanceof  ASTPrimaryExpression) {
1143:                    node.jjtGetFirstChild().jjtAccept(this , data);
1144:                    startWith++;
1145:                    countLines(node.getSpecial("."));
1146:                }
1147:                countLines(node.getSpecial("explicit"));
1148:
1149:                //  Traverse the children
1150:                int last = node.jjtGetNumChildren();
1151:                for (int ndx = startWith; ndx < last; ndx++) {
1152:                    node.jjtGetChild(ndx).jjtAccept(this , data);
1153:                }
1154:
1155:                //  End of the line
1156:                countLines(node.getSpecial("semicolon"));
1157:
1158:                //  Return the data
1159:                return data;
1160:            }
1161:
1162:            /**
1163:             *  Formats the initializer
1164:             *
1165:             *@param  node  The initializer node
1166:             *@param  data  The print data
1167:             *@return       Nothing interesting
1168:             */
1169:            public Object visit(ASTInitializer node, Object data) {
1170:
1171:                //  Print the name of the node
1172:                if (node.isUsingStatic()) {
1173:                    countLines(node.getSpecial("static"));
1174:                }
1175:
1176:                node.childrenAccept(this , data); //  Traverse the children
1177:                return data; //  Return the data
1178:            }
1179:
1180:            /**
1181:             *  Description of the Method
1182:             *
1183:             *@param  node  Description of Parameter
1184:             *@param  data  Description of Parameter
1185:             *@return       Description of the Returned Value
1186:             */
1187:            public Object visit(ASTType node, Object data) {
1188:                node.childrenAccept(this , data); //  Traverse the children
1189:                return data; //  Return the data
1190:            }
1191:
1192:            /**
1193:             *  Description of the Method
1194:             *
1195:             *@param  node  Description of Parameter
1196:             *@param  data  Description of Parameter
1197:             *@return       Description of the Returned Value
1198:             */
1199:            public Object visit(ASTPrimitiveType node, Object data) {
1200:                countLines(node.getSpecial("primitive")); //  Print the name of the node
1201:                return data; //  Return the data
1202:            }
1203:
1204:            /**
1205:             *  Description of the Method
1206:             *
1207:             *@param  node  Description of Parameter
1208:             *@param  data  Description of Parameter
1209:             *@return       Description of the Returned Value
1210:             */
1211:            public Object visit(ASTResultType node, Object data) {
1212:
1213:                //  Traverse the children
1214:                if (node.hasAnyChildren()) {
1215:                    node.childrenAccept(this , data);
1216:                } else {
1217:                    countLines(node.getSpecial("primitive"));
1218:                }
1219:
1220:                return data; //  Return the data
1221:            }
1222:
1223:            /**
1224:             *  Description of the Method
1225:             *
1226:             *@param  node  Description of Parameter
1227:             *@param  data  Description of Parameter
1228:             *@return       Description of the Returned Value
1229:             */
1230:            public Object visit(ASTName node, Object data) {
1231:
1232:                //  Print the name of the node
1233:                int size = node.getNameSize();
1234:                for (int ndx = 0; ndx < size; ndx++) {
1235:                    if (ndx > 0) {
1236:                        countLines(node.getSpecial("period" + ndx));
1237:                    }
1238:                    countLines(node.getSpecial("id" + ndx));
1239:                }
1240:
1241:                return data; //  Return the data
1242:            }
1243:
1244:            /**
1245:             *  Description of the Method
1246:             *
1247:             *@param  node  Description of Parameter
1248:             *@param  data  Description of Parameter
1249:             *@return       Description of the Returned Value
1250:             */
1251:            public Object visit(ASTNameList node, Object data) {
1252:
1253:                //  Traverse the children
1254:                int countChildren = node.jjtGetNumChildren();
1255:                for (int ndx = 0; ndx < countChildren; ndx++) {
1256:                    if (ndx > 0) {
1257:                        countLines(node.getSpecial("comma." + (ndx - 1)));
1258:                    }
1259:                    Node child = node.jjtGetChild(ndx);
1260:                    child.jjtAccept(this , data);
1261:                }
1262:
1263:                //  Return the data
1264:                return data;
1265:            }
1266:
1267:            /**
1268:             *  Description of the Method
1269:             *
1270:             *@param  node  Description of Parameter
1271:             *@param  data  Description of Parameter
1272:             *@return       Description of the Returned Value
1273:             */
1274:            public Object visit(ASTExpression node, Object data) {
1275:                node.childrenAccept(this , data);
1276:                return data;
1277:            }
1278:
1279:            /**
1280:             *  Description of the Method
1281:             *
1282:             *@param  node  Description of Parameter
1283:             *@param  data  Description of Parameter
1284:             *@return       Description of the Returned Value
1285:             */
1286:            public Object visit(ASTAssignmentOperator node, Object data) {
1287:
1288:                //  Print the name of the node
1289:                countLines(node.getSpecial("operator"));
1290:
1291:                //  Return the data
1292:                return data;
1293:            }
1294:
1295:            /**
1296:             *  Description of the Method
1297:             *
1298:             *@param  node  Description of Parameter
1299:             *@param  data  Description of Parameter
1300:             *@return       Description of the Returned Value
1301:             */
1302:            public Object visit(ASTConditionalExpression node, Object data) {
1303:
1304:                //  Traverse the children
1305:                int childCount = node.jjtGetNumChildren();
1306:                if (childCount == 1) {
1307:                    node.jjtGetFirstChild().jjtAccept(this , data);
1308:                } else {
1309:                    node.jjtGetFirstChild().jjtAccept(this , data);
1310:                    countLines(node.getSpecial("?"));
1311:                    node.jjtGetChild(1).jjtAccept(this , data);
1312:                    countLines(node.getSpecial(":"));
1313:                    node.jjtGetChild(2).jjtAccept(this , data);
1314:                }
1315:
1316:                //  Return the data
1317:                return data;
1318:            }
1319:
1320:            /**
1321:             *  Description of the Method
1322:             *
1323:             *@param  node  Description of Parameter
1324:             *@param  data  Description of Parameter
1325:             *@return       Description of the Returned Value
1326:             */
1327:            public Object visit(ASTConditionalOrExpression node, Object data) {
1328:                return binaryExpression(node, "||", data);
1329:            }
1330:
1331:            /**
1332:             *  Description of the Method
1333:             *
1334:             *@param  node  Description of Parameter
1335:             *@param  data  Description of Parameter
1336:             *@return       Description of the Returned Value
1337:             */
1338:            public Object visit(ASTConditionalAndExpression node, Object data) {
1339:                return binaryExpression(node, "&&", data);
1340:            }
1341:
1342:            /**
1343:             *  Description of the Method
1344:             *
1345:             *@param  node  Description of Parameter
1346:             *@param  data  Description of Parameter
1347:             *@return       Description of the Returned Value
1348:             */
1349:            public Object visit(ASTInclusiveOrExpression node, Object data) {
1350:                return binaryExpression(node, "|", data);
1351:            }
1352:
1353:            /**
1354:             *  Description of the Method
1355:             *
1356:             *@param  node  Description of Parameter
1357:             *@param  data  Description of Parameter
1358:             *@return       Description of the Returned Value
1359:             */
1360:            public Object visit(ASTExclusiveOrExpression node, Object data) {
1361:                return binaryExpression(node, "^", data);
1362:            }
1363:
1364:            /**
1365:             *  Description of the Method
1366:             *
1367:             *@param  node  Description of Parameter
1368:             *@param  data  Description of Parameter
1369:             *@return       Description of the Returned Value
1370:             */
1371:            public Object visit(ASTAndExpression node, Object data) {
1372:                return binaryExpression(node, "&", data);
1373:            }
1374:
1375:            /**
1376:             *  Description of the Method
1377:             *
1378:             *@param  node  Description of Parameter
1379:             *@param  data  Description of Parameter
1380:             *@return       Description of the Returned Value
1381:             */
1382:            public Object visit(ASTEqualityExpression node, Object data) {
1383:                return binaryExpression2(node, node.getNames(), data);
1384:            }
1385:
1386:            /**
1387:             *  Description of the Method
1388:             *
1389:             *@param  node  Description of Parameter
1390:             *@param  data  Description of Parameter
1391:             *@return       Description of the Returned Value
1392:             */
1393:            public Object visit(ASTInstanceOfExpression node, Object data) {
1394:                return binaryExpression(node, "instanceof", data);
1395:            }
1396:
1397:            /**
1398:             *  Description of the Method
1399:             *
1400:             *@param  node  Description of Parameter
1401:             *@param  data  Description of Parameter
1402:             *@return       Description of the Returned Value
1403:             */
1404:            public Object visit(ASTRelationalExpression node, Object data) {
1405:                return binaryExpression2(node, node.getNames(), data);
1406:            }
1407:
1408:            /**
1409:             *  Description of the Method
1410:             *
1411:             *@param  node  Description of Parameter
1412:             *@param  data  Description of Parameter
1413:             *@return       Description of the Returned Value
1414:             */
1415:            public Object visit(ASTShiftExpression node, Object data) {
1416:                return binaryExpression2(node, node.getNames(), data);
1417:            }
1418:
1419:            /**
1420:             *  Description of the Method
1421:             *
1422:             *@param  node  Description of Parameter
1423:             *@param  data  Description of Parameter
1424:             *@return       Description of the Returned Value
1425:             */
1426:            public Object visit(ASTAdditiveExpression node, Object data) {
1427:                return binaryExpression2(node, node.getNames(), data);
1428:            }
1429:
1430:            /**
1431:             *  Description of the Method
1432:             *
1433:             *@param  node  Description of Parameter
1434:             *@param  data  Description of Parameter
1435:             *@return       Description of the Returned Value
1436:             */
1437:            public Object visit(ASTMultiplicativeExpression node, Object data) {
1438:                return binaryExpression2(node, node.getNames(), data);
1439:            }
1440:
1441:            /**
1442:             *  Description of the Method
1443:             *
1444:             *@param  node  Description of Parameter
1445:             *@param  data  Description of Parameter
1446:             *@return       Description of the Returned Value
1447:             */
1448:            public Object visit(ASTUnaryExpression node, Object data) {
1449:
1450:                //  Traverse the children
1451:                Node child = node.jjtGetFirstChild();
1452:                if (child instanceof  ASTUnaryExpression) {
1453:                    countLines(node.getSpecial("operator"));
1454:                }
1455:                child.jjtAccept(this , data);
1456:
1457:                //  Return the data
1458:                return data;
1459:            }
1460:
1461:            /**
1462:             *  Description of the Method
1463:             *
1464:             *@param  node  Description of Parameter
1465:             *@param  data  Description of Parameter
1466:             *@return       Description of the Returned Value
1467:             */
1468:            public Object visit(ASTPreIncrementExpression node, Object data) {
1469:
1470:                //  Include the preincrement
1471:                countLines(node.getSpecial("operator"));
1472:
1473:                //  Traverse the children
1474:                node.childrenAccept(this , data);
1475:
1476:                //  Return the data
1477:                return data;
1478:            }
1479:
1480:            /**
1481:             *  Description of the Method
1482:             *
1483:             *@param  node  Description of Parameter
1484:             *@param  data  Description of Parameter
1485:             *@return       Description of the Returned Value
1486:             */
1487:            public Object visit(ASTPreDecrementExpression node, Object data) {
1488:
1489:                //  Include the preincrement
1490:                countLines(node.getSpecial("operator"));
1491:
1492:                //  Traverse the children
1493:                node.childrenAccept(this , data);
1494:
1495:                //  Return the data
1496:                return data;
1497:            }
1498:
1499:            /**
1500:             *  Description of the Method
1501:             *
1502:             *@param  node  Description of Parameter
1503:             *@param  data  Description of Parameter
1504:             *@return       Description of the Returned Value
1505:             */
1506:            public Object visit(ASTUnaryExpressionNotPlusMinus node, Object data) {
1507:
1508:                //  Traverse the children
1509:                Node child = node.jjtGetFirstChild();
1510:                if (child instanceof  ASTUnaryExpression) {
1511:                    countLines(node.getSpecial("operator"));
1512:                }
1513:                child.jjtAccept(this , data);
1514:
1515:                //  Return the data
1516:                return data;
1517:            }
1518:
1519:            /**
1520:             *  Description of the Method
1521:             *
1522:             *@param  node  Description of Parameter
1523:             *@param  data  Description of Parameter
1524:             *@return       Description of the Returned Value
1525:             */
1526:            public Object visit(ASTPostfixExpression node, Object data) {
1527:
1528:                //  Traverse the children
1529:                node.childrenAccept(this , data);
1530:
1531:                //  Include the increment
1532:                countLines(node.getSpecial("operator"));
1533:
1534:                //  Return the data
1535:                return data;
1536:            }
1537:
1538:            /**
1539:             *  Description of the Method
1540:             *
1541:             *@param  node  Description of Parameter
1542:             *@param  data  Description of Parameter
1543:             *@return       Description of the Returned Value
1544:             */
1545:            public Object visit(ASTCastExpression node, Object data) {
1546:
1547:                //  Cast portion
1548:                countLines(node.getSpecial("begin"));
1549:                node.jjtGetFirstChild().jjtAccept(this , data);
1550:                countLines(node.getSpecial("end"));
1551:
1552:                //  Expression
1553:                node.jjtGetChild(1).jjtAccept(this , data);
1554:
1555:                //  Return the data
1556:                return data;
1557:            }
1558:
1559:            /**
1560:             *  Description of the Method
1561:             *
1562:             *@param  node  Description of Parameter
1563:             *@param  data  Description of Parameter
1564:             *@return       Description of the Returned Value
1565:             */
1566:            public Object visit(ASTPrimaryExpression node, Object data) {
1567:                node.childrenAccept(this , data);
1568:                return data;
1569:            }
1570:
1571:            /**
1572:             *  Description of the Method
1573:             *
1574:             *@param  node  Description of Parameter
1575:             *@param  data  Description of Parameter
1576:             *@return       Description of the Returned Value
1577:             */
1578:            public Object visit(ASTPrimaryPrefix node, Object data) {
1579:
1580:                //  Traverse the children
1581:                if (node.jjtGetNumChildren() == 0) {
1582:                    int count = node.getCount();
1583:                    for (int i = 0; i < count; i++) {
1584:                        countLines(node.getSpecial("this." + i));
1585:                    }
1586:                    countLines(node.getSpecial("this"));
1587:                    countLines(node.getSpecial("id"));
1588:                } else {
1589:                    Node child = node.jjtGetFirstChild();
1590:                    if ((child instanceof  ASTLiteral)
1591:                            || (child instanceof  ASTName)
1592:                            || (child instanceof  ASTAllocationExpression)) {
1593:                        child.jjtAccept(this , data);
1594:                    } else if (child instanceof  ASTExpression) {
1595:                        countLines(node.getSpecial("begin"));
1596:                        child.jjtAccept(this , data);
1597:                        countLines(node.getSpecial("end"));
1598:                    } else if (child instanceof  ASTResultType) {
1599:                        child.jjtAccept(this , data);
1600:                    } else {
1601:                        System.out
1602:                                .println("UNEXPECTED child for ASTPrimaryPrefix ="
1603:                                        + child);
1604:                        child.jjtAccept(this , data);
1605:                    }
1606:                }
1607:
1608:                //  Return the data
1609:                return data;
1610:            }
1611:
1612:            /**
1613:             *  Description of the Method
1614:             *
1615:             *@param  node  Description of Parameter
1616:             *@param  data  Description of Parameter
1617:             *@return       Description of the Returned Value
1618:             */
1619:            public Object visit(ASTPrimarySuffix node, Object data) {
1620:
1621:                //  Traverse the children
1622:                if (node.jjtGetNumChildren() == 0) {
1623:                    countLines(node.getSpecial("dot"));
1624:                    countLines(node.getSpecial("id"));
1625:                } else {
1626:                    Node child = node.jjtGetFirstChild();
1627:                    if (child instanceof  ASTArguments) {
1628:                        child.jjtAccept(this , data);
1629:                    } else if (child instanceof  ASTExpression) {
1630:                        countLines(node.getSpecial("["));
1631:                        child.jjtAccept(this , data);
1632:                        countLines(node.getSpecial("]"));
1633:                    } else if (child instanceof  ASTAllocationExpression) {
1634:                        countLines(node.getSpecial("dot"));
1635:                        child.jjtAccept(this , data);
1636:                    } else if (child instanceof  ASTReferenceTypeList) {
1637:                        countLines(node.getSpecial("dot"));
1638:                        countLines(node.getSpecial("id"));
1639:                        child.jjtAccept(this , data);
1640:                    }
1641:                }
1642:
1643:                //  Return the data
1644:                return data;
1645:            }
1646:
1647:            /**
1648:             *  Description of the Method
1649:             *
1650:             *@param  node  Description of Parameter
1651:             *@param  data  Description of Parameter
1652:             *@return       Description of the Returned Value
1653:             */
1654:            public Object visit(ASTLiteral node, Object data) {
1655:
1656:                //  Traverse the children
1657:                if (node.hasAnyChildren()) {
1658:                    node.childrenAccept(this , data);
1659:                } else {
1660:                    countLines(node.getSpecial("id"));
1661:                }
1662:
1663:                //  Return the data
1664:                return data;
1665:            }
1666:
1667:            /**
1668:             *  Description of the Method
1669:             *
1670:             *@param  node  Description of Parameter
1671:             *@param  data  Description of Parameter
1672:             *@return       Description of the Returned Value
1673:             */
1674:            public Object visit(ASTBooleanLiteral node, Object data) {
1675:                countLines(node.getSpecial("id")); //  Print the data
1676:                return data; //  Return the data
1677:            }
1678:
1679:            /**
1680:             *  Description of the Method
1681:             *
1682:             *@param  node  Description of Parameter
1683:             *@param  data  Description of Parameter
1684:             *@return       Description of the Returned Value
1685:             */
1686:            public Object visit(ASTNullLiteral node, Object data) {
1687:                countLines(node.getSpecial("id")); //  Print the data
1688:                return data; //  Return the data
1689:            }
1690:
1691:            /**
1692:             *  Description of the Method
1693:             *
1694:             *@param  node  Description of Parameter
1695:             *@param  data  Description of Parameter
1696:             *@return       Description of the Returned Value
1697:             */
1698:            public Object visit(ASTArguments node, Object data) {
1699:                countLines(node.getSpecial("begin")); //  Start the parens
1700:                node.childrenAccept(this , data); //  Traverse the children
1701:                countLines(node.getSpecial("end")); //  Finish the parens
1702:                return data; //  Return the data
1703:            }
1704:
1705:            /**
1706:             *  Description of the Method
1707:             *
1708:             *@param  node  Description of Parameter
1709:             *@param  data  Description of Parameter
1710:             *@return       Description of the Returned Value
1711:             */
1712:            public Object visit(ASTArgumentList node, Object data) {
1713:
1714:                //  Traverse the children
1715:                int count = node.jjtGetNumChildren();
1716:                for (int ndx = 0; ndx < count; ndx++) {
1717:                    if (ndx > 0) {
1718:                        countLines(node.getSpecial("comma." + (ndx - 1)));
1719:                    }
1720:                    node.jjtGetChild(ndx).jjtAccept(this , data);
1721:                }
1722:
1723:                //  Return the data
1724:                return data;
1725:            }
1726:
1727:            /**
1728:             *  Description of the Method
1729:             *
1730:             *@param  node  Description of Parameter
1731:             *@param  data  Description of Parameter
1732:             *@return       Description of the Returned Value
1733:             */
1734:            public Object visit(ASTAllocationExpression node, Object data) {
1735:                //  Traverse the children
1736:                countLines(node.getSpecial("id")); //  Print the name of the node
1737:                node.childrenAccept(this , data); //  Traverse the children
1738:                return data; //  Return the data
1739:            }
1740:
1741:            /**
1742:             *  Description of the Method
1743:             *
1744:             *@param  node  Description of Parameter
1745:             *@param  data  Description of Parameter
1746:             *@return       Description of the Returned Value
1747:             */
1748:            public Object visit(ASTArrayDimsAndInits node, Object data) {
1749:
1750:                //  Traverse the children
1751:                boolean foundInitializer = false;
1752:                int last = node.jjtGetNumChildren();
1753:                for (int ndx = 0; ndx < last; ndx++) {
1754:                    if (node.jjtGetChild(ndx) instanceof  ASTExpression) {
1755:                        countLines(node.getSpecial("[." + ndx));
1756:                        node.jjtGetChild(ndx).jjtAccept(this , data);
1757:                        countLines(node.getSpecial("]." + ndx));
1758:                    } else if (node.jjtGetChild(ndx) instanceof  ASTArrayInitializer) {
1759:                        foundInitializer = true;
1760:                    }
1761:                }
1762:                int looping = node.getArrayCount();
1763:                if (foundInitializer) {
1764:                    looping++;
1765:                }
1766:
1767:                for (int ndx = last; ndx < looping; ndx++) {
1768:                    countLines(node.getSpecial("[." + ndx));
1769:                    countLines(node.getSpecial("]." + ndx));
1770:                }
1771:                if (foundInitializer) {
1772:                    node.jjtGetChild(last - 1).jjtAccept(this , data);
1773:                }
1774:
1775:                //  Return the data
1776:                return data;
1777:            }
1778:
1779:            /**
1780:             *  Description of the Method
1781:             *
1782:             *@param  node  Description of Parameter
1783:             *@param  data  Description of Parameter
1784:             *@return       Description of the Returned Value
1785:             */
1786:            public Object visit(ASTStatement node, Object data) {
1787:
1788:                //  Traverse the children
1789:                node.childrenAccept(this , data);
1790:                if (node.jjtGetFirstChild() instanceof  ASTStatementExpression) {
1791:                    //  Finish off the statement expression
1792:                    countLines(node.getSpecial("semicolon"));
1793:                }
1794:
1795:                //  Return the data
1796:                return data;
1797:            }
1798:
1799:            /**
1800:             *  Description of the Method
1801:             *
1802:             *@param  node  Description of Parameter
1803:             *@param  data  Description of Parameter
1804:             *@return       Description of the Returned Value
1805:             */
1806:            public Object visit(ASTLabeledStatement node, Object data) {
1807:
1808:                //  Print the data
1809:                countLines(node.getSpecial("id"));
1810:                countLines(node.getSpecial("colon"));
1811:
1812:                //  Traverse the children
1813:                node.childrenAccept(this , data);
1814:
1815:                //  Return the data
1816:                return data;
1817:            }
1818:
1819:            /**
1820:             *  Visits a block in the parse tree
1821:             *
1822:             *@param  node  the block node
1823:             *@param  data  the information that is used to traverse the tree
1824:             *@return       data is returned
1825:             */
1826:            public Object visit(ASTBlock node, Object data) {
1827:                //  Start the block
1828:                countLines(node.getSpecial("begin"));
1829:
1830:                //  Traverse the children
1831:                node.childrenAccept(this , data);
1832:
1833:                //  Finish the block
1834:                countLines(node.getSpecial("end"));
1835:
1836:                //  Return the data
1837:                return data;
1838:            }
1839:
1840:            /**
1841:             *  Description of the Method
1842:             *
1843:             *@param  node  Description of Parameter
1844:             *@param  data  Description of Parameter
1845:             *@return       Description of the Returned Value
1846:             */
1847:            public Object visit(ASTBlockStatement node, Object data) {
1848:
1849:                //  Include the stuff before the class/interface declaration
1850:                if (node.hasAnyChildren()) {
1851:                    SimpleNode child = (SimpleNode) node.jjtGetFirstChild();
1852:
1853:                    if (node.isFinal()) {
1854:                        countLines(node.getSpecial("final"));
1855:                    }
1856:                    if (child instanceof  ASTUnmodifiedClassDeclaration) {
1857:                        countLines(child.getSpecial("class"));
1858:                    } else if (child instanceof  ASTUnmodifiedInterfaceDeclaration) {
1859:                        countLines(child.getSpecial("interface"));
1860:                    }
1861:                }
1862:                countLines(node.getSpecial("semicolon"));
1863:
1864:                //  Traverse the children
1865:                node.childrenAccept(this , data);
1866:
1867:                //  Return the data
1868:                return data;
1869:            }
1870:
1871:            /**
1872:             *  Description of the Method
1873:             *
1874:             *@param  node  Description of Parameter
1875:             *@param  data  Description of Parameter
1876:             *@return       Description of the Returned Value
1877:             */
1878:            public Object visit(ASTLocalVariableDeclaration node, Object data) {
1879:                //  Traverse the children
1880:                int last = node.jjtGetNumChildren();
1881:
1882:                //  Print the final token
1883:                if (node.isUsingFinal()) {
1884:                    countLines(node.getSpecial("final"));
1885:                }
1886:
1887:                for (int ndx = 0; ndx < last; ndx++) {
1888:                    if (ndx > 1) {
1889:                        countLines(node.getSpecial("comma." + (ndx - 2)));
1890:                    }
1891:                    //  Visit the child
1892:                    node.jjtGetChild(ndx).jjtAccept(this , data);
1893:                }
1894:
1895:                //  Return the data
1896:                return data;
1897:            }
1898:
1899:            /**
1900:             *  Description of the Method
1901:             *
1902:             *@param  node  Description of Parameter
1903:             *@param  data  Description of Parameter
1904:             *@return       Description of the Returned Value
1905:             */
1906:            public Object visit(ASTEmptyStatement node, Object data) {
1907:
1908:                //  Print the name of the node
1909:                countLines(node.getSpecial("semicolon"));
1910:
1911:                //  Return the data
1912:                return data;
1913:            }
1914:
1915:            /**
1916:             *  Description of the Method
1917:             *
1918:             *@param  node  Description of Parameter
1919:             *@param  data  Description of Parameter
1920:             *@return       Description of the Returned Value
1921:             */
1922:            public Object visit(ASTStatementExpression node, Object data) {
1923:
1924:                //  Traverse the children
1925:                if (node.jjtGetFirstChild() instanceof  ASTPrimaryExpression) {
1926:                    int last = node.jjtGetNumChildren();
1927:                    node.jjtGetFirstChild().jjtAccept(this , data);
1928:                    countLines(node.getSpecial("id"));
1929:                    for (int ndx = 1; ndx < last; ndx++) {
1930:                        node.jjtGetChild(ndx).jjtAccept(this , data);
1931:                    }
1932:                } else {
1933:                    node.childrenAccept(this , data);
1934:                }
1935:
1936:                //  Return the data
1937:                return data;
1938:            }
1939:
1940:            /**
1941:             *  Counts the number of lines associated with a switch statement
1942:             *
1943:             *@param  node  the switch node in the parse tree
1944:             *@param  data  the data used to visit this parse tree
1945:             *@return       the data
1946:             */
1947:            public Object visit(ASTSwitchStatement node, Object data) {
1948:
1949:                //  Switch
1950:                countLines(node.getSpecial("switch"));
1951:                countLines(node.getSpecial("beginExpr"));
1952:                node.jjtGetFirstChild().jjtAccept(this , data);
1953:                countLines(node.getSpecial("endExpr"));
1954:
1955:                //  Start the block
1956:                countLines(node.getSpecial("beginBlock"));
1957:
1958:                //  Traverse the children
1959:                int last = node.jjtGetNumChildren();
1960:                for (int ndx = 1; ndx < last; ndx++) {
1961:                    Node next = node.jjtGetChild(ndx);
1962:                    if (next instanceof  ASTBlockStatement) {
1963:                        next.jjtAccept(this , data);
1964:                    } else {
1965:                        next.jjtAccept(this , data);
1966:                    }
1967:                }
1968:
1969:                //  End the block
1970:                countLines(node.getSpecial("endBlock"));
1971:
1972:                //  Return the data
1973:                return data;
1974:            }
1975:
1976:            /**
1977:             *  Description of the Method
1978:             *
1979:             *@param  node  Description of Parameter
1980:             *@param  data  Description of Parameter
1981:             *@return       Description of the Returned Value
1982:             */
1983:            public Object visit(ASTSwitchLabel node, Object data) {
1984:
1985:                //  Determine if the node has children
1986:                if (node.hasAnyChildren()) {
1987:                    countLines(node.getSpecial("id"));
1988:                    node.childrenAccept(this , data);
1989:                    countLines(node.getSpecial("colon"));
1990:                } else {
1991:                    countLines(node.getSpecial("id"));
1992:                    countLines(node.getSpecial("colon"));
1993:                }
1994:
1995:                //  Return the data
1996:                return data;
1997:            }
1998:
1999:            /**
2000:             *  Description of the Method
2001:             *
2002:             *@param  node  Description of Parameter
2003:             *@param  data  Description of Parameter
2004:             *@return       Description of the Returned Value
2005:             */
2006:            public Object visit(ASTIfStatement node, Object data) {
2007:
2008:                //  Determine if the node has children
2009:                countLines(node.getSpecial("if"));
2010:                countLines(node.getSpecial("beginExpr"));
2011:                node.jjtGetFirstChild().jjtAccept(this , data);
2012:                countLines(node.getSpecial("endExpr"));
2013:
2014:                //  Determine if the then contains a block
2015:                boolean hasElse = (node.jjtGetNumChildren() == 3);
2016:                if (node.jjtGetNumChildren() >= 2) {
2017:                    forceBlock(node.jjtGetChild(1), data);
2018:                }
2019:
2020:                //  Determine if the else part
2021:                if (hasElse) {
2022:                    countLines(node.getSpecial("else"));
2023:                    //  Determine if the next item is a statement
2024:                    ASTStatement child = (ASTStatement) node.jjtGetChild(2);
2025:                    Node next = child.jjtGetFirstChild();
2026:                    if (next instanceof  ASTIfStatement) {
2027:                        next.jjtAccept(this , data);
2028:                    } else {
2029:                        forceBlock(child, data);
2030:                    }
2031:                }
2032:
2033:                //  Return the data
2034:                return data;
2035:            }
2036:
2037:            /**
2038:             *  Description of the Method
2039:             *
2040:             *@param  node  Description of Parameter
2041:             *@param  data  Description of Parameter
2042:             *@return       Description of the Returned Value
2043:             */
2044:            public Object visit(ASTWhileStatement node, Object data) {
2045:
2046:                //  Determine if the node has children
2047:                countLines(node.getSpecial("while"));
2048:                countLines(node.getSpecial("beginExpr"));
2049:                node.jjtGetFirstChild().jjtAccept(this , data);
2050:                countLines(node.getSpecial("endExpr"));
2051:
2052:                //  Process the block
2053:                forceBlock(node.jjtGetChild(1), data);
2054:
2055:                //  Return the data
2056:                return data;
2057:            }
2058:
2059:            /**
2060:             *  Description of the Method
2061:             *
2062:             *@param  node  Description of Parameter
2063:             *@param  data  Description of Parameter
2064:             *@return       Description of the Returned Value
2065:             */
2066:            public Object visit(ASTDoStatement node, Object data) {
2067:
2068:                //  Begin the do block
2069:                countLines(node.getSpecial("do"));
2070:
2071:                //  Process the block
2072:                forceBlock(node.jjtGetFirstChild(), data);
2073:
2074:                //  Process the while block
2075:                countLines(node.getSpecial("while"));
2076:                countLines(node.getSpecial("beginExpr"));
2077:                node.jjtGetChild(1).jjtAccept(this , data);
2078:                countLines(node.getSpecial("endExpr"));
2079:                countLines(node.getSpecial("semicolon"));
2080:
2081:                //  Return the data
2082:                return data;
2083:            }
2084:
2085:            /**
2086:             *  Description of the Method
2087:             *
2088:             *@param  node  Description of Parameter
2089:             *@param  data  Description of Parameter
2090:             *@return       Description of the Returned Value
2091:             */
2092:            public Object visit(ASTForStatement node, Object data) {
2093:
2094:                //  Start the for loop
2095:                countLines(node.getSpecial("for"));
2096:                countLines(node.getSpecial("beginExpr"));
2097:
2098:                //  Traverse the children
2099:                Node next = node.jjtGetFirstChild();
2100:                int index = 1;
2101:                if (next instanceof  ASTLocalVariableDeclaration) {
2102:                    next.jjtAccept(this , data);
2103:                    countLines(node.getSpecial("loopover"));
2104:                    next = node.jjtGetChild(index);
2105:                    index++;
2106:                    next.jjtAccept(this , data);
2107:                } else {
2108:                    if (next instanceof  ASTForInit) {
2109:                        next.jjtAccept(this , data);
2110:                        next = node.jjtGetChild(index);
2111:                        index++;
2112:                    }
2113:                    countLines(node.getSpecial("init"));
2114:                    if (next instanceof  ASTExpression) {
2115:                        next.jjtAccept(this , data);
2116:                        next = node.jjtGetChild(index);
2117:                        index++;
2118:                    }
2119:                    countLines(node.getSpecial("test"));
2120:                    if (next instanceof  ASTForUpdate) {
2121:                        next.jjtAccept(this , data);
2122:                        next = node.jjtGetChild(index);
2123:                        index++;
2124:                    }
2125:                }
2126:                countLines(node.getSpecial("endExpr"));
2127:                forceBlock(next, data);
2128:
2129:                //  Return the data
2130:                return data;
2131:            }
2132:
2133:            /**
2134:             *  Description of the Method
2135:             *
2136:             *@param  node  Description of Parameter
2137:             *@param  data  Description of Parameter
2138:             *@return       Description of the Returned Value
2139:             */
2140:            public Object visit(ASTForInit node, Object data) {
2141:
2142:                //  Traverse the children
2143:                Node next = node.jjtGetFirstChild();
2144:                if (next instanceof  ASTLocalVariableDeclaration) {
2145:                    forInit((ASTLocalVariableDeclaration) next, data);
2146:                } else {
2147:                    node.childrenAccept(this , data);
2148:                }
2149:
2150:                //  Return the data
2151:                return data;
2152:            }
2153:
2154:            /**
2155:             *  Description of the Method
2156:             *
2157:             *@param  node  Description of Parameter
2158:             *@param  data  Description of Parameter
2159:             *@return       Description of the Returned Value
2160:             */
2161:            public Object visit(ASTStatementExpressionList node, Object data) {
2162:
2163:                //  Traverse the children
2164:                int last = node.jjtGetNumChildren();
2165:                for (int ndx = 0; ndx < last; ndx++) {
2166:                    if (ndx > 0) {
2167:                        countLines(node.getSpecial("comma." + (ndx - 1)));
2168:                    }
2169:                    node.jjtGetChild(ndx).jjtAccept(this , data);
2170:                }
2171:
2172:                //  Return the data
2173:                return data;
2174:            }
2175:
2176:            /**
2177:             *  Description of the Method
2178:             *
2179:             *@param  node  Description of Parameter
2180:             *@param  data  Description of Parameter
2181:             *@return       Description of the Returned Value
2182:             */
2183:            public Object visit(ASTForUpdate node, Object data) {
2184:                //  Traverse the children
2185:                node.childrenAccept(this , data);
2186:
2187:                //  Return the data
2188:                return data;
2189:            }
2190:
2191:            /**
2192:             *  Description of the Method
2193:             *
2194:             *@param  node  Description of Parameter
2195:             *@param  data  Description of Parameter
2196:             *@return       Description of the Returned Value
2197:             */
2198:            public Object visit(ASTBreakStatement node, Object data) {
2199:
2200:                //  Print the break statement
2201:                countLines(node.getSpecial("break"));
2202:                String name = node.getName();
2203:                if (!((name == null) || (name.length() == 0))) {
2204:                    countLines(node.getSpecial("id"));
2205:                }
2206:                countLines(node.getSpecial("semicolon"));
2207:
2208:                //  Return the data
2209:                return data;
2210:            }
2211:
2212:            /**
2213:             *  Description of the Method
2214:             *
2215:             *@param  node  Description of Parameter
2216:             *@param  data  Description of Parameter
2217:             *@return       Description of the Returned Value
2218:             */
2219:            public Object visit(ASTContinueStatement node, Object data) {
2220:
2221:                //  Print the continue statement
2222:                countLines(node.getSpecial("continue"));
2223:                String name = node.getName();
2224:                if (!((name == null) || (name.length() == 0))) {
2225:                    countLines(node.getSpecial("id"));
2226:                }
2227:                countLines(node.getSpecial("semicolon"));
2228:
2229:                //  Return the data
2230:                return data;
2231:            }
2232:
2233:            /**
2234:             *  Description of the Method
2235:             *
2236:             *@param  node  Description of Parameter
2237:             *@param  data  Description of Parameter
2238:             *@return       Description of the Returned Value
2239:             */
2240:            public Object visit(ASTReturnStatement node, Object data) {
2241:
2242:                //  Traverse the children
2243:                if (node.hasAnyChildren()) {
2244:                    countLines(node.getSpecial("return"));
2245:                    node.childrenAccept(this , data);
2246:                    countLines(node.getSpecial("semicolon"));
2247:                } else {
2248:                    countLines(node.getSpecial("return"));
2249:                    countLines(node.getSpecial("semicolon"));
2250:                }
2251:
2252:                //  Return the data
2253:                return data;
2254:            }
2255:
2256:            /**
2257:             *  Description of the Method
2258:             *
2259:             *@param  node  Description of Parameter
2260:             *@param  data  Description of Parameter
2261:             *@return       Description of the Returned Value
2262:             */
2263:            public Object visit(ASTThrowStatement node, Object data) {
2264:                //  Traverse the children
2265:                countLines(node.getSpecial("throw"));
2266:                node.childrenAccept(this , data);
2267:                countLines(node.getSpecial("semicolon"));
2268:
2269:                //  Return the data
2270:                return data;
2271:            }
2272:
2273:            /**
2274:             *  Description of the Method
2275:             *
2276:             *@param  node  Description of Parameter
2277:             *@param  data  Description of Parameter
2278:             *@return       Description of the Returned Value
2279:             */
2280:            public Object visit(ASTSynchronizedStatement node, Object data) {
2281:
2282:                //  Traverse the children
2283:                countLines(node.getSpecial("synchronized"));
2284:                countLines(node.getSpecial("beginExpr"));
2285:                node.jjtGetFirstChild().jjtAccept(this , data);
2286:                countLines(node.getSpecial("endExpr"));
2287:                node.jjtGetChild(1).jjtAccept(this , data);
2288:
2289:                //  Return the data
2290:                return data;
2291:            }
2292:
2293:            /**
2294:             *  Description of the Method
2295:             *
2296:             *@param  node  Description of Parameter
2297:             *@param  data  Description of Parameter
2298:             *@return       Description of the Returned Value
2299:             */
2300:            public Object visit(ASTTryStatement node, Object data) {
2301:                //  Traverse the children
2302:                countLines(node.getSpecial("try"));
2303:                node.jjtGetFirstChild().jjtAccept(this , data);
2304:
2305:                //  Now work with the pairs
2306:                int last = node.jjtGetNumChildren();
2307:                boolean paired = false;
2308:                int catchCount = 0;
2309:                for (int ndx = 1; ndx < last; ndx++) {
2310:                    Node next = node.jjtGetChild(ndx);
2311:                    if (next instanceof  ASTFormalParameter) {
2312:                        countLines(node.getSpecial("catch" + catchCount));
2313:                        countLines(node.getSpecial("beginExpr" + catchCount));
2314:                        next.jjtAccept(this , data);
2315:                        countLines(node.getSpecial("endExpr" + catchCount));
2316:                        paired = true;
2317:                        catchCount++;
2318:                    } else {
2319:                        if (!paired) {
2320:                            countLines(node.getSpecial("finally"));
2321:                        }
2322:                        next.jjtAccept(this , data);
2323:                        paired = false;
2324:                    }
2325:                }
2326:
2327:                //  Return the data
2328:                return data;
2329:            }
2330:
2331:            /**
2332:             *  Visit the assertion node
2333:             *
2334:             *@param  node  the node
2335:             *@param  data  the data needed to perform the visit
2336:             *@return       the result of visiting the node
2337:             */
2338:            public Object visit(ASTAssertionStatement node, Object data) {
2339:                //  Traverse the children
2340:                countLines(node.getSpecial("assert"));
2341:                node.jjtGetFirstChild().jjtAccept(this , data);
2342:                if (node.jjtGetNumChildren() > 1) {
2343:                    countLines(node.getSpecial("colon"));
2344:                    node.jjtGetChild(1).jjtAccept(this , data);
2345:                }
2346:                countLines(node.getSpecial("semicolon"));
2347:
2348:                //  Return the data
2349:                return data;
2350:            }
2351:
2352:            /**
2353:             *  Returns the current line count
2354:             *
2355:             *@return    the line count
2356:             */
2357:            protected int getLineCount() {
2358:                return lineCount;
2359:            }
2360:
2361:            /**
2362:             *  Description of the Method
2363:             *
2364:             *@param  node  Description of Parameter
2365:             *@param  name  Description of Parameter
2366:             *@param  data  Description of Parameter
2367:             *@return       Description of the Returned Value
2368:             */
2369:            protected Object binaryExpression(SimpleNode node, String name,
2370:                    Object data) {
2371:
2372:                //  Traverse the children
2373:                int childCount = node.jjtGetNumChildren();
2374:                for (int ndx = 0; ndx < childCount; ndx++) {
2375:                    if (ndx > 0) {
2376:                        countLines(node.getSpecial("operator." + (ndx - 1)));
2377:                    }
2378:                    node.jjtGetChild(ndx).jjtAccept(this , data);
2379:                }
2380:
2381:                //  Return the data
2382:                return data;
2383:            }
2384:
2385:            /**
2386:             *  Description of the Method
2387:             *
2388:             *@param  node   Description of Parameter
2389:             *@param  names  Description of Parameter
2390:             *@param  data   Description of Parameter
2391:             *@return        Description of the Returned Value
2392:             */
2393:            protected Object binaryExpression2(SimpleNode node,
2394:                    Enumeration names, Object data) {
2395:
2396:                //  Traverse the children
2397:                int childCount = node.jjtGetNumChildren();
2398:                for (int ndx = 0; ndx < childCount; ndx++) {
2399:                    if (ndx > 0) {
2400:                        countLines(node.getSpecial("operator." + (ndx - 1)));
2401:                    }
2402:                    node.jjtGetChild(ndx).jjtAccept(this , data);
2403:                }
2404:
2405:                //  Return the data
2406:                return data;
2407:            }
2408:
2409:            /**
2410:             *  This code is based on the pretty printer, and was used to force the
2411:             *  source code to have a block for an if statement.
2412:             *
2413:             *@param  node  The node that should be contained inside a block
2414:             *@param  data  the print data
2415:             */
2416:            protected void forceBlock(Node node, Object data) {
2417:                if ((node.jjtGetNumChildren() > 0)
2418:                        && (node.jjtGetFirstChild() instanceof  ASTBlock)) {
2419:                    //  We know we have a block
2420:                    ASTBlock child = (ASTBlock) node.jjtGetFirstChild();
2421:
2422:                    child.jjtAccept(this , data);
2423:                } else {
2424:                    ((SimpleNode) node).childrenAccept(this , data);
2425:                }
2426:            }
2427:
2428:            /**
2429:             *  Description of the Method
2430:             *
2431:             *@param  node  Description of Parameter
2432:             *@param  data  Description of Parameter
2433:             */
2434:            protected void forInit(ASTLocalVariableDeclaration node, Object data) {
2435:
2436:                //  Traverse the children
2437:                int last = node.jjtGetNumChildren();
2438:                Node typeNode = node.jjtGetFirstChild();
2439:                typeNode.jjtAccept(this , data);
2440:
2441:                for (int ndx = 1; ndx < last; ndx++) {
2442:                    if (ndx > 1) {
2443:                        //  Add a comma between entries
2444:                        countLines(node.getSpecial("comma." + (ndx - 1)));
2445:                    }
2446:
2447:                    //  Print the final token
2448:                    if (node.isUsingFinal()) {
2449:                        countLines(node.getSpecial("final"));
2450:                    }
2451:
2452:                    //  Visit the child
2453:                    node.jjtGetChild(ndx).jjtAccept(this , data);
2454:                }
2455:            }
2456:
2457:            /**
2458:             *  Check the initial token, and removes it from the object.
2459:             *
2460:             *@param  top  the result type
2461:             *@return      the initial token
2462:             */
2463:            protected Token getInitialToken(ASTResultType top) {
2464:                //  Check to see if we need to go farther down
2465:                if (top.hasAnyChildren()) {
2466:                    ASTType type = (ASTType) top.jjtGetFirstChild();
2467:                    if (type.jjtGetFirstChild() instanceof  ASTPrimitiveType) {
2468:                        ASTPrimitiveType primitiveType = (ASTPrimitiveType) type
2469:                                .jjtGetFirstChild();
2470:                        Token tok = primitiveType.getSpecial("primitive");
2471:                        primitiveType.removeSpecial("primitive");
2472:                        return tok;
2473:                    } else if (type.jjtGetFirstChild() instanceof  ASTReferenceType) {
2474:                        ASTReferenceType reference = (ASTReferenceType) type
2475:                                .jjtGetFirstChild();
2476:                        if (reference.jjtGetFirstChild() instanceof  ASTPrimitiveType) {
2477:                            ASTPrimitiveType primitiveType = (ASTPrimitiveType) reference
2478:                                    .jjtGetFirstChild();
2479:                            Token tok = primitiveType.getSpecial("primitive");
2480:                            primitiveType.removeSpecial("primitive");
2481:                            return tok;
2482:                        } else {
2483:                            ASTClassOrInterfaceType name = (ASTClassOrInterfaceType) reference
2484:                                    .jjtGetFirstChild();
2485:                            ASTIdentifier id = (ASTIdentifier) name
2486:                                    .jjtGetFirstChild();
2487:                            Token tok = id.getSpecial("id");
2488:                            id.removeSpecial("id");
2489:                            return tok;
2490:                        }
2491:                    } else {
2492:                        ASTClassOrInterfaceType name = (ASTClassOrInterfaceType) type
2493:                                .jjtGetFirstChild();
2494:                        ASTIdentifier id = (ASTIdentifier) name
2495:                                .jjtGetFirstChild();
2496:                        Token tok = id.getSpecial("id");
2497:                        id.removeSpecial("id");
2498:                        return tok;
2499:                    }
2500:                } else {
2501:                    //  No farther to go - return the token
2502:                    Token tok = top.getSpecial("primitive");
2503:                    top.removeSpecial("primitive");
2504:                    return tok;
2505:                }
2506:            }
2507:
2508:            /**
2509:             *  Check the initial token, and removes it from the object.
2510:             *
2511:             *@param  top  the result type
2512:             *@return      the initial token
2513:             */
2514:            protected Token getInitialToken(ASTTypeParameters top) {
2515:                Token tok = top.getSpecial("<");
2516:                top.removeSpecial("<");
2517:                return tok;
2518:            }
2519:
2520:            /**
2521:             *  Counts the number of lines in the current token
2522:             *
2523:             *@param  token  the token
2524:             */
2525:            protected void countLines(Token token) {
2526:                if (token == null) {
2527:                    return;
2528:                }
2529:
2530:                Token first = beginning(token);
2531:                Token current = first;
2532:                while (current != null) {
2533:                    switch (current.kind) {
2534:                    //case 4:
2535:                    case 5:
2536:                    case 6:
2537:                    case 7:
2538:                    case 8:
2539:                        lineCount++;
2540:                        break;
2541:                    case JavaParserConstants.SINGLE_LINE_COMMENT:
2542:                    case JavaParserConstants.FORMAL_COMMENT:
2543:                    case JavaParserConstants.MULTI_LINE_COMMENT:
2544:                    case JavaParserConstants.CATEGORY_COMMENT:
2545:                        countNewlines(current.image);
2546:                        break;
2547:                    default:
2548:                        //System.out.println("Unknown code:  " + current.kind);
2549:                        break;
2550:                    }
2551:                    current = current.next;
2552:                }
2553:            }
2554:
2555:            /**
2556:             *  Got to the beginning
2557:             *
2558:             *@param  tok  Description of Parameter
2559:             *@return      Description of the Returned Value
2560:             */
2561:            private Token beginning(Token tok) {
2562:                if (tok == null) {
2563:                    return null;
2564:                }
2565:
2566:                //  Find the first token
2567:                Token current = tok;
2568:                Token previous = tok.specialToken;
2569:                while (previous != null) {
2570:                    current = previous;
2571:                    previous = current.specialToken;
2572:                }
2573:
2574:                //  Return the first
2575:                return current;
2576:            }
2577:
2578:            /**
2579:             *  Counts the lines in the token's string
2580:             *
2581:             *@param  value  the string to count
2582:             */
2583:            private void countNewlines(String value) {
2584:                for (int ndx = 0; ndx < value.length(); ndx++) {
2585:                    if (value.charAt(ndx) == '\n') {
2586:                        lineCount++;
2587:                    }
2588:                }
2589:            }
2590:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.