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


001:        /*
002:         *  Author:  Chris Seguin
003:         *
004:         *  This software has been developed under the copyleft
005:         *  rules of the GNU General Public License.  Please
006:         *  consult the GNU General Public License for more
007:         *  details about use and distribution of this software.
008:         */
009:        package org.acm.seguin.pretty;
010:
011:        import java.io.File;
012:        import org.acm.seguin.pretty.sort.MultipleOrdering;
013:
014:        /**
015:         *  Testing tool that creates a pretty print file that can be instrumented to
016:         *  update the print data object.
017:         *
018:         *@author    Chris Seguin
019:         */
020:        class TestPrettyPrintFile extends PrettyPrintFile {
021:            private boolean reformatComments;
022:            private boolean ownline;
023:            private boolean standardIndent;
024:            private int singleLineIndent;
025:            private int fieldSpacing;
026:            private boolean keepAll;
027:            private boolean ownlineCode;
028:            private boolean sharedIncr;
029:            private int absoluteSpace;
030:            private boolean castSpace = true;
031:            private boolean documentNestedClasses = true;
032:            private int cStyleCommentForm = PrintData.CSC_ALIGN_STAR;
033:            private int cStyleIndent = 2;
034:            private boolean forceBlock = true;
035:            private int classBlockStyle = PrintData.BLOCK_STYLE_C;
036:            private int methodBlockStyle = PrintData.BLOCK_STYLE_C;
037:            private int codeBlockStyle = PrintData.BLOCK_STYLE_C;
038:            private boolean exprSpace = false;
039:
040:            /**
041:             *  Constructor for the TestPrettyPrintFile object
042:             */
043:            public TestPrettyPrintFile() {
044:                super ();
045:
046:                reformatComments = true;
047:                ownline = true;
048:                standardIndent = false;
049:                singleLineIndent = 0;
050:                keepAll = false;
051:                ownlineCode = true;
052:                sharedIncr = true;
053:                absoluteSpace = 50;
054:            }
055:
056:            /**
057:             *  Sets the ReformatComments attribute of the TestPrettyPrintFile object
058:             *
059:             *@param  value  The new ReformatComments value
060:             */
061:            public void setReformatComments(boolean value) {
062:                reformatComments = value;
063:            }
064:
065:            /**
066:             *  Sets the SingleLineCommentOwnline attribute of the TestPrettyPrintFile
067:             *  object
068:             *
069:             *@param  value  The new SingleLineCommentOwnline value
070:             */
071:            public void setSingleLineCommentOwnline(boolean value) {
072:                ownline = value;
073:            }
074:
075:            /**
076:             *  Sets the SingleLineCommentStandardIndent attribute of the
077:             *  TestPrettyPrintFile object
078:             *
079:             *@param  value  The new SingleLineCommentStandardIndent value
080:             */
081:            public void setSingleLineCommentStandardIndent(boolean value) {
082:                standardIndent = value;
083:            }
084:
085:            /**
086:             *  Sets the SingleLineIndent attribute of the TestPrettyPrintFile object
087:             *
088:             *@param  value  The new SingleLineIndent value
089:             */
090:            public void setSingleLineIndent(int value) {
091:                singleLineIndent = value;
092:            }
093:
094:            /**
095:             *  Sets the KeepAll attribute of the TestPrettyPrintFile object
096:             *
097:             *@param  value  The new KeepAll value
098:             */
099:            public void setKeepAll(boolean value) {
100:                keepAll = value;
101:            }
102:
103:            /**
104:             *  Sets the SingleLineCommentOwnlineCode attribute of the
105:             *  TestPrettyPrintFile object
106:             *
107:             *@param  value  The new SingleLineCommentOwnlineCode value
108:             */
109:            public void setSingleLineCommentOwnlineCode(boolean value) {
110:                ownlineCode = value;
111:            }
112:
113:            /**
114:             *  Sets the SingleLineCommentSharedIncremental attribute of the
115:             *  TestPrettyPrintFile object
116:             *
117:             *@param  value  The new SingleLineCommentSharedIncremental value
118:             */
119:            public void setSingleLineCommentSharedIncremental(boolean value) {
120:                sharedIncr = value;
121:            }
122:
123:            /**
124:             *  Sets the AbsoluteSpace attribute of the TestPrettyPrintFile object
125:             *
126:             *@param  value  The new AbsoluteSpace value
127:             */
128:            public void setAbsoluteSpace(int value) {
129:                absoluteSpace = value;
130:            }
131:
132:            /**
133:             *  Sets the DynamicFieldSpacing attribute of the TestPrettyPrintFile object
134:             *
135:             *@param  value  The new DynamicFieldSpacing value
136:             */
137:            public void setDynamicFieldSpacing(int value) {
138:                fieldSpacing = value;
139:            }
140:
141:            /**
142:             *  Sets the CStyle attribute of the TestPrettyPrintFile object
143:             *
144:             *@param  value  The new CStyle value
145:             */
146:            public void setCStyle(int value) {
147:                cStyleCommentForm = value;
148:            }
149:
150:            /**
151:             *  Sets the CStyleIndent attribute of the TestPrettyPrintFile object
152:             *
153:             *@param  value  The new CStyleIndent value
154:             */
155:            public void setCStyleIndent(int value) {
156:                cStyleIndent = value;
157:            }
158:
159:            /**
160:             *  Sets the ForceBlock attribute of the TestPrettyPrintFile object
161:             *
162:             *@param  value  The new ForceBlock value
163:             */
164:            public void setForceBlock(boolean value) {
165:                forceBlock = value;
166:            }
167:
168:            public void setClassBlockStyle(int value) {
169:                classBlockStyle = value;
170:            }
171:
172:            /**
173:             *  Sets the CastSpace attribute of the TestPrettyPrintFile object
174:             *
175:             *@param  value  The new CastSpace value
176:             */
177:            public void setCastSpace(boolean value) {
178:                castSpace = value;
179:            }
180:
181:            /**
182:             *  Sets the ExpressionSpace attribute of the TestPrettyPrintFile object
183:             *
184:             *@param  value  The new ExpressionSpace value
185:             */
186:            public void setExpressionSpace(boolean value) {
187:                exprSpace = value;
188:            }
189:
190:            /**
191:             *  Sets the DocumentNestedClasses attribute of the TestPrettyPrintFile
192:             *  object
193:             *
194:             *@param  value  The new DocumentNestedClasses value
195:             */
196:            public void setDocumentNestedClasses(boolean value) {
197:                documentNestedClasses = value;
198:            }
199:
200:            /**
201:             *  Return the appropriate print data
202:             *
203:             *@param  input  Description of Parameter
204:             *@return        the print data
205:             */
206:            protected PrintData getPrintData(File input) {
207:                //  Create the new stream
208:                PrintData pd = new PrintData(getWriter(input));
209:
210:                pd.setReformatComments(reformatComments);
211:                pd.setOwnline(ownline);
212:                pd.setAllJavadocKept(keepAll);
213:                pd.setSharedIncr(sharedIncr);
214:                pd.setOwnlineCode(ownlineCode);
215:                pd.setAbsoluteCommentSpacing(absoluteSpace);
216:                pd.setDynamicFieldSpacing(fieldSpacing);
217:                pd.setCStyleFormatCode(cStyleCommentForm);
218:                pd.setCStyleIndent(cStyleIndent);
219:                pd.setForceBlock(forceBlock);
220:                pd.setClassBlockStyle(classBlockStyle);
221:                pd.setMethodBlockStyle(methodBlockStyle);
222:                pd.setCodeBlockStyle(codeBlockStyle);
223:                pd.setCastSpace(castSpace);
224:                pd.setExpressionSpace(exprSpace);
225:                pd.setDocumentNestedClasses(documentNestedClasses);
226:                pd.setMultipleOrdering(morder);
227:                pd.setSingleLineJavadoc(allowSingleLineJavadocs);
228:                pd.setVariablesAlignWithBlock(variablesAlignWithBlock);
229:                pd.setElseOnNewLine(elseOnNewLine);
230:                pd.setCaseIndent(caseIndent);
231:                pd.setImportSortImportant(importSortImportant);
232:                pd.setImportSortNeighbourhood(importSortNeighbourhood);
233:                pd.setSortTop(sortTop);
234:                pd.setEmptyBlockOnSingleLine(emptyBlock);
235:                pd.setInsertSpaceLocalVariables(localVariableSpaceInsert);
236:                pd.setRemoveExcessBlocks(removeExcessBlocks);
237:                pd.setLinesAfterPackage(linesAfterPackage);
238:                pd
239:                        .setMaintainNewlinesAroundImports(maintainNewlinesAroundImports);
240:                pd.setLinesBeforeClass(linesBeforeClass);
241:                pd.setIndentInInitializer(indentInitializer);
242:                pd.setBangSpace(bangSpace);
243:                pd.setKeepErroneousJavadocTags(keepErroneousJavadocTags);
244:                pd.setSpaceInsideCast(spaceInsideCast);
245:                pd.setSpaceAfterMethod(spaceAfterMethod);
246:                pd.setSpaceAroundOperators(spaceAroundOps);
247:                pd.setSpaceAfterKeyword(spaceAfterKeyword);
248:                pd.setArrayInitializerIndented(indentBracesInitializer);
249:
250:                pd.setLineBeforeClassBody(lineBeforeClassBody);
251:                pd.setLineBeforeExtends(lineBeforeExtends);
252:                pd.setExtendsIndentation(extendsIndentation);
253:                pd.setLineBeforeImplements(lineBeforeImplements);
254:                pd
255:                        .setLineBeforeMultistatementMethodBody(lineBeforeMultistatementMethodBody);
256:                pd.setImplementsIndentation(implements Indentation);
257:                pd.setArrayInitializerIndented(arrayInitializerIndented);
258:                pd.setModifierOrder(modifierOrder);
259:                pd.setAlignStarsWithSlash(alignStarsWithSlash);
260:                pd.setCStyleOwnline(c_ownline);
261:                pd.setLineUpParams(lineUpParams);
262:                pd.setSortThrowsStatement(sortThrowsStatement);
263:                pd.setSortExtendsStatement(sortExtendsStatement);
264:                pd.setSortImplementsStatement(sortImplementsStatement);
265:
266:                //  Set the javadoc tags values
267:                JavadocTags jt = JavadocTags.get();
268:                jt.reload();
269:
270:                jt.setExceptionTag(exceptionTag);
271:                if (paramDescr != null) {
272:                    jt.setParamDescr(paramDescr);
273:                }
274:
275:                return pd;
276:            }
277:
278:            private boolean sortThrowsStatement;
279:
280:            public void setSortThrowsStatement(boolean sortThrowsStatement) {
281:                this .sortThrowsStatement = sortThrowsStatement;
282:            }
283:
284:            private boolean sortExtendsStatement;
285:
286:            public void setSortExtendsStatement(boolean sortExtendsStatement) {
287:                this .sortExtendsStatement = sortExtendsStatement;
288:            }
289:
290:            private boolean sortImplementsStatement;
291:
292:            public void setSortImplementsStatement(
293:                    boolean sortImplementsStatement) {
294:                this .sortImplementsStatement = sortImplementsStatement;
295:            }
296:
297:            private boolean lineUpParams = false;
298:
299:            public void setLineUpParams(boolean value) {
300:                lineUpParams = value;
301:            }
302:
303:            private MultipleOrdering morder = null;
304:
305:            public void setMultipleOrdering(MultipleOrdering value) {
306:                morder = value;
307:            }
308:
309:            public void setCodeBlockStyle(int value) {
310:                codeBlockStyle = value;
311:            }
312:
313:            public void setMethodBlockStyle(int value) {
314:                methodBlockStyle = value;
315:            }
316:
317:            private boolean allowSingleLineJavadocs = false;
318:
319:            public void setSingleLineJavadocs(boolean value) {
320:                allowSingleLineJavadocs = value;
321:            }
322:
323:            private boolean variablesAlignWithBlock = false;
324:
325:            public void setVariablesAlignWithBlock(boolean value) {
326:                variablesAlignWithBlock = value;
327:            }
328:
329:            private boolean elseOnNewLine = true;
330:
331:            public void setElseOnNewLine(boolean value) {
332:                elseOnNewLine = value;
333:            }
334:
335:            private int caseIndent = 1;
336:
337:            public void setCaseIndent(int value) {
338:                caseIndent = value;
339:            }
340:
341:            private String[] importSortImportant;
342:            private int importSortNeighbourhood;
343:
344:            public void setImportSortImportant(String[] newImportSortImportant) {
345:                importSortImportant = newImportSortImportant;
346:            }
347:
348:            public void setImportSortNeighbourhood(
349:                    int newImportSortNeighbourhood) {
350:                importSortNeighbourhood = newImportSortNeighbourhood;
351:            }
352:
353:            private boolean sortTop = false;
354:
355:            public void setSortTop(boolean value) {
356:                sortTop = value;
357:            }
358:
359:            private boolean emptyBlock = false;
360:
361:            public void setEmptyBlockOnSingleLine(boolean value) {
362:                emptyBlock = value;
363:            }
364:
365:            private boolean localVariableSpaceInsert = false;
366:
367:            public void setInsertSpaceLocalVariables(boolean value) {
368:                localVariableSpaceInsert = value;
369:            }
370:
371:            private boolean removeExcessBlocks;
372:
373:            public void setRemoveExcessBlocks(boolean value) {
374:                removeExcessBlocks = value;
375:            }
376:
377:            private int linesAfterPackage = 1;
378:
379:            public void setLinesAfterPackage(int value) {
380:                linesAfterPackage = value;
381:            }
382:
383:            private boolean maintainNewlinesAroundImports = true;
384:
385:            public void setMaintainNewlinesAroundImports(boolean value) {
386:                maintainNewlinesAroundImports = value;
387:            }
388:
389:            private int linesBeforeClass = 0;
390:
391:            public void setLinesBeforeClass(int value) {
392:                linesBeforeClass = value;
393:            }
394:
395:            private boolean indentInitializer = false;
396:
397:            public void setIndentInInitializer(boolean value) {
398:                indentInitializer = value;
399:            }
400:
401:            private boolean bangSpace = false;
402:
403:            public void setBangSpace(boolean value) {
404:                bangSpace = value;
405:            }
406:
407:            private String exceptionTag = "exception";
408:
409:            public void setExceptionTag(String value) {
410:                exceptionTag = value;
411:            }
412:
413:            private boolean keepErroneousJavadocTags = false;
414:
415:            public void setKeepErroneousJavadocTags(boolean value) {
416:                keepErroneousJavadocTags = value;
417:            }
418:
419:            private boolean spaceInsideCast = false;
420:
421:            public void setSpaceInsideCast(boolean way) {
422:                spaceInsideCast = way;
423:            }
424:
425:            private boolean spaceAfterMethod = false;
426:
427:            public void setSpaceAfterMethod(boolean way) {
428:                spaceAfterMethod = way;
429:            }
430:
431:            private boolean spaceAroundOps = true;
432:
433:            public void setSpaceAroundOperators(boolean way) {
434:                spaceAroundOps = way;
435:            }
436:
437:            private boolean spaceAfterKeyword = true;
438:
439:            public void setSpaceAfterKeyword(boolean way) {
440:                spaceAfterKeyword = way;
441:            }
442:
443:            private boolean indentBracesInitializer = true;
444:
445:            public void setIndentBracesInitializer(boolean way) {
446:                indentBracesInitializer = way;
447:            }
448:
449:            private int javadocMaximum = 80;
450:
451:            public void setJavadocWordWrapMaximum(int wrap) {
452:                javadocMaximum = wrap;
453:            }
454:
455:            private int javadocMinimum = 80;
456:
457:            public void setJavadocWordWrapMinimum(int wrap) {
458:                javadocMinimum = wrap;
459:            }
460:
461:            private String paramDescr = null;
462:
463:            public void setParamDescr(String paramDescr) {
464:                this .paramDescr = paramDescr;
465:            }
466:
467:            private boolean lineBeforeClassBody = false;
468:
469:            public void setLineBeforeClassBody(boolean value) {
470:                lineBeforeClassBody = value;
471:            }
472:
473:            private boolean lineBeforeExtends = false;
474:
475:            public void setLineBeforeExtends(boolean value) {
476:                lineBeforeExtends = value;
477:            }
478:
479:            private int extendsIndentation = 0;
480:
481:            public void setExtendsIndentation(int value) {
482:                extendsIndentation = value;
483:            }
484:
485:            private boolean lineBeforeImplements = false;
486:
487:            public void setLineBeforeImplements(boolean value) {
488:                lineBeforeImplements = value;
489:            }
490:
491:            private boolean lineBeforeMultistatementMethodBody = false;
492:
493:            public void setLineBeforeMultistatementMethodBody(boolean value) {
494:                lineBeforeMultistatementMethodBody = value;
495:            }
496:
497:            private int implements Indentation = 0;
498:
499:            public void setImplementsIndentation(int value) {
500:                implements Indentation = value;
501:            }
502:
503:            private boolean arrayInitializerIndented = true;
504:
505:            public void setArrayInitializerIndented(boolean value) {
506:                arrayInitializerIndented = value;
507:            }
508:
509:            private int modifierOrder = PrintData.ALPHABETICAL_ORDER;
510:
511:            public void setModifierOrder(int value) {
512:                modifierOrder = value;
513:            }
514:
515:            private boolean alignStarsWithSlash = false;
516:
517:            public void setAlignStarsWithSlash(boolean value) {
518:                alignStarsWithSlash = value;
519:            }
520:
521:            private boolean c_ownline = true;
522:
523:            public void setCStyleOwnline(boolean ownline) {
524:                c_ownline = ownline;
525:            }
526:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.