Sfoglia il codice sorgente

Restricted CSOFF filter to LineLength and fixed resulting Checkstyle issues


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1543560 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Vincent Hennebert 10 anni fa
parent
commit
6b16845a94
40 ha cambiato i file con 291 aggiunte e 421 eliminazioni
  1. 5
    5
      checkstyle-5.5.xml
  2. 5
    4
      checkstyle-suppressions.xml
  3. 6
    7
      src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java
  4. 22
    26
      src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiTestData.java
  5. 0
    1
      src/java/org/apache/fop/complexscripts/bidi/BidiClass.java
  6. 3
    7
      src/java/org/apache/fop/complexscripts/bidi/BidiResolver.java
  7. 1
    4
      src/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java
  8. 2
    9
      src/java/org/apache/fop/complexscripts/bidi/InlineRun.java
  9. 1
    4
      src/java/org/apache/fop/complexscripts/bidi/TextInterval.java
  10. 12
    17
      src/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java
  11. 28
    41
      src/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java
  12. 5
    6
      src/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java
  13. 3
    5
      src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java
  14. 0
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java
  15. 0
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java
  16. 1
    3
      src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java
  17. 0
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java
  18. 3
    5
      src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java
  19. 52
    55
      src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java
  20. 10
    11
      src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java
  21. 1
    2
      src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java
  22. 3
    4
      src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java
  23. 14
    16
      src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java
  24. 0
    1
      src/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java
  25. 21
    28
      src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java
  26. 1
    5
      src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java
  27. 9
    13
      src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java
  28. 11
    16
      src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java
  29. 11
    16
      src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java
  30. 11
    16
      src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java
  31. 4
    13
      src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java
  32. 3
    9
      src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java
  33. 15
    23
      src/java/org/apache/fop/complexscripts/util/CharScript.java
  34. 8
    11
      src/java/org/apache/fop/complexscripts/util/GlyphSequence.java
  35. 15
    24
      src/java/org/apache/fop/complexscripts/util/NumberConverter.java
  36. 0
    1
      src/java/org/apache/fop/complexscripts/util/UTF32.java
  37. 0
    1
      src/java/org/apache/fop/fonts/apps/TTFReader.java
  38. 5
    6
      src/java/org/apache/fop/text/linebreak/LineBreakUtils.java
  39. 0
    1
      test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java
  40. 0
    2
      test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java

+ 5
- 5
checkstyle-5.5.xml Vedi File

@@ -37,12 +37,16 @@

<!-- ===================================================================================================== -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/>
<property name="offCommentFormat" value="CSOFF\: (LineLength)"/>
<property name="onCommentFormat" value="CSON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>
<!-- ===================================================================================================== -->

<module name="SuppressionFilter">
<property name="file" value="${samedir}/checkstyle-suppressions.xml"/>
</module>

<!-- ===================================================================================================== -->
<module name="TreeWalker">

@@ -172,10 +176,6 @@
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceAfter">
<property name="allowLineBreaks" value="true"/>
<property name="tokens" value="ARRAY_INIT"/>
</module>
<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... -->

<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... -->

+ 5
- 4
checkstyle-suppressions.xml Vedi File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="org/apache/fop/fo/FOPropertyMapping.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/Version.java" lines="40-50" checks="LineLengthCheck"/>
<suppress files="org/apache/fop/afp/fonts/CharactersetEncoder.java" checks="FinalClass"/>
<suppress files="org/apache/fop/complexscripts/bidi/BidiClass.java" checks="WhitespaceAfter"/>
<suppress files="org/apache/fop/complexscripts/bidi/GenerateBidiTestData.java" checks="SimplifyBooleanReturn"/>
<suppress files="org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java" checks="SimplifyBooleanReturn"/>
<suppress files="org/apache/fop/complexscripts/util/CharScript.java" checks="SimplifyBooleanReturn"/>
</suppressions>

+ 6
- 7
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiClass.java Vedi File

@@ -32,7 +32,6 @@ import java.util.TreeSet;
import org.apache.fop.util.License;

// CSOFF: LineLength
// CSOFF: NoWhitespaceAfter

/**
* <p>Utility for generating a Java class representing bidirectional
@@ -303,7 +302,7 @@ public final class GenerateBidiClass {
sb.setLength(0);
out.println("private static byte[] bcL1 = {");
for (int i = 0; i < bcL1.length; i++) {
if (! first) {
if (!first) {
sb.append(",");
} else {
first = false;
@@ -327,7 +326,7 @@ public final class GenerateBidiClass {
sb.setLength(0);
out.println("private static byte[] bcR1 = {");
for (int i = 0; i < bcR1.length; i++) {
if (! first) {
if (!first) {
sb.append(",");
} else {
first = false;
@@ -351,7 +350,7 @@ public final class GenerateBidiClass {
sb.setLength(0);
out.println("private static int[] bcS1 = {");
for (int i = 0; i < bcS1.length; i++) {
if (! first) {
if (!first) {
sb.append(",");
} else {
first = false;
@@ -375,7 +374,7 @@ public final class GenerateBidiClass {
sb.setLength(0);
out.println("private static int[] bcE1 = {");
for (int i = 0; i < bcE1.length; i++) {
if (! first) {
if (!first) {
sb.append(",");
} else {
first = false;
@@ -399,7 +398,7 @@ public final class GenerateBidiClass {
sb.setLength(0);
out.println("private static byte[] bcC1 = {");
for (int i = 0; i < bcC1.length; i++) {
if (! first) {
if (!first) {
sb.append(",");
} else {
first = false;
@@ -434,7 +433,7 @@ public final class GenerateBidiClass {
if (k >= 0) {
return ca [ k ];
} else {
k = - (k + 1);
k = -(k + 1);
if (k == 0) {
return BidiConstants.L;
} else if (ch <= ea [ k - 1 ]) {

+ 22
- 26
src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/GenerateBidiTestData.java Vedi File

@@ -40,10 +40,6 @@ import java.util.TreeMap;
import org.apache.fop.util.License;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: EmptyForIteratorPadCheck

/**
* <p>Utility for generating a Java class and associated data files representing
@@ -202,7 +198,7 @@ public final class GenerateBidiTestData {
String ucName = sa[1];
if (isBlockStart(ucName)) {
String ucBlock = getBlockName(ucName);
if (! im.containsKey(ucBlock)) {
if (!im.containsKey(ucBlock)) {
im.put(ucBlock, new int[] { uc, -1, bc });
} else {
throw new IllegalArgumentException("duplicate start of block '" + ucBlock + "' at entry: " + line);
@@ -223,7 +219,7 @@ public final class GenerateBidiTestData {
} else {
Integer k = Integer.valueOf(bc);
List sl;
if (! sm.containsKey(k)) {
if (!sm.containsKey(k)) {
sl = new ArrayList();
sm.put(k, sl);
} else {
@@ -267,7 +263,7 @@ public final class GenerateBidiTestData {
}
}
// populate intervals from (block) interval map
if (! im.isEmpty()) {
if (!im.isEmpty()) {
for (Iterator it = im.values().iterator(); it.hasNext(); ) {
int[] ba = (int[]) it.next();
assert (ba != null) && (ba.length > 2);
@@ -335,7 +331,7 @@ public final class GenerateBidiTestData {
continue;
} else if (line.startsWith("#")) {
continue;
} else if (line.startsWith(PFX_TYPE) && ! ignoreDeprecatedTypeData) {
} else if (line.startsWith(PFX_TYPE) && !ignoreDeprecatedTypeData) {
List lines = new ArrayList();
if ((n = readType(line, b, lines)) < 0) {
break;
@@ -356,14 +352,14 @@ public final class GenerateBidiTestData {
// dump instrumentation
if (verbose) {
System.out.println();
if (! ignoreDeprecatedTypeData) {
if (!ignoreDeprecatedTypeData) {
System.out.println("Read type ranges : " + numTypeRanges);
}
System.out.println("Read level specs : " + numLevelSpecs);
System.out.println("Read test specs : " + numTestSpecs);
System.out.println("Read lines : " + lineNumber);
}
if (! ignoreDeprecatedTypeData) {
if (!ignoreDeprecatedTypeData) {
td = (int[][]) tdl.toArray(new int [ tdl.size() ] []);
}
ld = (int[][]) ldl.toArray(new int [ ldl.size() ] []);
@@ -378,12 +374,12 @@ public final class GenerateBidiTestData {
boolean done = false;
int n = 0;
lines.add(line);
while (! done) {
while (!done) {
switch (testPrefix(b, PFX_LEVELS)) {
case 0: // within current levels
if ((line = b.readLine()) != null) {
n++;
if ((line.length() > 0) && ! line.startsWith("#")) {
if ((line.length() > 0) && !line.startsWith("#")) {
lines.add(line);
}
} else {
@@ -509,7 +505,7 @@ public final class GenerateBidiTestData {
CharacterIterator ci = new StringCharacterIterator(charRanges);
// read initial list delimiter
skipSpace(ci);
if (! readStartOfList(ci)) {
if (!readStartOfList(ci)) {
badRangeSpec("missing initial list delimiter", charRanges);
}
// read negation token if present
@@ -538,7 +534,7 @@ public final class GenerateBidiTestData {
String s;
skipSpace(ci);
if ((s = maybeReadSeparator(ci)) != null) {
if ((s.length() != 0) && ! s.equals("||")) {
if ((s.length() != 0) && !s.equals("||")) {
badRangeSpec("invalid item separator \"" + s + "\"", charRanges);
}
}
@@ -557,10 +553,10 @@ public final class GenerateBidiTestData {
}
// read terminating list delimiter
skipSpace(ci);
if (! readEndOfList(ci)) {
if (!readEndOfList(ci)) {
badRangeSpec("missing terminating list delimiter", charRanges);
}
if (! atEnd(ci)) {
if (!atEnd(ci)) {
badRangeSpec("extraneous content prior to end of line", ci);
}
if (negated) {
@@ -578,9 +574,9 @@ public final class GenerateBidiTestData {
}

private static void skipSpace(CharacterIterator ci) {
while (! atEnd(ci)) {
while (!atEnd(ci)) {
char c = ci.current();
if (! Character.isWhitespace(c)) {
if (!Character.isWhitespace(c)) {
break;
} else {
ci.next();
@@ -589,7 +585,7 @@ public final class GenerateBidiTestData {
}

private static boolean maybeReadNext(CharacterIterator ci, char next) {
while (! atEnd(ci)) {
while (!atEnd(ci)) {
char c = ci.current();
if (c == next) {
ci.next();
@@ -906,7 +902,7 @@ public final class GenerateBidiTestData {
List ll = new ArrayList();
// read prefix
skipSpace(ci);
if (! maybeReadToken(ci, PFX_LEVELS)) {
if (!maybeReadToken(ci, PFX_LEVELS)) {
badLevelSpec("missing prefix \"" + PFX_LEVELS + "\"", ci);
}
// read level values
@@ -924,7 +920,7 @@ public final class GenerateBidiTestData {
}
// read to end of line
skipSpace(ci);
if (! atEnd(ci)) {
if (!atEnd(ci)) {
badLevelSpec("extraneous content prior to end of line", ci);
}
if (ll.size() == 0) {
@@ -1007,7 +1003,7 @@ public final class GenerateBidiTestData {
List rl = new ArrayList();
// read prefix
skipSpace(ci);
if (! maybeReadToken(ci, PFX_REORDER)) {
if (!maybeReadToken(ci, PFX_REORDER)) {
badReorderSpec("missing prefix \"" + PFX_REORDER + "\"", ci);
}
// read reorder values
@@ -1023,7 +1019,7 @@ public final class GenerateBidiTestData {
}
// read to end of line
skipSpace(ci);
if (! atEnd(ci)) {
if (!atEnd(ci)) {
badReorderSpec("extraneous content prior to end of line", ci);
}
return createReorderArray(rl, levels);
@@ -1066,7 +1062,7 @@ public final class GenerateBidiTestData {
CharacterIterator ci = new StringCharacterIterator(line);
List cl = new ArrayList();
// read bidi class identifier sequence
while (! atEnd(ci) && ! maybeReadNext(ci, ';')) {
while (!atEnd(ci) && !maybeReadNext(ci, ';')) {
skipSpace(ci);
int bc;
if ((bc = maybeReadBidiClass(ci)) >= 0) {
@@ -1086,7 +1082,7 @@ public final class GenerateBidiTestData {
}
// read to end of line
skipSpace(ci);
if (! atEnd(ci)) {
if (!atEnd(ci)) {
badTestSpec("extraneous content prior to end of line", ci);
}
return createTestArray(cl, bs, levels);
@@ -1244,7 +1240,7 @@ public final class GenerateBidiTestData {
ok = false;
}
}
if (! ok) {
if (!ok) {
System.out.println("Usage: GenerateBidiTestData [-v] [-i] [-d <ucdFile>] [-b <bidiFile>] [-o <outputFile>]");
System.out.println(" defaults:");
if (ignoreDeprecatedTypeData) {

+ 0
- 1
src/java/org/apache/fop/complexscripts/bidi/BidiClass.java Vedi File

@@ -21,7 +21,6 @@ package org.apache.fop.complexscripts.bidi;

import java.util.Arrays;

// CSOFF: WhitespaceAfterCheck
// CSOFF: LineLengthCheck

/*

+ 3
- 7
src/java/org/apache/fop/complexscripts/bidi/BidiResolver.java Vedi File

@@ -32,11 +32,7 @@ import org.apache.fop.area.LineArea;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.fo.pagination.PageSequence;

// CSOFF: EmptyForIteratorPadCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* <p>A utility class for performing bidirectional resolution processing.</p>
@@ -140,7 +136,7 @@ public final class BidiResolver {
runsNew.addAll(ir.split());
}
}
if (! runsNew.equals(runs)) {
if (!runsNew.equals(runs)) {
runs = runsNew;
}
return runs;
@@ -180,7 +176,7 @@ public final class BidiResolver {
i = e - 1;
}
}
if (! runsNew.equals(runs)) {
if (!runsNew.equals(runs)) {
runs = runsNew;
}
return runs;
@@ -232,7 +228,7 @@ public final class BidiResolver {
Vector rv = new Vector();
for (Iterator it = ranges.iterator(); it.hasNext(); ) {
DelimitedTextRange r = (DelimitedTextRange) it.next();
if (! r.isEmpty()) {
if (!r.isEmpty()) {
rv.add(r);
}
}

+ 1
- 4
src/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java Vedi File

@@ -34,10 +34,7 @@ import org.apache.fop.traits.WritingModeTraits;
import org.apache.fop.traits.WritingModeTraitsGetter;
import org.apache.fop.util.CharUtilities;

// CSOFF: EmptyForIteratorPadCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* The <code>DelimitedTextRange</code> class implements the "delimited text range" as described
@@ -151,7 +148,7 @@ public class DelimitedTextRange {
TextInterval ti = (TextInterval) it.next();
intervalsNew.addAll(assignLevels(ti, levels));
}
if (! intervalsNew.equals(intervals)) {
if (!intervalsNew.equals(intervals)) {
intervals = intervalsNew;
}
}

+ 2
- 9
src/java/org/apache/fop/complexscripts/bidi/InlineRun.java Vedi File

@@ -35,11 +35,6 @@ import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.area.inline.WordArea;
import org.apache.fop.util.CharUtilities;

// CSOFF: EmptyForIteratorPadCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* The <code>InlineRun</code> class is a utility class, the instances of which are used
* to capture a sequence of reordering levels associated with an inline area.
@@ -179,7 +174,7 @@ public class InlineRun {
if (inline instanceof WordArea) {
WordArea w = (WordArea) inline;
// if not already reversed, then reverse now
if (! w.isReversed()) {
if (!w.isReversed()) {
if ((reversals & 1) != 0) {
w.reverse(mirror);
} else if (mirror && maybeNeedsMirroring()) {
@@ -209,10 +204,8 @@ public class InlineRun {
}
return true;
}
} else if ((ir.levels == null) && (levels == null)) {
return true;
} else {
return false;
return (ir.levels == null) && (levels == null);
}
} else {
return false;

+ 1
- 4
src/java/org/apache/fop/complexscripts/bidi/TextInterval.java Vedi File

@@ -28,7 +28,6 @@ import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.flow.Leader;

// CSOFF: LineLengthCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* <p>The <code>TextInterval</code> class is a utility class, the instances of which are used
@@ -102,10 +101,8 @@ class TextInterval {
return false;
} else if (ti.getStart() != start) {
return false;
} else if (ti.getEnd() != end) {
return false;
} else {
return true;
return ti.getEnd() == end;
}
} else {
return false;

+ 12
- 17
src/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java Vedi File

@@ -35,10 +35,7 @@ import org.apache.fop.area.inline.SpaceArea;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.area.inline.UnresolvedPageNumber;

// CSOFF: EmptyForIteratorPadCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* <p>The <code>UnflattenProcessor</code> class is used to reconstruct (by unflattening) a line
@@ -86,10 +83,8 @@ class UnflattenProcessor {
private boolean shouldFinishTextContainer(TextArea tc, InlineArea ia) {
if ((tcOrig != null) && (tc != tcOrig)) {
return true;
} else if ((iaLevelLast != -1) && (ia.getBidiLevel() != iaLevelLast)) {
return true;
} else {
return false;
return (iaLevelLast != -1) && (ia.getBidiLevel() != iaLevelLast);
}
}
private void finishTextContainer() {
@@ -98,7 +93,7 @@ class UnflattenProcessor {
private void finishTextContainer(TextArea tc, InlineArea ia) {
if (tcNew != null) {
updateIPD(tcNew);
if (! icNew.empty()) {
if (!icNew.empty()) {
icNew.peek().addChildArea(tcNew);
} else {
ilNew.add(tcNew);
@@ -113,12 +108,12 @@ class UnflattenProcessor {
}
private boolean shouldFinishInlineContainer(List<InlineParent> ich, TextArea tc, InlineArea ia) {
if ((ich == null) || ich.isEmpty()) {
return ! icOrig.empty();
return !icOrig.empty();
} else {
if (! icOrig.empty()) {
if (!icOrig.empty()) {
InlineParent ic = ich.get(0);
InlineParent ic0 = icOrig.peek();
return (ic != ic0) && ! isInlineParentOf(ic, ic0);
return (ic != ic0) && !isInlineParentOf(ic, ic0);
} else {
return false;
}
@@ -128,14 +123,14 @@ class UnflattenProcessor {
finishInlineContainer(null, null, null);
}
private void finishInlineContainer(List<InlineParent> ich, TextArea tc, InlineArea ia) {
if ((ich != null) && ! ich.isEmpty()) { // finish non-matching inner inline container(s)
if ((ich != null) && !ich.isEmpty()) { // finish non-matching inner inline container(s)
for (Iterator<InlineParent> it = ich.iterator(); it.hasNext(); ) {
InlineParent ic = it.next();
InlineParent ic0 = icOrig.empty() ? null : icOrig.peek();
if (ic0 == null) {
assert icNew.empty();
} else if (ic != ic0) {
assert ! icNew.empty();
assert !icNew.empty();
InlineParent icO0 = icOrig.pop();
InlineParent icN0 = icNew.pop();
assert icO0 != null;
@@ -145,7 +140,7 @@ class UnflattenProcessor {
} else {
icNew.peek().addChildArea(icN0);
}
if (! icOrig.empty() && (icOrig.peek() == ic)) {
if (!icOrig.empty() && (icOrig.peek() == ic)) {
break;
}
} else {
@@ -153,7 +148,7 @@ class UnflattenProcessor {
}
}
} else { // finish all inline containers
while (! icNew.empty()) {
while (!icNew.empty()) {
InlineParent icO0 = icOrig.pop();
InlineParent icN0 = icNew.pop();
assert icO0 != null;
@@ -176,8 +171,8 @@ class UnflattenProcessor {
finishInlineContainer();
}
private void update(List<InlineParent> ich, TextArea tc, InlineArea ia) {
if (! alreadyUnflattened(ia)) {
if ((ich != null) && ! ich.isEmpty()) {
if (!alreadyUnflattened(ia)) {
if ((ich != null) && !ich.isEmpty()) {
pushInlineContainers(ich);
}
if (tc != null) {
@@ -345,7 +340,7 @@ class UnflattenProcessor {
Area a = ia.getParentArea();
while (a != null) {
if (a instanceof InlineArea) {
if ((a instanceof InlineParent) && ! (a instanceof TextArea)) {
if ((a instanceof InlineParent) && !(a instanceof TextArea)) {
ich.add((InlineParent) a);
}
a = ((InlineArea) a) .getParentArea();

+ 28
- 41
src/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java Vedi File

@@ -25,12 +25,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.fop.traits.Direction;
import org.apache.fop.util.CharUtilities;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: EmptyForIteratorPadCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: ParameterNumberCheck

/**
* <p>The <code>UnicodeBidiAlgorithm</code> class implements functionality prescribed by
@@ -125,47 +120,39 @@ public final class UnicodeBidiAlgorithm implements BidiConstants {
case RLE: // start right-to-left embedding
case LRO: // start left-to-right override
case RLO: // start right-to-left override
{
int en; /* new embedding level */
if ((bc == RLE) || (bc == RLO)) {
en = ((ec & ~OVERRIDE) + 1) | 1;
} else {
en = ((ec & ~OVERRIDE) + 2) & ~1;
}
if (en < (MAX_LEVELS + 1)) {
es [ ei++ ] = ec;
if ((bc == LRO) || (bc == RLO)) {
ec = en | OVERRIDE;
} else {
ec = en & ~OVERRIDE;
}
int en; /* new embedding level */
if ((bc == RLE) || (bc == RLO)) {
en = ((ec & ~OVERRIDE) + 1) | 1;
} else {
en = ((ec & ~OVERRIDE) + 2) & ~1;
}
if (en < (MAX_LEVELS + 1)) {
es [ ei++ ] = ec;
if ((bc == LRO) || (bc == RLO)) {
ec = en | OVERRIDE;
} else {
// max levels exceeded, so don't change level or override
ec = en & ~OVERRIDE;
}
el = ec;
break;
} else {
// max levels exceeded, so don't change level or override
}
el = ec;
break;
case PDF: // pop directional formatting
{
el = ec;
if (ei > 0) {
ec = es [ --ei ];
} else {
// ignore isolated PDF
}
break;
el = ec;
if (ei > 0) {
ec = es [ --ei ];
} else {
// ignore isolated PDF
}
break;
case B: // paragraph separator
{
el = ec = defaultLevel;
ei = 0;
break;
}
el = ec = defaultLevel;
ei = 0;
break;
default:
{
el = ec;
break;
}
el = ec;
break;
}
switch (bc) {
case BN:
@@ -608,7 +595,7 @@ public final class UnicodeBidiAlgorithm implements BidiConstants {

private static boolean isRetainedFormatting(int[] ca, int s, int e) {
for (int i = s; i < e; i++) {
if (! isRetainedFormatting(ca[i])) {
if (!isRetainedFormatting(ca[i])) {
return false;
}
}
@@ -680,7 +667,7 @@ public final class UnicodeBidiAlgorithm implements BidiConstants {
} else {
chOut = chIn;
}
if (! triggered && triggersBidi(chOut)) {
if (!triggered && triggersBidi(chOut)) {
triggered = true;
}
if ((chOut & 0xFF0000) == 0) {

+ 5
- 6
src/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java Vedi File

@@ -23,7 +23,6 @@ import java.util.Iterator;
import java.util.List;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>Base class implementation of glyph class table.</p>
@@ -100,7 +99,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla
} else {
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (! (o instanceof Integer)) {
if (!(o instanceof Integer)) {
return false;
}
}
@@ -114,7 +113,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla
} else {
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (! (o instanceof MappingRange)) {
if (!(o instanceof MappingRange)) {
return false;
}
}
@@ -128,7 +127,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla
} else {
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (! (o instanceof GlyphCoverageTable)) {
if (!(o instanceof GlyphCoverageTable)) {
return false;
}
}
@@ -197,7 +196,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla
if (it.hasNext()) {
Object o = it.next();
if (o instanceof Integer) {
firstGlyph = ((Integer) o) . intValue();
firstGlyph = ((Integer) o) .intValue();
} else {
throw new AdvancedTypographicTableFormatException("illegal entry, first entry must be Integer denoting first glyph value, but is: " + o);
}
@@ -210,7 +209,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla
while (it.hasNext()) {
Object o = it.next();
if (o instanceof Integer) {
int gc = ((Integer) o) . intValue();
int gc = ((Integer) o) .intValue();
gca [ i++ ] = gc;
if (gc > gcMax) {
gcMax = gc;

+ 3
- 5
src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java Vedi File

@@ -27,8 +27,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

// CSOFF: LineLengthCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>.Base class implementation of glyph coverage table.</p>
@@ -103,7 +101,7 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph
} else {
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (! (o instanceof Integer)) {
if (!(o instanceof Integer)) {
return false;
}
}
@@ -117,7 +115,7 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph
} else {
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (! (o instanceof MappingRange)) {
if (!(o instanceof MappingRange)) {
return false;
}
}
@@ -183,7 +181,7 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph
for (Iterator it = entries.iterator(); it.hasNext();) {
Object o = it.next();
if (o instanceof Integer) {
int gid = ((Integer) o) . intValue();
int gid = ((Integer) o) .intValue();
if ((gid >= 0) && (gid < 65536)) {
if (gid > gidMax) {
map [ i++ ] = gidMax = gid;

+ 0
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java Vedi File

@@ -20,7 +20,6 @@
package org.apache.fop.complexscripts.fonts;

// CSOFF: LineLengthCheck
// CSOFF: InnerAssignmentCheck

/**
* <p>The <code>GlyphDefinitionSubtable</code> implements an abstract base of a glyph definition subtable,

+ 0
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java Vedi File

@@ -29,7 +29,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.fop.complexscripts.scripts.ScriptProcessor;
import org.apache.fop.complexscripts.util.GlyphSequence;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck

/**

+ 1
- 3
src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java Vedi File

@@ -23,8 +23,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

// CSOFF: NoWhitespaceAfterCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck

/**
@@ -162,7 +160,7 @@ public class GlyphMappingTable {
int mi;
if ((i = Arrays.binarySearch(sa, gid)) >= 0) {
mi = getMappedIndex(gid, sa [ i ], ma [ i ]); // matches start of (some) range
} else if ((i = - (i + 1)) == 0) {
} else if ((i = -(i + 1)) == 0) {
mi = -1; // precedes first range
} else if (gid > ea [ --i ]) {
mi = -1; // follows preceding (or last) range

+ 0
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java Vedi File

@@ -23,7 +23,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: LineLengthCheck
// CSOFF: ParameterNumberCheck

/**
* <p>The <code>GlyphPositioningState</code> implements an state object used during glyph positioning

+ 3
- 5
src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java Vedi File

@@ -23,8 +23,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: ParameterNumberCheck

/**
* <p>The <code>GlyphPositioningSubtable</code> implements an abstract base of a glyph subtable,
@@ -90,8 +88,8 @@ public abstract class GlyphPositioningSubtable extends GlyphSubtable implements
boolean appliedOneShot = false;
while (ps.hasNext()) {
boolean applied = false;
if (! appliedOneShot && ps.maybeApplicable()) {
for (int i = 0, n = sta.length; ! applied && (i < n); i++) {
if (!appliedOneShot && ps.maybeApplicable()) {
for (int i = 0, n = sta.length; !applied && (i < n); i++) {
if (sequenceIndex < 0) {
applied = ps.apply(sta [ i ]);
} else if (ps.getPosition() == (sequenceStart + sequenceIndex)) {
@@ -102,7 +100,7 @@ public abstract class GlyphPositioningSubtable extends GlyphSubtable implements
}
}
}
if (! applied || ! ps.didConsume()) {
if (!applied || !ps.didConsume()) {
ps.applyDefault();
}
ps.next();

+ 52
- 55
src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java Vedi File

@@ -33,9 +33,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.GlyphTester;

// CSOFF: LineLengthCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: ParameterNumberCheck

/**
* <p>The <code>GlyphPositioningTable</code> class is a glyph table that implements
@@ -368,7 +365,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof Value[])) {
if (((o = entries.get(0)) == null) || !(o instanceof Value[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, single entry must be a Value[], but is: " + ((o != null) ? o.getClass() : null));
} else {
Value[] va = (Value[]) o;
@@ -412,7 +409,7 @@ public class GlyphPositioningTable extends GlyphTable {
int offsetLast = counts[0] + counts[1];
// skip any ignored glyphs prior to first non-ignored glyph
for ( ; offset < offsetLast; ++offset) {
if (! ps.isIgnoredGlyph(offset)) {
if (!ps.isIgnoredGlyph(offset)) {
break;
} else {
ps.consume(1);
@@ -429,7 +426,7 @@ public class GlyphPositioningTable extends GlyphTable {
}
// skip any ignored glyphs prior to second non-ignored glyph
for ( ; offset < offsetLast; ++offset) {
if (! ps.isIgnoredGlyph(offset)) {
if (!ps.isIgnoredGlyph(offset)) {
break;
} else {
ps.consume(1);
@@ -513,7 +510,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof PairValues[][])) {
if (((o = entries.get(0)) == null) || !(o instanceof PairValues[][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first (and only) entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
pvm = (PairValues[][]) o;
@@ -569,27 +566,27 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt1 = (GlyphClassTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(1)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt2 = (GlyphClassTable) o;
}
if (((o = entries.get(2)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(2)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nc1 = ((Integer)(o)).intValue();
}
if (((o = entries.get(3)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(3)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nc2 = ((Integer)(o)).intValue();
}
if (((o = entries.get(4)) == null) || ! (o instanceof PairValues[][])) {
if (((o = entries.get(4)) == null) || !(o instanceof PairValues[][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be a PairValues[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
pvm = (PairValues[][]) o;
@@ -633,7 +630,7 @@ public class GlyphPositioningTable extends GlyphTable {
int enw = ps.getWidth(gi2);
if ((exa != null) && (ena != null)) {
Value v = ena.getAlignmentAdjustment(exa);
v.adjust(- enw, 0, 0, 0);
v.adjust(-enw, 0, 0, 0);
if (ps.adjust(v)) {
ps.setAdjusted(true);
}
@@ -704,10 +701,10 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof Anchor[])) {
if (((o = entries.get(0)) == null) || !(o instanceof Anchor[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first (and only) entry must be a Anchor[], but is: " + ((o != null) ? o.getClass() : null));
} else if ((((Anchor[]) o) . length % 2) != 0) {
throw new AdvancedTypographicTableFormatException("illegal entries, Anchor[] array must have an even number of entries, but has: " + ((Anchor[]) o) . length);
} else if ((((Anchor[]) o) .length % 2) != 0) {
throw new AdvancedTypographicTableFormatException("illegal entries, Anchor[] array must have an even number of entries, but has: " + ((Anchor[]) o) .length);
} else {
aa = (Anchor[]) o;
}
@@ -736,7 +733,7 @@ public class GlyphPositioningTable extends GlyphTable {
MarkAnchor ma = getMarkAnchor(ciMark, giMark);
if (ma != null) {
for (int i = 0, n = ps.getPosition(); i < n; i++) {
int gi = ps.getGlyph(- (i + 1));
int gi = ps.getGlyph(-(i + 1));
if (ps.isMark(gi)) {
continue;
} else {
@@ -746,7 +743,7 @@ public class GlyphPositioningTable extends GlyphTable {
// start experimental fix for END OF AYAH in Lateef/Scheherazade
int[] aa = ps.getAdjustment();
if (aa[2] == 0) {
v.adjust(0, 0, - ps.getWidth(giMark), 0);
v.adjust(0, 0, -ps.getWidth(giMark), 0);
}
// end experimental fix for END OF AYAH in Lateef/Scheherazade
if (ps.adjust(v)) {
@@ -835,22 +832,22 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
bct = (GlyphCoverageTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
if (((o = entries.get(2)) == null) || ! (o instanceof MarkAnchor[])) {
if (((o = entries.get(2)) == null) || !(o instanceof MarkAnchor[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
if (((o = entries.get(3)) == null) || ! (o instanceof Anchor[][])) {
if (((o = entries.get(3)) == null) || !(o instanceof Anchor[][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
bam = (Anchor[][]) o;
@@ -881,7 +878,7 @@ public class GlyphPositioningTable extends GlyphTable {
int mxc = getMaxComponentCount();
if (ma != null) {
for (int i = 0, n = ps.getPosition(); i < n; i++) {
int gi = ps.getGlyph(- (i + 1));
int gi = ps.getGlyph(-(i + 1));
if (ps.isMark(gi)) {
continue;
} else {
@@ -989,27 +986,27 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
lct = (GlyphCoverageTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
if (((o = entries.get(2)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(2)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
mxc = ((Integer)(o)).intValue();
}
if (((o = entries.get(3)) == null) || ! (o instanceof MarkAnchor[])) {
if (((o = entries.get(3)) == null) || !(o instanceof MarkAnchor[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
if (((o = entries.get(4)) == null) || ! (o instanceof Anchor[][][])) {
if (((o = entries.get(4)) == null) || !(o instanceof Anchor[][][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be a Anchor[][][], but is: " + ((o != null) ? o.getClass() : null));
} else {
lam = (Anchor[][][]) o;
@@ -1125,22 +1122,22 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 4 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphCoverageTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphCoverageTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphCoverageTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
mct2 = (GlyphCoverageTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
nmc = ((Integer)(o)).intValue();
}
if (((o = entries.get(2)) == null) || ! (o instanceof MarkAnchor[])) {
if (((o = entries.get(2)) == null) || !(o instanceof MarkAnchor[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be a MarkAnchor[], but is: " + ((o != null) ? o.getClass() : null));
} else {
maa = (MarkAnchor[]) o;
}
if (((o = entries.get(3)) == null) || ! (o instanceof Anchor[][])) {
if (((o = entries.get(3)) == null) || !(o instanceof Anchor[][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be a Anchor[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
mam = (Anchor[][]) o;
@@ -1274,7 +1271,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1367,17 +1364,17 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 3 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt = (GlyphClassTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
ngc = ((Integer)(o)).intValue();
}
if (((o = entries.get(2)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(2)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1467,7 +1464,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1585,7 +1582,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1661,27 +1658,27 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
icdt = (GlyphClassTable) o;
}
if (((o = entries.get(1)) != null) && ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(1)) != null) && !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an GlyphClassTable, but is: " + o.getClass());
} else {
bcdt = (GlyphClassTable) o;
}
if (((o = entries.get(2)) != null) && ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(2)) != null) && !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an GlyphClassTable, but is: " + o.getClass());
} else {
lcdt = (GlyphClassTable) o;
}
if (((o = entries.get(3)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(3)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
ngc = ((Integer)(o)).intValue();
}
if (((o = entries.get(4)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(4)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1752,7 +1749,7 @@ public class GlyphPositioningTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -2005,7 +2002,7 @@ public class GlyphPositioningTable extends GlyphTable {
boolean first = true;
sb.append("{ ");
if (xPlacement != 0) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2013,7 +2010,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("xPlacement = " + xPlacement);
}
if (yPlacement != 0) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2021,7 +2018,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("yPlacement = " + yPlacement);
}
if (xAdvance != 0) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2029,7 +2026,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("xAdvance = " + xAdvance);
}
if (yAdvance != 0) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2037,7 +2034,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("yAdvance = " + yAdvance);
}
if (xPlaDevice != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2045,7 +2042,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("xPlaDevice = " + xPlaDevice);
}
if (yPlaDevice != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2053,7 +2050,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("xPlaDevice = " + yPlaDevice);
}
if (xAdvDevice != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2061,7 +2058,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("xAdvDevice = " + xAdvDevice);
}
if (yAdvDevice != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2118,7 +2115,7 @@ public class GlyphPositioningTable extends GlyphTable {
boolean first = true;
sb.append("{ ");
if (glyph != 0) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2126,7 +2123,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("glyph = " + glyph);
}
if (value1 != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;
@@ -2134,7 +2131,7 @@ public class GlyphPositioningTable extends GlyphTable {
sb.append("value1 = " + value1);
}
if (value2 != null) {
if (! first) {
if (!first) {
sb.append(", ");
} else {
first = false;

+ 10
- 11
src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java Vedi File

@@ -29,7 +29,6 @@ import org.apache.fop.complexscripts.util.GlyphTester;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>The <code>GlyphProcessingState</code> implements a common, base state object used during glyph substitution
@@ -459,7 +458,7 @@ public class GlyphProcessingState {
int start = index + offset;
if (start < 0) {
throw new IndexOutOfBoundsException("will attempt index at " + start);
} else if (! reverseOrder && ((start + count) > indexLast)) {
} else if (!reverseOrder && ((start + count) > indexLast)) {
throw new IndexOutOfBoundsException("will attempt index at " + (start + count));
} else if (reverseOrder && ((start + 1) < count)) {
throw new IndexOutOfBoundsException("will attempt index at " + (start - count));
@@ -469,7 +468,7 @@ public class GlyphProcessingState {
} else if (glyphs.length != count) {
throw new IllegalArgumentException("glyphs array is non-null, but its length (" + glyphs.length + "), is not equal to count (" + count + ")");
}
if (! reverseOrder) {
if (!reverseOrder) {
return getGlyphsForward(start, count, ignoreTester, glyphs, counts);
} else {
return getGlyphsReverse(start, count, ignoreTester, glyphs, counts);
@@ -484,7 +483,7 @@ public class GlyphProcessingState {
if (gi == 65535) {
ignored++;
} else {
if ((ignoreTester == null) || ! ignoreTester.test(gi, getLookupFlags())) {
if ((ignoreTester == null) || !ignoreTester.test(gi, getLookupFlags())) {
glyphs [ counted++ ] = gi;
} else {
ignored++;
@@ -506,7 +505,7 @@ public class GlyphProcessingState {
if (gi == 65535) {
ignored++;
} else {
if ((ignoreTester == null) || ! ignoreTester.test(gi, getLookupFlags())) {
if ((ignoreTester == null) || !ignoreTester.test(gi, getLookupFlags())) {
glyphs [ counted++ ] = gi;
} else {
ignored++;
@@ -629,7 +628,7 @@ public class GlyphProcessingState {
int start = index + offset;
if ((start < 0) || (start > indexLast)) {
return new int[] { 0, 0 };
} else if (! reverseOrder) {
} else if (!reverseOrder) {
return getGlyphsAvailableForward(start, ignoreTester);
} else {
return getGlyphsAvailableReverse(start, ignoreTester);
@@ -731,7 +730,7 @@ public class GlyphProcessingState {
int start = index + offset;
if (start < 0) {
throw new IndexOutOfBoundsException("will attempt index at " + start);
} else if (! reverseOrder && ((start + count) > indexLast)) {
} else if (!reverseOrder && ((start + count) > indexLast)) {
throw new IndexOutOfBoundsException("will attempt index at " + (start + count));
} else if (reverseOrder && ((start + 1) < count)) {
throw new IndexOutOfBoundsException("will attempt index at " + (start - count));
@@ -741,7 +740,7 @@ public class GlyphProcessingState {
} else if (associations.length != count) {
throw new IllegalArgumentException("associations array is non-null, but its length (" + associations.length + "), is not equal to count (" + count + ")");
}
if (! reverseOrder) {
if (!reverseOrder) {
return getAssociationsForward(start, count, ignoreTester, associations, counts);
} else {
return getAssociationsReverse(start, count, ignoreTester, associations, counts);
@@ -757,7 +756,7 @@ public class GlyphProcessingState {
if (gi == 65535) {
ignored++;
} else {
if ((ignoreTester == null) || ! ignoreTester.test(gi, getLookupFlags())) {
if ((ignoreTester == null) || !ignoreTester.test(gi, getLookupFlags())) {
if (k < count) {
associations [ k++ ] = getAssociation(i - index);
counted++;
@@ -785,7 +784,7 @@ public class GlyphProcessingState {
if (gi == 65535) {
ignored++;
} else {
if ((ignoreTester == null) || ! ignoreTester.test(gi, getLookupFlags())) {
if ((ignoreTester == null) || !ignoreTester.test(gi, getLookupFlags())) {
if (k < count) {
associations [ k++ ] = getAssociation(i - index);
counted++;
@@ -1169,7 +1168,7 @@ public class GlyphProcessingState {
for (int i = 0, n = ngt; i < n; i++) {
GlyphTester gt = gta [ i ];
if (gt != null) {
if (! gt.test(gi, flags)) {
if (!gt.test(gi, flags)) {
return false;
}
}

+ 1
- 2
src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java Vedi File

@@ -27,7 +27,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>The <code>GlyphSubstitutionState</code> implements an state object used during glyph substitution
@@ -130,7 +129,7 @@ public class GlyphSubstitutionState extends GlyphProcessingState {
* @param predication a predication value to add to association A if predications enabled
*/
public void putGlyph(int glyph, GlyphSequence.CharAssociation a, Object predication) {
if (! ogb.hasRemaining()) {
if (!ogb.hasRemaining()) {
ogb = growBuffer(ogb);
}
ogb.put(glyph);

+ 3
- 4
src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java Vedi File

@@ -23,7 +23,6 @@ import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>The <code>GlyphSubstitutionSubtable</code> implements an abstract base of a glyph substitution subtable,
@@ -90,8 +89,8 @@ public abstract class GlyphSubstitutionSubtable extends GlyphSubtable implements
boolean appliedOneShot = false;
while (ss.hasNext()) {
boolean applied = false;
if (! appliedOneShot && ss.maybeApplicable()) {
for (int i = 0, n = sta.length; ! applied && (i < n); i++) {
if (!appliedOneShot && ss.maybeApplicable()) {
for (int i = 0, n = sta.length; !applied && (i < n); i++) {
if (sequenceIndex < 0) {
applied = ss.apply(sta [ i ]);
} else if (ss.getPosition() == (sequenceStart + sequenceIndex)) {
@@ -102,7 +101,7 @@ public abstract class GlyphSubstitutionSubtable extends GlyphSubtable implements
}
}
}
if (! applied || ! ss.didConsume()) {
if (!applied || !ss.didConsume()) {
ss.applyDefault();
}
ss.next();

+ 14
- 16
src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java Vedi File

@@ -31,9 +31,7 @@ import org.apache.fop.complexscripts.scripts.ScriptProcessor;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.GlyphTester;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>The <code>GlyphSubstitutionTable</code> class is a glyph table that implements
@@ -306,7 +304,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
Object o = entries.get(0);
int delta = 0;
if (o instanceof Integer) {
delta = ((Integer) o) . intValue();
delta = ((Integer) o) .intValue();
} else {
throw new AdvancedTypographicTableFormatException("illegal entries entry, must be Integer, but is: " + o);
}
@@ -440,7 +438,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof int[][])) {
if (((o = entries.get(0)) == null) || !(o instanceof int[][])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an int[][], but is: " + ((o != null) ? o.getClass() : null));
} else {
gsa = (int[][]) o;
@@ -801,7 +799,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -894,17 +892,17 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 3 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
cdt = (GlyphClassTable) o;
}
if (((o = entries.get(1)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(1)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
ngc = ((Integer)(o)).intValue();
}
if (((o = entries.get(2)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(2)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -994,7 +992,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1113,7 +1111,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1189,27 +1187,27 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 5 entries");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(0)) == null) || !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an GlyphClassTable, but is: " + ((o != null) ? o.getClass() : null));
} else {
icdt = (GlyphClassTable) o;
}
if (((o = entries.get(1)) != null) && ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(1)) != null) && !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, second entry must be an GlyphClassTable, but is: " + o.getClass());
} else {
bcdt = (GlyphClassTable) o;
}
if (((o = entries.get(2)) != null) && ! (o instanceof GlyphClassTable)) {
if (((o = entries.get(2)) != null) && !(o instanceof GlyphClassTable)) {
throw new AdvancedTypographicTableFormatException("illegal entries, third entry must be an GlyphClassTable, but is: " + o.getClass());
} else {
lcdt = (GlyphClassTable) o;
}
if (((o = entries.get(3)) == null) || ! (o instanceof Integer)) {
if (((o = entries.get(3)) == null) || !(o instanceof Integer)) {
throw new AdvancedTypographicTableFormatException("illegal entries, fourth entry must be an Integer, but is: " + ((o != null) ? o.getClass() : null));
} else {
ngc = ((Integer)(o)).intValue();
}
if (((o = entries.get(4)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(4)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, fifth entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;
@@ -1280,7 +1278,7 @@ public class GlyphSubstitutionTable extends GlyphTable {
throw new AdvancedTypographicTableFormatException("illegal entries, " + entries.size() + " entries present, but requires 1 entry");
} else {
Object o;
if (((o = entries.get(0)) == null) || ! (o instanceof RuleSet[])) {
if (((o = entries.get(0)) == null) || !(o instanceof RuleSet[])) {
throw new AdvancedTypographicTableFormatException("illegal entries, first entry must be an RuleSet[], but is: " + ((o != null) ? o.getClass() : null));
} else {
rsa = (RuleSet[]) o;

+ 0
- 1
src/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java Vedi File

@@ -24,7 +24,6 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Map;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck

/**

+ 21
- 28
src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java Vedi File

@@ -37,12 +37,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: EmptyForIteratorPadCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: ParameterNumberCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* <p>Base class for all advanced typographic glyph tables.</p>
@@ -86,7 +81,7 @@ public class GlyphTable {
* @param lookups map from lookup specs to lookup tables
*/
public GlyphTable(GlyphTable gdef, Map/*<LookupSpec,List<String>>*/ lookups) {
if ((gdef != null) && ! (gdef instanceof GlyphDefinitionTable)) {
if ((gdef != null) && !(gdef instanceof GlyphDefinitionTable)) {
throw new AdvancedTypographicTableFormatException("bad glyph definition table");
} else if (lookups == null) {
throw new AdvancedTypographicTableFormatException("lookups must be non-null map");
@@ -166,7 +161,7 @@ public class GlyphTable {
* create resulting cached state.
*/
protected void freezeSubtables() {
if (! frozen) {
if (!frozen) {
for (Iterator it = lookupTables.values().iterator(); it.hasNext(); ) {
LookupTable lt = (LookupTable) it.next();
lt.freezeSubtables(lookupTables);
@@ -188,18 +183,18 @@ public class GlyphTable {
List/*<LookupSpec>*/ matches = new ArrayList/*<LookupSpec>*/();
for (Iterator it = keys.iterator(); it.hasNext();) {
LookupSpec ls = (LookupSpec) it.next();
if (! "*".equals(script)) {
if (! ls.getScript().equals(script)) {
if (!"*".equals(script)) {
if (!ls.getScript().equals(script)) {
continue;
}
}
if (! "*".equals(language)) {
if (! ls.getLanguage().equals(language)) {
if (!"*".equals(language)) {
if (!ls.getLanguage().equals(language)) {
continue;
}
}
if (! "*".equals(feature)) {
if (! ls.getFeature().equals(feature)) {
if (!"*".equals(feature)) {
if (!ls.getFeature().equals(feature)) {
continue;
}
}
@@ -359,17 +354,17 @@ public class GlyphTable {
* @param permitWildcard if true the permit wildcard script, language, or feature
*/
LookupSpec(String script, String language, String feature, boolean permitEmpty, boolean permitWildcard) {
if ((script == null) || (! permitEmpty && (script.length() == 0))) {
if ((script == null) || (!permitEmpty && (script.length() == 0))) {
throw new AdvancedTypographicTableFormatException("script must be non-empty string");
} else if ((language == null) || (! permitEmpty && (language.length() == 0))) {
} else if ((language == null) || (!permitEmpty && (language.length() == 0))) {
throw new AdvancedTypographicTableFormatException("language must be non-empty string");
} else if ((feature == null) || (! permitEmpty && (feature.length() == 0))) {
} else if ((feature == null) || (!permitEmpty && (feature.length() == 0))) {
throw new AdvancedTypographicTableFormatException("feature must be non-empty string");
} else if (! permitWildcard && script.equals("*")) {
} else if (!permitWildcard && script.equals("*")) {
throw new AdvancedTypographicTableFormatException("script must not be wildcard");
} else if (! permitWildcard && language.equals("*")) {
} else if (!permitWildcard && language.equals("*")) {
throw new AdvancedTypographicTableFormatException("language must not be wildcard");
} else if (! permitWildcard && feature.equals("*")) {
} else if (!permitWildcard && feature.equals("*")) {
throw new AdvancedTypographicTableFormatException("feature must not be wildcard");
}
this.script = script.trim();
@@ -405,14 +400,12 @@ public class GlyphTable {
public boolean equals(Object o) {
if (o instanceof LookupSpec) {
LookupSpec l = (LookupSpec) o;
if (! l.script.equals(script)) {
if (!l.script.equals(script)) {
return false;
} else if (! l.language.equals(language)) {
return false;
} else if (! l.feature.equals(feature)) {
} else if (!l.language.equals(language)) {
return false;
} else {
return true;
return l.feature.equals(feature);
}
} else {
return false;
@@ -540,7 +533,7 @@ public class GlyphTable {
}
}
// append at end of list
if (! added && (subtable != null)) {
if (!added && (subtable != null)) {
subtables.add(subtable);
added = true;
}
@@ -567,7 +560,7 @@ public class GlyphTable {
}
if (subtables.size() > 0) {
GlyphSubtable st = (GlyphSubtable) subtables.get(0);
if (! st.isCompatible(subtable)) {
if (!st.isCompatible(subtable)) {
throw new AdvancedTypographicTableFormatException("subtable " + subtable + " is not compatible with subtable " + st);
}
}
@@ -580,7 +573,7 @@ public class GlyphTable {
* @param lookupTables map from lookup table identifers, e.g. "lu4", to lookup tables
*/
public void freezeSubtables(Map/*<String,LookupTable>*/ lookupTables) {
if (! frozen) {
if (!frozen) {
GlyphSubtable[] sta = getSubtables();
resolveLookupReferences(sta, lookupTables);
this.subtablesArray = sta;
@@ -1305,7 +1298,7 @@ public class GlyphTable {
Class c = r0.getClass();
for (int i = 1, n = rules.length; i < n; i++) {
Rule r = rules[i];
if ((r != null) && ! c.isInstance(r)) {
if ((r != null) && !c.isInstance(r)) {
throw new AdvancedTypographicTableFormatException("rules[" + i + "] is not an instance of " + c.getName());
}
}

+ 1
- 5
src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java Vedi File

@@ -33,10 +33,6 @@ import org.apache.fop.fonts.truetype.OFDirTabEntry;
import org.apache.fop.fonts.truetype.OFTableName;
import org.apache.fop.fonts.truetype.OpenFont;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: LineLengthCheck

/**
@@ -3791,7 +3787,7 @@ public final class OTFAdvancedTypographicTableReader {
} else {
boolean first = true;
for (int i = 0; i < ia.length; i++) {
if (! first) {
if (!first) {
sb.append(' ');
} else {
first = false;

+ 9
- 13
src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java Vedi File

@@ -33,10 +33,6 @@ import org.apache.fop.complexscripts.util.GlyphContextTester;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: LineLengthCheck

/**
@@ -159,11 +155,11 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
} else {
int s = a.getStart();
int e = a.getEnd();
if (! hasFinalPrecedingContext(ca, nc, s, e)) {
if (!hasFinalPrecedingContext(ca, nc, s, e)) {
return false;
} else if (forcesFinalThisContext(ca, nc, s, e)) {
return true;
} else if (! hasFinalFollowingContext(ca, nc, s, e)) {
} else if (!hasFinalFollowingContext(ca, nc, s, e)) {
return false;
} else {
return true;
@@ -180,9 +176,9 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
} else {
int s = a.getStart();
int e = a.getEnd();
if (! hasInitialPrecedingContext(ca, nc, s, e)) {
if (!hasInitialPrecedingContext(ca, nc, s, e)) {
return false;
} else if (! hasInitialFollowingContext(ca, nc, s, e)) {
} else if (!hasInitialFollowingContext(ca, nc, s, e)) {
return false;
} else {
return true;
@@ -211,9 +207,9 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
} else {
int s = a.getStart();
int e = a.getEnd();
if (! hasLigaturePrecedingContext(ca, nc, s, e)) {
if (!hasLigaturePrecedingContext(ca, nc, s, e)) {
return false;
} else if (! hasLigatureFollowingContext(ca, nc, s, e)) {
} else if (!hasLigatureFollowingContext(ca, nc, s, e)) {
return false;
} else {
return true;
@@ -230,11 +226,11 @@ public class ArabicScriptProcessor extends DefaultScriptProcessor {
} else {
int s = a.getStart();
int e = a.getEnd();
if (! hasMedialPrecedingContext(ca, nc, s, e)) {
if (!hasMedialPrecedingContext(ca, nc, s, e)) {
return false;
} else if (! hasMedialThisContext(ca, nc, s, e)) {
} else if (!hasMedialThisContext(ca, nc, s, e)) {
return false;
} else if (! hasMedialFollowingContext(ca, nc, s, e)) {
} else if (!hasMedialFollowingContext(ca, nc, s, e)) {
return false;
} else {
return true;

+ 11
- 16
src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java Vedi File

@@ -24,11 +24,6 @@ import org.apache.commons.logging.LogFactory;

import org.apache.fop.complexscripts.util.GlyphSequence;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: WhitespaceAfter
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: LineLengthCheck

/**
@@ -109,7 +104,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsHalfConsonant(GlyphSequence gs, int k) {
Boolean half = (Boolean) gs.getAssociation(k) . getPredication("half");
Boolean half = (Boolean) gs.getAssociation(k) .getPredication("half");
return (half != null) ? half.booleanValue() : false;
}

@@ -134,7 +129,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
// first candidate target is after first non-half consonant
for (int i = 0; i < ng; i++) {
if ((i != source) && containsConsonant(gs, i)) {
if (! containsHalfConsonant(gs, i)) {
if (!containsHalfConsonant(gs, i)) {
c1 = i + 1;
break;
}
@@ -142,7 +137,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) {
if (containsMatra(gs, i) && !containsPreBaseMatra(gs, i)) {
c2 = i + 1;
} else if (containsOtherMark(gs, i)) {
c2 = i;
@@ -159,7 +154,7 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsReph(GlyphSequence gs, int k) {
Boolean rphf = (Boolean) gs.getAssociation(k) . getPredication("rphf");
Boolean rphf = (Boolean) gs.getAssociation(k) .getPredication("rphf");
return (rphf != null) ? rphf.booleanValue() : false;
}

@@ -503,13 +498,13 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
}
static boolean isC(int c) {
return isType(c,C_C);
return isType(c, C_C);
}
static boolean isR(int c) {
return isType(c,C_C) && hasR(c);
return isType(c, C_C) && hasR(c);
}
static boolean isV(int c) {
return isType(c,C_V);
return isType(c, C_V);
}
static boolean isN(int c) {
return c == 0x093C;
@@ -518,10 +513,10 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
return c == 0x094D;
}
static boolean isM(int c) {
return isType(c,C_M);
return isType(c, C_M);
}
static boolean isPreM(int c) {
return isType(c,C_M) && hasFlag(c,C_PRE);
return isType(c, C_M) && hasFlag(c, C_PRE);
}
static boolean isX(int c) {
switch (typeOf(c)) {
@@ -535,10 +530,10 @@ public class DevanagariScriptProcessor extends IndicScriptProcessor {
}
}
static boolean hasR(int c) {
return hasFlag(c,C_R);
return hasFlag(c, C_R);
}
static boolean hasN(int c) {
return hasFlag(c,C_N);
return hasFlag(c, C_N);
}

}

+ 11
- 16
src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java Vedi File

@@ -24,11 +24,6 @@ import org.apache.commons.logging.LogFactory;

import org.apache.fop.complexscripts.util.GlyphSequence;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: WhitespaceAfter
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: LineLengthCheck

/**
@@ -109,7 +104,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsHalfConsonant(GlyphSequence gs, int k) {
Boolean half = (Boolean) gs.getAssociation(k) . getPredication("half");
Boolean half = (Boolean) gs.getAssociation(k) .getPredication("half");
return (half != null) ? half.booleanValue() : false;
}

@@ -134,7 +129,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
// first candidate target is after first non-half consonant
for (int i = 0; i < ng; i++) {
if ((i != source) && containsConsonant(gs, i)) {
if (! containsHalfConsonant(gs, i)) {
if (!containsHalfConsonant(gs, i)) {
c1 = i + 1;
break;
}
@@ -142,7 +137,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) {
if (containsMatra(gs, i) && !containsPreBaseMatra(gs, i)) {
c2 = i + 1;
} else if (containsOtherMark(gs, i)) {
c2 = i;
@@ -159,7 +154,7 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsReph(GlyphSequence gs, int k) {
Boolean rphf = (Boolean) gs.getAssociation(k) . getPredication("rphf");
Boolean rphf = (Boolean) gs.getAssociation(k) .getPredication("rphf");
return (rphf != null) ? rphf.booleanValue() : false;
}

@@ -503,13 +498,13 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
}
static boolean isC(int c) {
return isType(c,C_C);
return isType(c, C_C);
}
static boolean isR(int c) {
return isType(c,C_C) && hasR(c);
return isType(c, C_C) && hasR(c);
}
static boolean isV(int c) {
return isType(c,C_V);
return isType(c, C_V);
}
static boolean isN(int c) {
return c == 0x0ABC;
@@ -518,10 +513,10 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
return c == 0x0ACD;
}
static boolean isM(int c) {
return isType(c,C_M);
return isType(c, C_M);
}
static boolean isPreM(int c) {
return isType(c,C_M) && hasFlag(c,C_PRE);
return isType(c, C_M) && hasFlag(c, C_PRE);
}
static boolean isX(int c) {
switch (typeOf(c)) {
@@ -535,10 +530,10 @@ public class GujaratiScriptProcessor extends IndicScriptProcessor {
}
}
static boolean hasR(int c) {
return hasFlag(c,C_R);
return hasFlag(c, C_R);
}
static boolean hasN(int c) {
return hasFlag(c,C_N);
return hasFlag(c, C_N);
}

}

+ 11
- 16
src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java Vedi File

@@ -25,11 +25,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable;
import org.apache.fop.complexscripts.util.GlyphSequence;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: WhitespaceAfter
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: LineLengthCheck

/**
@@ -110,7 +105,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsHalfConsonant(GlyphSequence gs, int k) {
Boolean half = (Boolean) gs.getAssociation(k) . getPredication("half");
Boolean half = (Boolean) gs.getAssociation(k) .getPredication("half");
return (half != null) ? half.booleanValue() : false;
}

@@ -135,7 +130,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
// first candidate target is after first non-half consonant
for (int i = 0; i < ng; i++) {
if ((i != source) && containsConsonant(gs, i)) {
if (! containsHalfConsonant(gs, i)) {
if (!containsHalfConsonant(gs, i)) {
c1 = i + 1;
break;
}
@@ -143,7 +138,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
// second candidate target is after last non-prebase matra after first candidate or before first syllable or vedic mark
for (int i = (c1 >= 0) ? c1 : 0; i < ng; i++) {
if (containsMatra(gs, i) && ! containsPreBaseMatra(gs, i)) {
if (containsMatra(gs, i) && !containsPreBaseMatra(gs, i)) {
c2 = i + 1;
} else if (containsOtherMark(gs, i)) {
c2 = i;
@@ -160,7 +155,7 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}

private static boolean containsReph(GlyphSequence gs, int k) {
Boolean rphf = (Boolean) gs.getAssociation(k) . getPredication("rphf");
Boolean rphf = (Boolean) gs.getAssociation(k) .getPredication("rphf");
return (rphf != null) ? rphf.booleanValue() : false;
}

@@ -504,13 +499,13 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
}
static boolean isC(int c) {
return isType(c,C_C);
return isType(c, C_C);
}
static boolean isR(int c) {
return isType(c,C_C) && hasR(c);
return isType(c, C_C) && hasR(c);
}
static boolean isV(int c) {
return isType(c,C_V);
return isType(c, C_V);
}
static boolean isN(int c) {
return c == 0x0A3C;
@@ -519,10 +514,10 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
return c == 0x0A4D;
}
static boolean isM(int c) {
return isType(c,C_M);
return isType(c, C_M);
}
static boolean isPreM(int c) {
return isType(c,C_M) && hasFlag(c,C_PRE);
return isType(c, C_M) && hasFlag(c, C_PRE);
}
static boolean isX(int c) {
switch (typeOf(c)) {
@@ -536,10 +531,10 @@ public class GurmukhiScriptProcessor extends IndicScriptProcessor {
}
}
static boolean hasR(int c) {
return hasFlag(c,C_R);
return hasFlag(c, C_R);
}
static boolean hasN(int c) {
return hasFlag(c,C_N);
return hasFlag(c, C_N);
}

@Override

+ 4
- 13
src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java Vedi File

@@ -36,13 +36,6 @@ import org.apache.fop.complexscripts.util.GlyphContextTester;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: EmptyForIteratorPadCheck
// CSOFF: WhitespaceAfterCheck
// CSOFF: ParameterNumberCheck
// CSOFF: LineLengthCheck

/**
@@ -222,7 +215,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
}

private GlyphSequence[] syllabize(GlyphSequence gs, String script, String language) {
return Syllabizer.getSyllabizer(script, language, getSyllabizerClass()) . syllabize(gs);
return Syllabizer.getSyllabizer(script, language, getSyllabizerClass()) .syllabize(gs);
}

private GlyphSequence unsyllabize(GlyphSequence gs, GlyphSequence[] sa) {
@@ -384,12 +377,10 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
public boolean equals(Object o) {
if (o instanceof Syllabizer) {
Syllabizer s = (Syllabizer) o;
if (! s.script.equals(script)) {
return false;
} else if (! s.language.equals(language)) {
if (!s.script.equals(script)) {
return false;
} else {
return true;
return s.language.equals(language);
}
} else {
return false;
@@ -408,7 +399,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor {
}
return d;
}
private static Map<String,Syllabizer> syllabizers = new HashMap<String,Syllabizer>();
private static Map<String, Syllabizer> syllabizers = new HashMap<String, Syllabizer>();
static Syllabizer getSyllabizer(String script, String language, Class<? extends Syllabizer> syllabizerClass) {
String sid = makeSyllabizerId(script, language);
Syllabizer s = syllabizers.get(sid);

+ 3
- 9
src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java Vedi File

@@ -31,11 +31,7 @@ import org.apache.fop.complexscripts.util.CharScript;
import org.apache.fop.complexscripts.util.GlyphSequence;
import org.apache.fop.complexscripts.util.ScriptContextTester;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: ParameterNumberCheck
// CSOFF: SimplifyBooleanReturnCheck

/**
* <p>Abstract script processor base class for which an implementation of the substitution and positioning methods
@@ -278,14 +274,12 @@ public abstract class ScriptProcessor {
public boolean equals(Object o) {
if (o instanceof AssembledLookupsKey) {
AssembledLookupsKey k = (AssembledLookupsKey) o;
if (! table.equals(k.table)) {
if (!table.equals(k.table)) {
return false;
} else if (! Arrays.equals(features, k.features)) {
return false;
} else if (! lookups.equals(k.lookups)) {
} else if (!Arrays.equals(features, k.features)) {
return false;
} else {
return true;
return lookups.equals(k.lookups);
}
} else {
return false;

+ 15
- 23
src/java/org/apache/fop/complexscripts/util/CharScript.java Vedi File

@@ -28,12 +28,6 @@ import java.util.Set;

import org.apache.fop.util.CharUtilities;

// CSOFF: AvoidNestedBlocksCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: SimplifyBooleanReturnCheck
// CSOFF: WhitespaceAfterCheck

/**
* <p>Script related utilities.</p>
*
@@ -754,16 +748,14 @@ public final class CharScript {
case SCRIPT_UNCODED:
break;
default:
{
Integer v = (Integer) e.getValue();
assert v != null;
int c = v.intValue();
if (c > cMax) {
cMax = c;
sMax = s;
}
break;
Integer v = (Integer) e.getValue();
assert v != null;
int c = v.intValue();
if (c > cMax) {
cMax = c;
sMax = s;
}
break;
}
}
if (sMax < 0) {
@@ -823,7 +815,7 @@ public final class CharScript {
* @return a script tag
*/
public static String scriptTagFromCode(int code) {
Map<Integer,String> m = getScriptTagsMap();
Map<Integer, String> m = getScriptTagsMap();
if (m != null) {
String tag;
if ((tag = m.get(Integer.valueOf(code))) != null) {
@@ -842,7 +834,7 @@ public final class CharScript {
* @return a script code
*/
public static int scriptCodeFromTag(String tag) {
Map<String,Integer> m = getScriptCodeMap();
Map<String, Integer> m = getScriptCodeMap();
if (m != null) {
Integer c;
if ((c = m.get(tag)) != null) {
@@ -855,8 +847,8 @@ public final class CharScript {
}
}

private static Map<Integer,String> scriptTagsMap = null;
private static Map<String,Integer> scriptCodeMap = null;
private static Map<Integer, String> scriptTagsMap = null;
private static Map<String, Integer> scriptCodeMap = null;

private static void putScriptTag(Map tm, Map cm, int code, String tag) {
assert tag != null;
@@ -868,8 +860,8 @@ public final class CharScript {
}

private static void makeScriptMaps() {
HashMap<Integer,String> tm = new HashMap<Integer,String>();
HashMap<String,Integer> cm = new HashMap<String,Integer>();
HashMap<Integer, String> tm = new HashMap<Integer, String>();
HashMap<String, Integer> cm = new HashMap<String, Integer>();
putScriptTag(tm, cm, SCRIPT_HEBREW, "hebr");
putScriptTag(tm, cm, SCRIPT_MONGOLIAN, "mong");
putScriptTag(tm, cm, SCRIPT_ARABIC, "arab");
@@ -915,14 +907,14 @@ public final class CharScript {
scriptCodeMap = cm;
}

private static Map<Integer,String> getScriptTagsMap() {
private static Map<Integer, String> getScriptTagsMap() {
if (scriptTagsMap == null) {
makeScriptMaps();
}
return scriptTagsMap;
}

private static Map<String,Integer> getScriptCodeMap() {
private static Map<String, Integer> getScriptCodeMap() {
if (scriptCodeMap == null) {
makeScriptMaps();
}

+ 8
- 11
src/java/org/apache/fop/complexscripts/util/GlyphSequence.java Vedi File

@@ -26,10 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: WhitespaceAfterCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* <p>A GlyphSequence encapsulates a sequence of character codes, a sequence of glyph codes,
@@ -639,10 +636,10 @@ public class GlyphSequence implements Cloneable {
private final int offset;
private final int count;
private final int[] subIntervals;
private Map<String,Object> predications;
private Map<String, Object> predications;

// class state
private static volatile Map<String,PredicationMerger> predicationMergers;
private static volatile Map<String, PredicationMerger> predicationMergers;

interface PredicationMerger {
Object merge(String key, Object v1, Object v2);
@@ -724,7 +721,7 @@ public class GlyphSequence implements Cloneable {
public boolean contained(int offset, int count) {
int s = offset;
int e = offset + count;
if (! isDisjoint()) {
if (!isDisjoint()) {
int s0 = getStart();
int e0 = getEnd();
return (s0 >= s) && (e0 <= e);
@@ -748,7 +745,7 @@ public class GlyphSequence implements Cloneable {
*/
public void setPredication(String key, Object value) {
if (predications == null) {
predications = new HashMap<String,Object>();
predications = new HashMap<String, Object>();
}
if (predications != null) {
predications.put(key, value);
@@ -775,7 +772,7 @@ public class GlyphSequence implements Cloneable {
*/
public void mergePredication(String key, Object value) {
if (predications == null) {
predications = new HashMap<String,Object>();
predications = new HashMap<String, Object>();
}
if (predications != null) {
if (predications.containsKey(key)) {
@@ -813,7 +810,7 @@ public class GlyphSequence implements Cloneable {
*/
public void mergePredications(CharAssociation ca) {
if (ca.predications != null) {
for (Map.Entry<String,Object> e : ca.predications.entrySet()) {
for (Map.Entry<String, Object> e : ca.predications.entrySet()) {
mergePredication(e.getKey(), e.getValue());
}
}
@@ -824,7 +821,7 @@ public class GlyphSequence implements Cloneable {
try {
CharAssociation ca = (CharAssociation) super.clone();
if (predications != null) {
ca.predications = new HashMap<String,Object>(predications);
ca.predications = new HashMap<String, Object>(predications);
}
return ca;
} catch (CloneNotSupportedException e) {
@@ -839,7 +836,7 @@ public class GlyphSequence implements Cloneable {
*/
public static void setPredicationMerger(String key, PredicationMerger pm) {
if (predicationMergers == null) {
predicationMergers = new HashMap<String,PredicationMerger>();
predicationMergers = new HashMap<String, PredicationMerger>();
}
if (predicationMergers != null) {
predicationMergers.put(key, pm);

+ 15
- 24
src/java/org/apache/fop/complexscripts/util/NumberConverter.java Vedi File

@@ -23,9 +23,6 @@ import java.util.ArrayList;
import java.util.List;

// CSOFF: LineLengthCheck
// CSOFF: InnerAssignmentCheck
// CSOFF: NoWhitespaceAfterCheck
// CSOFF: AvoidNestedBlocksCheck

/**
* <p>Implementation of Number to String Conversion algorithm specified by
@@ -186,10 +183,10 @@ public class NumberConverter {
separators.add(token.toArray(new Integer [ token.size() ]));
}
}
if (! separators.isEmpty()) {
if (!separators.isEmpty()) {
this.prefix = separators.remove(0);
}
if (! separators.isEmpty()) {
if (!separators.isEmpty()) {
this.suffix = separators.remove(separators.size() - 1);
}
this.separators = separators.toArray(new Integer [ separators.size() ] []);
@@ -260,33 +257,27 @@ public class NumberConverter {
int s = token[0].intValue();
switch (s) {
case (int) '1':
{
fn = formatNumberAsDecimal(number, (int) '1', 1);
break;
}
fn = formatNumberAsDecimal(number, (int) '1', 1);
break;
case (int) 'W':
case (int) 'w':
{
fn = formatNumberAsWord(number, (s == (int) 'W') ? Character.UPPERCASE_LETTER : Character.LOWERCASE_LETTER);
break;
}
fn = formatNumberAsWord(number, (s == (int) 'W') ? Character.UPPERCASE_LETTER : Character.LOWERCASE_LETTER);
break;
case (int) 'A': // handled as numeric sequence
case (int) 'a': // handled as numeric sequence
case (int) 'I': // handled as numeric special
case (int) 'i': // handled as numeric special
default:
{
if (isStartOfDecimalSequence(s)) {
fn = formatNumberAsDecimal(number, s, 1);
} else if (isStartOfAlphabeticSequence(s)) {
fn = formatNumberAsSequence(number, s, getSequenceBase(s), null);
} else if (isStartOfNumericSpecial(s)) {
fn = formatNumberAsSpecial(number, s);
} else {
fn = null;
}
break;
if (isStartOfDecimalSequence(s)) {
fn = formatNumberAsDecimal(number, s, 1);
} else if (isStartOfAlphabeticSequence(s)) {
fn = formatNumberAsSequence(number, s, getSequenceBase(s), null);
} else if (isStartOfNumericSpecial(s)) {
fn = formatNumberAsSpecial(number, s);
} else {
fn = null;
}
break;
}
} else if ((token.length == 2) && (token[0] == (int) 'W') && (token[1] == (int) 'w')) {
fn = formatNumberAsWord(number, Character.TITLECASE_LETTER);

+ 0
- 1
src/java/org/apache/fop/complexscripts/util/UTF32.java Vedi File

@@ -21,7 +21,6 @@ package org.apache.fop.complexscripts.util;

import org.apache.fop.util.CharUtilities;

// CSOFF: InnerAssignmentCheck

/**
* <p>UTF32 related utilities.</p>

+ 0
- 1
src/java/org/apache/fop/fonts/apps/TTFReader.java Vedi File

@@ -39,7 +39,6 @@ import org.apache.fop.fonts.truetype.FontFileReader;
import org.apache.fop.fonts.truetype.OFFontLoader;
import org.apache.fop.fonts.truetype.TTFFile;

// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck

/**

+ 5
- 6
src/java/org/apache/fop/text/linebreak/LineBreakUtils.java Vedi File

@@ -29,7 +29,6 @@ package org.apache.fop.text.linebreak;
* - commit BOTH changed files
*/

// CSOFF: WhitespaceAfterCheck
// CSOFF: LineLengthCheck

/** Line breaking utilities. */
@@ -694,11 +693,11 @@ public final class LineBreakUtils {
"CP", "CR", "EX", "GL", "H2", "H3", "HY", "ID", "IN", "IS", "JL", "JT", "JV", "LF", "NL", "NS", "NU", "OP",
"PO", "PR", "QU", "SA", "SG", "SP", "SY", "WJ", "XX", "ZW"};

private static String[] lineBreakPropertyLongNames = {"Ambiguous","Alphabetic","Break_Both","Break_After","Break_Before",
"Mandatory_Break","Contingent_Break","Close_Punctuation","Combining_Mark","Close_Parenthesis","Carriage_Return",
"Exclamation","Glue","H2","H3","Hyphen","Ideographic","Inseparable","Infix_Numeric","JL","JT","JV","Line_Feed",
"Next_Line","Nonstarter","Numeric","Open_Punctuation","Postfix_Numeric","Prefix_Numeric","Quotation","Complex_Context",
"Surrogate","Space","Break_Symbols","Word_Joiner","Unknown","ZWSpace"};
private static String[] lineBreakPropertyLongNames = {"Ambiguous", "Alphabetic", "Break_Both", "Break_After", "Break_Before",
"Mandatory_Break", "Contingent_Break", "Close_Punctuation", "Combining_Mark", "Close_Parenthesis", "Carriage_Return",
"Exclamation", "Glue", "H2", "H3", "Hyphen", "Ideographic", "Inseparable", "Infix_Numeric", "JL", "JT", "JV", "Line_Feed",
"Next_Line", "Nonstarter", "Numeric", "Open_Punctuation", "Postfix_Numeric", "Prefix_Numeric", "Quotation", "Complex_Context",
"Surrogate", "Space", "Break_Symbols", "Word_Joiner", "Unknown", "ZWSpace"};

/**
* Return the short name for the linebreak property corresponding

+ 0
- 1
test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java Vedi File

@@ -23,7 +23,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

// CSOFF: WhitespaceAfterCheck

/*
* !!! THIS IS A GENERATED FILE !!!

+ 0
- 2
test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java Vedi File

@@ -72,9 +72,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


// CSOFF: InnerAssignmentCheck
// CSOFF: LineLengthCheck
// CSOFF: NoWhitespaceAfterCheck

/**
* This class supports a subset of the <code>TTX</code> file as produced by the Adobe FLEX

Loading…
Annulla
Salva