?? indentation.html
字號:
during the developing phase.</p><div class="example"><a name="ex-indentation-misc-first-column"></a><p class="title"><b>Example 4.49. First column comment (indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting"> public static Printer create(AST node) { <span class="bold"><b>/* if (node == null) { return new NullPrinter(); } */</b></span> return create(node.getType()); }</pre></td></tr></table></div><p></p><div class="example"><a name="ex-indentation-misc-first-column-unindented"></a><p class="title"><b>Example 4.50. First column comment (unindented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting"> public static Printer create(AST node) {<span class="bold"><b>/* if (node == null) { return new NullPrinter(); }*/</b></span> return create(node.getType()); }</pre></td></tr></table></div><p></p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="indentation-align"></a>4.3.3.3. Align</h4></div></div><div></div></div><a class="indexterm" name="d0e2450"></a><a class="indexterm" name="d0e2455"></a><div class="itemizedlist"><ul type="disc"><li><p><a name="indentation-align-ident"></a>Variable identifiers</p><p>If enabled, aligns the identifiers of variable declarations.</p><a class="indexterm" name="d0e2464"></a><div class="example"><a name="ex-indentation-misc-align-ident"></a><p class="title"><b>Example 4.51. Variable identifiers</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">String text = "text";int a = -1;History.Entry entry = new History.Entry(text);</pre></td></tr></table></div><p></p><div class="example"><a name="ex-indentation-align-ident-aligned"></a><p class="title"><b>Example 4.52. Variable identifiers (aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">String text = "text";int a = -1;History.Entry entry = new History.Entry(text);</pre></td></tr></table></div><p></p></li><li><p><a name="indentation-align-assign"></a>Variable assignments</p><p>If enabled, aligns the assignment parts of variable declarations or, surprise, assignments.</p><a class="indexterm" name="d0e2488"></a><a class="indexterm" name="d0e2495"></a><div class="example"><a name="ex-indentation-align-assign-aligned"></a><p class="title"><b>Example 4.53. Variable assignments (aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">String text = "text";int a = -1;History.Entry entry = new History.Entry(text);</pre></td></tr></table></div><p>If both variable alignment options are enabled, you can achieve a style likethe following:</p><div class="example"><a name="ex-indentation-align-both"></a><p class="title"><b>Example 4.54. Variable identifiers/assignments (both aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">String text = "text";int a = -1;History.Entry entry = new History.Entry(text);</pre></td></tr></table></div><p></p></li><li><p><a name="indentation-align-params"></a>Method Def parameters</p><p>If enabled, aligns the parameters of method declarations. This only applies ifall parameters will be wrapped; either because wrapping is forced or themax. line length is reached. To force aligning, you have to enable thewrapping for method parameters (See <a href="wrapping.html#wrap-method-params">Method Def parameters</a>).</p><a class="indexterm" name="d0e2524"></a><a class="indexterm" name="d0e2527"></a><div class="example"><a name="ex-indentation-align-params"></a><p class="title"><b>Example 4.55. Method declaration parameters</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public static File create(final File file, File directory, int backupLevel){ ...}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-indentation-align-params-aligned"></a><p class="title"><b>Example 4.56. Method declaration parameters (aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">public static File create(final File file, File directory, int backupLevel){ ...}</pre></td></tr></table></div><p></p></li><li><p><a name="indentation-align-method-chains"></a>Method Call chains</p><p>If disabled, indentation happens according to the current indentation level.</p><div class="example"><a name="ex-indentation-align-call"></a><p class="title"><b>Example 4.57. Method Call chain (standard indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">Fachschluesselerzeugung.createService().getNeuerFachschluesselServiceService( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT);</pre></td></tr></table></div><p>Otherwise indentation is performed relative to the column offset of the first chain link.</p><div class="example"><a name="ex-indentation-align-call-aligned"></a><p class="title"><b>Example 4.58. Method Call chain (aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">Fachschluesselerzeugung.createService() .getNeuerFachschluesselServiceService( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT);</pre></td></tr></table></div><p></p></li><li><p><a name="indentation-align-ternary"></a>Ternary expressions</p><p>If disabled, ternary expressions are printed according to the current<a href="indentation.html#indentation-policy" title="4.3.3.1.1. Policy">indentation policy</a>.</p><div class="example"><a name="ex-indentation-ternary-standard"></a><p class="title"><b>Example 4.59. Ternary operators (standard indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting"> alpha = (aLongBooleanExpression) ? beta | : gamma; |</pre></td></tr></table></div><p></p><div class="example"><a name="ex-indentation-ternary-deep"></a><p class="title"><b>Example 4.60. Ternary operators (deep indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting"> alpha = (aLongBooleanExpression) ? beta | : gamma; |</pre></td></tr></table></div><p>If enabled, the second operator will always be aligned relative to the first one.</p><div class="example"><a name="ex-indentation-ternary-align"></a><p class="title"><b>Example 4.61. Ternary expresssions (aligned)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting"> alpha = (aLongBooleanExpression) ? beta | : gamma; |</pre></td></tr></table></div><p>Note that this switch only takes affect, if indeed a line break was insertedbefore the second expression. You can force such line breaks with the<a href="wrapping.html#wrap-ternary-colon">Wrap always before ternary expression colon</a> setting.</p></li></ul></div><p></p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="indentation-continuation"></a>4.3.3.4. Continuation</h4></div></div><div></div></div><a class="indexterm" name="d0e2597"></a><a class="indexterm" name="d0e2602"></a><p>Lets you specify extra indentation for consectutive lines of certain expressions.</p><div class="itemizedlist"><ul type="disc"><li><p><a name="indentation-misc-continuation-if"></a>Blocks</p><p>The Sun brace style could make seeing the statement body difficult. Toworkaround this problem, you may want to use continuation indentation in case you like thisbrace style. This setting applies for <tt class="literal">if</tt>, <tt class="literal">for</tt>, <tt class="literal">while</tt>and <tt class="literal">do-while</tt> blocks.</p><div class="example"><a name="ex-indentation-misc-non-continuation"></a><p class="title"><b>Example 4.62. Non-continuation indentation</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">if ((condition1 && condition2) || (condition3 && condition4) || !(condition5 && condition6)) { // BAD WRAPS doSomethingAboutIt(); // MAKE THIS LINE EASY TO MISS}</pre></td></tr></table></div><p></p><div class="example"><a name="ex-indentation-misc-contiunation"></a><p class="title"><b>Example 4.63. Continuation indentation</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">if ((condition1 && condition2) || (condition3 && condition4) || !(condition5 && condition6)) { doSomethingAboutIt();}</pre></td></tr></table></div><p>Refer to <a href="printer.html#braces-style-styles" title="4.3.1.1.1. Styles">Section 4.3.1.1.1, “Styles”</a> for the available brace style options.</p></li><li><p><a name="indentation-misc-ternary-if-else"></a>Operators</p><p>If enabled, indentation will be increased before an operand will be printed.</p><div class="example"><a name="ex-indentation-misc-ternary-if-else"></a><p class="title"><b>Example 4.64. Ternary expression (deep indented)</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">String comma = spaceAfterComma --->? COMMA_SPACE --->: COMMA;</pre></td></tr></table></div><p></p></li></ul></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="whitespace.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="printer.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="wrapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.3.2. White Space </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 4.3.4. Wrapping</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"> Copyright © 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&type=1" width="1" height="1" border="0" hspace="0" vspace="0" alt=""></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -