From 5494cc056a64aa2c66727087435cad880a896486 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Fri, 2 Mar 2012 20:40:08 +0000 Subject: [PATCH] enable OneStatementPerLine rule; fix violations git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1296441 13f79535-47bb-0310-9956-ffa450edef68 --- checkstyle-5.5.xml | 2 +- .../fop/hyphenation/UnicodeClasses.java | 8 +++++-- .../fop/afp/goca/GraphicsSetProcessColor.java | 4 +++- .../fonts/GlyphProcessingState.java | 18 ++++++++++----- .../fop/complexscripts/fonts/GlyphTable.java | 3 ++- .../OTFAdvancedTypographicTableReader.java | 22 +++++++++++++++---- .../scripts/DefaultScriptProcessor.java | 17 +++++++++----- .../scripts/DevanagariScriptProcessor.java | 6 +++-- .../scripts/GujaratiScriptProcessor.java | 6 +++-- .../scripts/GurmukhiScriptProcessor.java | 6 +++-- .../fop/complexscripts/util/CharScript.java | 3 ++- .../layoutmgr/inline/TextLayoutManager.java | 3 ++- .../fop/render/intermediate/IFUtil.java | 3 ++- src/java/org/apache/fop/util/XMLUtil.java | 3 ++- 14 files changed, 74 insertions(+), 30 deletions(-) diff --git a/checkstyle-5.5.xml b/checkstyle-5.5.xml index 293f11bb4..da4cc32d1 100644 --- a/checkstyle-5.5.xml +++ b/checkstyle-5.5.xml @@ -188,7 +188,7 @@ - + diff --git a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java index ec04b90a2..8a5327a0e 100644 --- a/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java +++ b/src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java @@ -151,8 +151,12 @@ public final class UnicodeClasses { /** * The column numbers in the UCD file */ - public static final int UNICODE = 0, GENERAL_CATEGORY = 2, SIMPLE_UPPERCASE_MAPPING = 12, - SIMPLE_LOWERCASE_MAPPING = 13, SIMPLE_TITLECASE_MAPPING = 14, NUM_FIELDS = 15; + public static final int UNICODE = 0; + public static final int GENERAL_CATEGORY = 2; + public static final int SIMPLE_UPPERCASE_MAPPING = 12; + public static final int SIMPLE_LOWERCASE_MAPPING = 13; + public static final int SIMPLE_TITLECASE_MAPPING = 14; + public static final int NUM_FIELDS = 15; /** * Generate classes.xml from Unicode Character Database files diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java index 07d6c78af..fc21c0f60 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java +++ b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java @@ -44,7 +44,9 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder { * X'08' CIELAB * X'40' Standard OCA color space */ - private static final byte RGB = 0x01, CMYK = 0x04, CIELAB = 0x08; + private static final byte RGB = 0x01; + private static final byte CMYK = 0x04; + private static final byte CIELAB = 0x08; private final Color color; private final int componentsSize; diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java b/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java index acccdc86c..4b04b1ca9 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java +++ b/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java @@ -256,7 +256,8 @@ public class GlyphProcessingState { if ( consumed == 0 ) { consumed = 1; } - index += consumed; consumed = 0; + index += consumed; + consumed = 0; if ( index > indexLast ) { index = indexLast; } @@ -297,7 +298,8 @@ public class GlyphProcessingState { if ( consumed == 0 ) { consumed = 1; } - index -= consumed; consumed = 0; + index -= consumed; + consumed = 0; if ( index < 0 ) { index = 0; } @@ -452,7 +454,8 @@ public class GlyphProcessingState { } else { if ( ( ignoreTester == null ) || ! ignoreTester.test ( gi, getLookupFlags() ) ) { if ( k < count ) { - glyphs [ k++ ] = gi; counted++; + glyphs [ k++ ] = gi; + counted++; } else { break; } @@ -478,7 +481,8 @@ public class GlyphProcessingState { } else { if ( ( ignoreTester == null ) || ! ignoreTester.test ( gi, getLookupFlags() ) ) { if ( k < count ) { - glyphs [ k++ ] = gi; counted++; + glyphs [ k++ ] = gi; + counted++; } else { break; } @@ -698,7 +702,8 @@ public class GlyphProcessingState { } else { if ( ( ignoreTester == null ) || ! ignoreTester.test ( gi, getLookupFlags() ) ) { if ( k < count ) { - associations [ k++ ] = getAssociation ( i - index ); counted++; + associations [ k++ ] = getAssociation ( i - index ); + counted++; } else { break; } @@ -725,7 +730,8 @@ public class GlyphProcessingState { } else { if ( ( ignoreTester == null ) || ! ignoreTester.test ( gi, getLookupFlags() ) ) { if ( k < count ) { - associations [ k++ ] = getAssociation ( i - index ); counted++; + associations [ k++ ] = getAssociation ( i - index ); + counted++; } else { break; } diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java b/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java index 91f8d4924..427973359 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java +++ b/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java @@ -516,7 +516,8 @@ public class GlyphTable { added = true; } else if ( d == 0 ) { // duplicate entry is ignored - added = false; subtable = null; + added = false; + subtable = null; } } // append at end of list diff --git a/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java b/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java index 5fe2be852..c33cf140e 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java +++ b/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java @@ -1680,11 +1680,23 @@ public final class OTFAdvancedTypographicTableReader { int df = in.readTTFUShort(); int s1, m1, dm, dd, s2; if ( df == 1 ) { - s1 = 14; m1 = 0x3; dm = 1; dd = 4; s2 = 2; + s1 = 14; + m1 = 0x3; + dm = 1; + dd = 4; + s2 = 2; } else if ( df == 2 ) { - s1 = 12; m1 = 0xF; dm = 7; dd = 16; s2 = 4; + s1 = 12; + m1 = 0xF; + dm = 7; + dd = 16; + s2 = 4; } else if ( df == 3 ) { - s1 = 8; m1 = 0xFF; dm = 127; dd = 256; s2 = 8; + s1 = 8; + m1 = 0xFF; + dm = 127; + dd = 256; + s2 = 8; } else { log.debug ( "unsupported device table delta format: " + df + ", ignoring device table" ); return null; @@ -3760,7 +3772,9 @@ public final class OTFAdvancedTypographicTableReader { private void resetATStateAll() { resetATState(); - gdef = null; gsub = null; gpos = null; + gdef = null; + gsub = null; + gpos = null; } /** helper method for formatting an integer array for output */ diff --git a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java index ff70e6a67..3a704e4b3 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java +++ b/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java @@ -105,27 +105,34 @@ public class DefaultScriptProcessor extends ScriptProcessor { int[] pa = ( gpa != null ) ? gpa [ i ] : null; GlyphSequence.CharAssociation ca = aa [ i ]; if ( gdef.isGlyphClass ( gid, GlyphDefinitionTable.GLYPH_CLASS_MARK ) ) { - nga [ k ] = gid; naa [ k ] = ca; + nga [ k ] = gid; + naa [ k ] = ca; if ( npa != null ) { npa [ k ] = pa; } k++; } else { if ( bg != -1 ) { - nga [ k ] = bg; naa [ k ] = ba; + nga [ k ] = bg; + naa [ k ] = ba; if ( npa != null ) { npa [ k ] = bpa; } k++; - bg = -1; ba = null; bpa = null; + bg = -1; + ba = null; + bpa = null; } if ( bg == -1 ) { - bg = gid; ba = ca; bpa = pa; + bg = gid; + ba = ca; + bpa = pa; } } } if ( bg != -1 ) { - nga [ k ] = bg; naa [ k ] = ba; + nga [ k ] = bg; + naa [ k ] = ba; if ( npa != null ) { npa [ k ] = bpa; } diff --git a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java index 52f1d7284..f3f366ff3 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java +++ b/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java @@ -222,11 +222,13 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor { int i; // consume dead consonants while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) { - s = i; nd++; + s = i; + nd++; } // consume zero or one live consonant if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) { - s = i; nl++; + s = i; + nl++; } return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1; } diff --git a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java index 4aec56a65..aba4caabb 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java +++ b/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java @@ -222,11 +222,13 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor { int i; // consume dead consonants while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) { - s = i; nd++; + s = i; + nd++; } // consume zero or one live consonant if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) { - s = i; nl++; + s = i; + nl++; } return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1; } diff --git a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java b/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java index 1f1b56738..479f8d152 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java +++ b/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java @@ -223,11 +223,13 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor { int i; // consume dead consonants while ( ( i = isDeadConsonant ( ca, s, e ) ) > s ) { - s = i; nd++; + s = i; + nd++; } // consume zero or one live consonant if ( ( i = isLiveConsonant ( ca, s, e ) ) > s ) { - s = i; nl++; + s = i; + nl++; } return ( ( nd > 0 ) || ( nl > 0 ) ) ? s : -1; } diff --git a/src/java/org/apache/fop/complexscripts/util/CharScript.java b/src/java/org/apache/fop/complexscripts/util/CharScript.java index bcce31327..06bc02a4f 100644 --- a/src/java/org/apache/fop/complexscripts/util/CharScript.java +++ b/src/java/org/apache/fop/complexscripts/util/CharScript.java @@ -758,7 +758,8 @@ public final class CharScript { assert v != null; int c = v.intValue(); if ( c > cMax ) { - cMax = c; sMax = s; + cMax = c; + sMax = s; } break; } diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index dadb2d665..1ac206ee8 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -712,7 +712,8 @@ public class TextLayoutManager extends LeafNodeLayoutManager { for ( int k = 0; k < 4; k++ ) { int a = wpa2 [ k ]; if ( a != 0 ) { - wpa1 [ k ] += a; adjusted = true; + wpa1 [ k ] += a; + adjusted = true; } } } diff --git a/src/java/org/apache/fop/render/intermediate/IFUtil.java b/src/java/org/apache/fop/render/intermediate/IFUtil.java index 86991ecb1..fa1e87780 100644 --- a/src/java/org/apache/fop/render/intermediate/IFUtil.java +++ b/src/java/org/apache/fop/render/intermediate/IFUtil.java @@ -345,7 +345,8 @@ public final class IFUtil { */ public static void adjustPA ( int[] paDst, int[] paSrc ) { if ( ( paDst != null ) && ( paSrc != null ) ) { - assert paDst.length == 4; assert paSrc.length == 4; + assert paDst.length == 4; + assert paSrc.length == 4; for ( int i = 0; i < 4; i++ ) { paDst[i] += paSrc[i]; } diff --git a/src/java/org/apache/fop/util/XMLUtil.java b/src/java/org/apache/fop/util/XMLUtil.java index e91b6eb5d..86c0f66a8 100644 --- a/src/java/org/apache/fop/util/XMLUtil.java +++ b/src/java/org/apache/fop/util/XMLUtil.java @@ -197,7 +197,8 @@ public final class XMLUtil implements XMLConstants { for ( int k = 0; k < 4; k++ ) { int a = pa [ k ]; if ( a != 0 ) { - encodeNextAdjustment ( sb, nz, a ); nz = 0; + encodeNextAdjustment ( sb, nz, a ); + nz = 0; } else { nz++; } -- 2.39.5