update author list in license for (JAL-826)
[jalview.git] / utils / jalopy / docs / printer.html
1
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
4  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5  * 
6  * This file is part of Jalview.
7  * 
8  * Jalview is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License 
10  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11  * 
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
18 -->
19     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
20   <html><head>
21       <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
22    <title>4.3.&nbsp;Printer</title><link rel="stylesheet" href="site.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="manual.html" title="Jalopy User Manual"><link rel="up" href="settings.html" title="Chapter&nbsp;4.&nbsp;Settings"><link rel="previous" href="project.html" title="4.2.&nbsp;Projects"><link rel="next" href="whitespace.html" title="4.3.2.&nbsp;White Space"><link rel="preface" href="dedication.html" title="Dedication"><link rel="preface" href="acknowledge.html" title="Acknowledgements"><link rel="preface" href="introduction.html" title="Introduction"><link rel="part" href="part-core.html" title="Part&nbsp;I.&nbsp;Jalopy core"><link rel="chapter" href="installation.html" title="Chapter&nbsp;1.&nbsp;Installation"><link rel="chapter" href="build.html" title="Chapter&nbsp;2.&nbsp;Building"><link rel="chapter" href="usage.html" title="Chapter&nbsp;3.&nbsp;Usage"><link rel="chapter" href="settings.html" title="Chapter&nbsp;4.&nbsp;Settings"><link rel="part" href="part-plugins.html" title="Part&nbsp;II.&nbsp;Plug-ins"><link rel="chapter" href="plugin-ant.html" title="Chapter&nbsp;5.&nbsp;Ant Plug-in task"><link rel="chapter" href="plugin-console.html" title="Chapter&nbsp;6.&nbsp;Console Application"><link rel="chapter" href="plugin-eclipse.html" title="Chapter&nbsp;7.&nbsp;Eclipse Plug-in"><link rel="chapter" href="plugin-jbuilder.html" title="Chapter&nbsp;8.&nbsp;JBuilder OpenTool"><link rel="chapter" href="plugin-jdev.html" title="Chapter&nbsp;9.&nbsp;JDeveloper Extension"><link rel="chapter" href="plugin-jedit.html" title="Chapter&nbsp;10.&nbsp;jEdit Plug-in"><link rel="chapter" href="plugin-netbeans.html" title="Chapter&nbsp;11.&nbsp;NetBeans/Sun ONE Studio module"><link rel="appendix" href="dependencies.html" title="Appendix&nbsp;A.&nbsp;Library Dependencies"><link rel="appendix" href="license-bsd.html" title="Appendix&nbsp;B.&nbsp;The Jalopy BSD License"><link rel="appendix" href="license-antlr.html" title="Appendix&nbsp;C.&nbsp;ANTLR SOFTWARE RIGHTS"><link rel="appendix" href="license-apache.html" title="Appendix&nbsp;D.&nbsp;The Apache Software License, Version 1.1"><link rel="appendix" href="license-gnu.html" title="Appendix&nbsp;E.&nbsp;GNU GENERAL PUBLIC LICENSE Version 2, June 1991"><link rel="appendix" href="license-gnu-doc.html" title="Appendix&nbsp;F.&nbsp;GNU Free Documentation License Version 1.1, March 2000"><link rel="appendix" href="license-common-public.html" title="Appendix&nbsp;G.&nbsp;Common Public License Version 1.0"><link rel="appendix" href="license-sun-public.html" title="Appendix&nbsp;H.&nbsp;SUN PUBLIC LICENSE Version 1.0"><link rel="index" href="ix01.html" title="Index"><link rel="subsection" href="printer.html#braces" title="4.3.1.&nbsp;Braces"><link rel="subsection" href="whitespace.html" title="4.3.2.&nbsp;White Space"><link rel="subsection" href="indentation.html" title="4.3.3.&nbsp;Indentation"><link rel="subsection" href="wrapping.html" title="4.3.4.&nbsp;Wrapping"><link rel="subsection" href="separation.html" title="4.3.5.&nbsp;Blank Lines"><link rel="subsection" href="comments.html" title="4.3.6.&nbsp;Comments"><link rel="subsection" href="imports.html" title="4.3.7.&nbsp;Imports"><link rel="subsection" href="environment.html" title="4.3.8.&nbsp;Environment"><link rel="subsection" href="javadoc.html" title="4.3.9.&nbsp;Javadoc"><link rel="subsection" href="header.html" title="4.3.10.&nbsp;Header"><link rel="subsection" href="footer.html" title="4.3.11.&nbsp;Footer"><link rel="subsection" href="sorting.html" title="4.3.12.&nbsp;Sorting"><link rel="subsection" href="misc.html" title="4.3.13.&nbsp;Misc">
23       <meta name="description" content="Jalopy Java Source Code Formatter Beautifier Pretty Printer"> 
24       <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://jalopy.sf.net" r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://jalopy.sf.net" r (n 0 s 0 v 0 l 0))'> 
25     </head><body id="toppage" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table width="700" border="0" cellpadding="0" cellspacing="0" align="left"><tbody><tr><td><table cellpadding="0" cellspacing="0" width="100%" style="border:1px solid #336699"><tbody><tr><td height="16"></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr style="border:none"><td style="border:none"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="logo">JALOPY</td><td class="sublogo" valign="bottom">Java Source Code Formatter Beautifier Pretty Printer</td></tr></tbody></table></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr><td height="10"></td></tr><tr><td bgcolor="#ff8000" height="4"></td></tr><tr><td height="20" bgcolor="#336699" style="color:#ffffff;padding-left:10px"><a href="./index.html" class="navlink">Overview</a> &#149;
26                     <a href="./download.html" class="navlink">Download</a> &#149;
27                     <a href="./docs.html" class="navlink">Documentation</a> &#149;
28                     <a href="./plugins.html" class="navlink">Plug-ins</a> &#149;
29                     <a href="./links.html" class="navlink">Links</a> &#149;
30                     <a href="./contact.html" class="navlink">Contact</a></td></tr><tr><td height="1" bgcolor="#ffffff"></td></tr></tbody></table></td></tr><tr valign="top"><td valign="top" bgcolor="#ffffff"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td height="20" bgcolor="#faebd7" style="padding-left:15px"><a href="./features.html" class="navlink2">Features</a> |
31                     <a href="./history.html" class="navlink2">History</a> |
32                     <a href="./manual.html" class="navlink2">Manual</a> |
33                     <a href="./faq.html" class="navlink2">FAQ</a> |
34                     <a href="./api/index.html" class="navlink2">Javadoc</a></td></tr><tr><td height="20" bgcolor="#ffffff"></td></tr><tr><td bgcolor="#eeeecc" height="17" align="right" style="font-size:10px;padding-right:3px">
35                     This page generated: <strong>June 8 2004</strong></td></tr></tbody></table><table border="0" width="100%" cellspacing="0" cellpadding="5"><tr><td><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.3.&nbsp;Printer</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="project.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Settings</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="whitespace.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="printer"></a>4.3.&nbsp;Printer</h2></div></div><div></div></div><a class="indexterm" name="d0e1088"></a><p>
36 Lets you control all printer related settings.
37 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="braces"></a>4.3.1.&nbsp;Braces</h3></div></div><div></div></div><a class="indexterm" name="d0e1097"></a><p>
38 Controls the handling of curly braces (the Java block delimeters).
39 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="braces-style"></a>4.3.1.1.&nbsp;General</h4></div></div><div></div></div><a class="indexterm" name="d0e1105"></a><p>
40 Controls how the enclosing block delimeters - left and right curly
41 brace - are printed. You can either choose from a predefined set of common
42 styles or build one on your own.
43 </p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-style-styles"></a>4.3.1.1.1.&nbsp;Styles</h5></div></div><div></div></div><p>
44 Controls which brace style will be used to lay out blocks.
45 </p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-style-c"></a>
46 C style
47 </p><a class="indexterm" name="d0e1121"></a><p>
48 Selects the C brace style. This style is sometimes called "Allman style" or "BSD style".
49 </p><div class="example"><a name="ex-brace-style-c"></a><p class="title"><b>Example&nbsp;4.1.&nbsp;C style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
50 if (!isDone)
51 <span class="bold"><b>{</b></span>
52     doSomething();
53 <span class="bold"><b>}</b></span>
54 else
55 <span class="bold"><b>{</b></span>
56     System.err.println("Finished");
57 <span class="bold"><b>}</b></span>
58 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-sun"></a>
59 Sun style
60 </p><a class="indexterm" name="d0e1151"></a><p>
61 Selects the Sun brace style. Sometimes called "K&amp;R style".
62 </p><div class="example"><a name="ex-brace-style-sun"></a><p class="title"><b>Example&nbsp;4.2.&nbsp;Sun style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
63 if (!isDone) <span class="bold"><b>{</b></span>
64     doSomething();
65 <span class="bold"><b>}</b></span> else <span class="bold"><b>{</b></span>
66     System.err.println("Finished");
67 <span class="bold"><b>}</b></span>
68 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-gnu"></a>
69 GNU style
70 </p><a class="indexterm" name="d0e1181"></a><p>
71 Selects the GNU brace style.
72 </p><div class="example"><a name="ex-brace-style-gnu"></a><p class="title"><b>Example&nbsp;4.3.&nbsp;GNU style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
73 if (!isDone)
74   <span class="bold"><b>{</b></span>
75     doSomething();
76   <span class="bold"><b>}</b></span>
77 else
78   <span class="bold"><b>{</b></span>
79     System.err.println("Finished");
80   <span class="bold"><b>}</b></span>
81 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-custom"></a>
82 Custom style
83 </p><a class="indexterm" name="d0e1211"></a><p>
84 Selecting this option will enable you to freely choose between the different brace
85 style options discussed below.
86 </p></li></ul></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-wrapping"></a>4.3.1.1.2.&nbsp;Wrapping</h5></div></div><div></div></div><a class="indexterm" name="d0e1223"></a><p>
87 Controls the brace wrapping options.
88 </p><div class="itemizedlist"><ul type="disc"><li><p>
89 Newline before left brace
90 </p><p>
91 If enabled, always prints a newline before the left curly brace.
92 </p></li><li><p>
93 Newline after right brace
94 </p><p>
95 If enabled, prints a newline after the left curly brace (when possible).
96 </p></li><li><p>
97 Treat class/method blocks different
98 </p><p>
99 It is common in the Java developer community to have the opening brace
100 at the end of the line of the keyword for all types of blocks (Sun brace style).
101 One may find the C++ convention of treating class/interface and method/constructor
102 blocks different from other blocks useful. With this switch you can achieve
103 exactly that: if enabled, class/interface and method/constructor blocks are
104 then always printed in C brace style (newline before left brace).
105 </p></li><li><p><a name="braces-different-wrapped"></a>
106 Treat class/method blocks different if wrapped
107 </p><p>
108 With this switch enabled, the opening brace for class/interface or
109 method/constructor blocks will always be printed on a new line (C style), if
110 either the parameter list spawns several lines and a <tt class="literal">throws</tt>
111 clause follows, or one of the possible clauses (<tt class="literal">extends</tt>,
112 <tt class="literal">implements</tt>, <tt class="literal">throws</tt>) was wrapped.
113 </p></li></ul></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-whitespace"></a>4.3.1.1.3.&nbsp;Whitespace</h5></div></div><div></div></div><a class="indexterm" name="d0e1266"></a><p>
114 Controls the indentation whitespace for the left and right curly brace.
115 </p><div class="itemizedlist"><ul type="disc"><li><p>
116 Before left brace
117 </p><p>
118 Number of spaces to print before the left curly brace.
119 </p></li><li><p>
120 After left brace
121 </p><p>
122 Number of spaces to print after the left curly brace.
123 </p></li><li><p>
124 After right brace
125 </p><p>
126 Number of spaces to print after the right curly brace.
127 </p></li></ul></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="braces-misc"></a>4.3.1.2.&nbsp;Misc</h4></div></div><div></div></div><p>
128 Controls miscellaneous brace options.
129 </p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-insert"></a>4.3.1.2.1.&nbsp;Insert braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1297"></a><p>
130 Per definition braces are superfluous on single statements, but it is
131 a common recommendation that braces should be always used in such cases.
132 With this option, you can specify whether missing braces for single
133 statements should be inserted for the control statements <tt class="function">if</tt>,
134 <tt class="function">for</tt>, <tt class="function">while</tt> and <tt class="function">do-while</tt>.
135 </p><p>
136 Enabling this option for <tt class="function">while</tt> statements would render
137 </p><div class="example"><a name="ex-brace-insertion"></a><p class="title"><b>Example&nbsp;4.4.&nbsp;Brace insertion</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
138 while (!isDone)
139     doSomething();
140 </pre></td></tr></table><p>
141 into
142 </p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
143 while (!isDone)
144 {
145     doSomething();
146 }
147 </pre></td></tr></table></div><p></p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-remove"></a>4.3.1.2.2.&nbsp;Remove braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1334"></a><p>
148 It is permittable to remove braces in case they are superfluous. This not only
149 applies to the control statements <tt class="function">if</tt>, <tt class="function">for</tt>,
150 <tt class="function">while</tt> and <tt class="function">do-while</tt>, but also to every
151 block in general (remember a block is just a sequence of statements,
152 local class declarations and local variable declaration statements within
153 braces).
154 </p><div class="example"><a name="ex-brace-removal"></a><p class="title"><b>Example&nbsp;4.5.&nbsp;Brace removal</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
155 for (int i = 0; i &lt; 100; i++)
156 {
157     sum += value[i];
158 }
159 </pre></td></tr></table><p>
160 would become
161 </p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
162 for (int i = 0; i &lt; 100; i++)
163     sum += value[i];
164 </pre></td></tr></table></div><p></p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-empty"></a>4.3.1.2.3.&nbsp;Empty braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1366"></a><a class="indexterm" name="d0e1369"></a><p>
165 Controls how empty braces should be handled. If no option is selected,
166 they are left untouched.
167 </p><div class="example"><a name="ex-brace-empty"></a><p class="title"><b>Example&nbsp;4.6.&nbsp;Empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
168 if (in != null)
169 {
170     try
171     {
172         in.close();
173     }
174     catch (IOException ignored)
175     {
176     }
177 }
178 </pre></td></tr></table></div><p>
179 All options don't apply to class/interface and method/constructor bodies but
180 are only used for control statements and blocks.
181 </p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-empty-statement"></a>
182 Insert empty statement
183 <a class="indexterm" name="d0e1387"></a>
184 <a class="indexterm" name="d0e1393"></a>
185
186 </p><p>
187 Inserts an empty statement to make it obvious for the reader that the empty braces
188 are intentional.
189 </p><div class="example"><a name="ex-braces-empty-statement"></a><p class="title"><b>Example&nbsp;4.7.&nbsp;Empty braces with empty statement</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
190 if (in != null)
191 {
192     try
193     {
194         in.close();
195     }
196     catch (IOException ignored)
197     {
198         <span class="bold"><b>;</b></span>
199     }
200 }
201 </pre></td></tr></table></div></li></ul></div><div class="itemizedlist"><ul type="disc"><li><p>
202 Cuddle braces
203 </p><p><a name="braces-empty-cuddle"></a>
204 Cuddles the braces. They will be printed right after the control statement.
205 <a class="indexterm" name="d0e1413"></a>
206 <a class="indexterm" name="d0e1419"></a>
207 </p><div class="example"><a name="ex-braces-empty-cuddle"></a><p class="title"><b>Example&nbsp;4.8.&nbsp;Cuddled empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
208 if (in != null)
209 {
210     try
211     {
212         in.close();
213     }
214     catch (IOException ignored) <span class="bold"><b>{}</b></span>
215 }
216 </pre></td></tr></table></div><p></p></li></ul></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="project.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="settings.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="whitespace.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.2.&nbsp;Projects&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.3.2.&nbsp;White Space</td></tr></table></div></td></tr></table></td></tr><tr><td bgcolor="#eeeecc" height="17" style="font-size:9px;padding-left:5px"><a href="#toppage">to top</a></td></tr><tr><td height="30"><br></td></tr><tr><td height="3"></td></tr><tr><td bgcolor="#336699" height="1"></td></tr><tr><td height="1"></td></tr><tr><td bgcolor="#336699" height="16"></td></tr><tr><td bgcolor="#ff9966" height="4"></td></tr><tr><td class="footer" align="center" height="15" valign="middle">
217             Copyright &copy; 2001-2004, <a class="footer" href="./contact.html">Marco Hunsicker</a>. All rights reserved. Hosted by <a href="http://sourceforge.net">SourceForge.net</a></td></tr></tbody></table><img src="http://sourceforge.net/sflogo.php?group_id=45216&amp;type=1" width="1" height="1" border="0" hspace="0" vspace="0" alt=""></body></html>