You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/06/10 11:52:28 UTC
svn commit: r666048 [1/2] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/text/linebreak/
src/java/org/apache/fop/layoutmgr/
src/java/org/apache/fop/layoutmgr/inline/ src/java/o...
Author: acumiskey
Date: Tue Jun 10 02:52:27 2008
New Revision: 666048
URL: http://svn.apache.org/viewvc?rev=666048&view=rev
Log:
Merged revisions 665740,665793,665995 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r665740 | adelmelle | 2008-06-09 17:20:08 +0100 (Mon, 09 Jun 2008) | 1 line
Minor update: make the codegen-unicode target create LineBreakUtils.java at the appropriate place in the source tree
........
r665793 | adelmelle | 2008-06-09 18:27:51 +0100 (Mon, 09 Jun 2008) | 9 lines
Some updates (improvements?) in the UAX#14-related files:
- LineBreakPairTable.txt: replace tabs with spaces to make the file a bit easier to read (constant column-width, instead of depending on an editor's settings for tabs)
- GenerateLineBreakUtils.java:
- generate a public final utility class
- add some spacing in the generated file, after commas and before/after '=' (same styling as manually created files)
- use Java 1.4 String.split() to tokenize lines, instead of StringTokenizer
- add javadoc comments for public constants and methods
- LineBreakUtils.java: regenerated after the above updates
........
r665995 | maxberger | 2008-06-10 08:52:36 +0100 (Tue, 10 Jun 2008) | 1 line
Replaced getLast() calls with calls to listUtil
........
Added:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/util/ListUtil.java
- copied unchanged from r665995, xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ListUtil.java
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/ (props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/data/LineBreakPairTable.txt
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 10 02:52:27 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-665701
+/xmlgraphics/fop/trunk:1-666033
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml Tue Jun 10 02:52:27 2008
@@ -1418,9 +1418,10 @@
<!-- =================================================================== -->
<!-- Helper task to generate source files that have already been -->
- <!-- checked into CVS. For these files, CVS version is the official one -->
- <!-- and may have updates that will *not* be generated by below. This -->
- <!-- target should never be part of the normal build process. -->
+ <!-- checked into the repository. For these files, the version in the -->
+ <!-- in the repository is the official one and may have updates that will-->
+ <!-- *not* be generated by below. -->
+ <!-- This target should never be part of the normal build process. -->
<!-- =================================================================== -->
<target name="codegen-unicode" >
<mkdir dir="${build.codegen-classes.dir}"/>
@@ -1429,7 +1430,9 @@
source="${javac.source}" target="${javac.target}">
<src path="${src.codegen.dir}/unicode/java"/>
</javac>
- <java classname="org.apache.fop.text.linebreak.GenerateLineBreakUtils" classpath="${build.codegen-classes.dir}" />
+ <java classname="org.apache.fop.text.linebreak.GenerateLineBreakUtils" classpath="${build.codegen-classes.dir}">
+ <arg line="-o ${src.dir}/java/org/apache/fop/text/linebreak/LineBreakUtils.java" />
+ </java>
</target>
<!-- =================================================================== -->
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/data/LineBreakPairTable.txt
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/data/LineBreakPairTable.txt?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/data/LineBreakPairTable.txt (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/data/LineBreakPairTable.txt Tue Jun 10 02:52:27 2008
@@ -1,28 +1,28 @@
- OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
-OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
-CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
-QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
-GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
-NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
-EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
-SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
-IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
-PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
-PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
-NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
-AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
-ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
-IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
-HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
-BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
-BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
-B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
-ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
-CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
-WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
-H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
-H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
-JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
-JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
-JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
-
+ OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
+OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
+CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
+QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
+GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
+NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
+EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
+SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
+IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
+PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
+PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
+NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
+AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
+ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
+IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
+HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
+BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
+BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
+B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
+ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
+CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
+WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
+H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
+H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
+JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
+JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
+JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
+
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java Tue Jun 10 02:52:27 2008
@@ -30,7 +30,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
/**
* <p>Utility for generating a Java class representing line break properties
@@ -55,6 +54,7 @@
private static final byte COMBINING_PROHIBITED_BREAK = 3; // @ in table
private static final byte PROHIBITED_BREAK = 4; // ^ in table
private static final byte EXPLICIT_BREAK = 5; // ! in rules
+ private static final String BREAK_CLASS_TOKENS = "_%#@^!";
private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" };
private static final byte lineBreakProperties[] = new byte[0x10000];
@@ -103,27 +103,32 @@
BufferedReader b = new BufferedReader(new FileReader(breakPairFileName));
String line = b.readLine();
int lineNumber = 1;
+ String[] lineTokens;
+ String name;
// read header
if (line != null) {
- StringTokenizer tok = new StringTokenizer(line);
+ lineTokens = line.split("\\s+");
byte columnNumber = 0;
- while (tok.hasMoreTokens()) {
- String name = tok.nextToken();
- if (columnNumber >= columnHeader.length) {
- throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected column header " + name);
- }
- if (notInPairTableMap.get(name) != null) {
- throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid column header " + name);
- }
- Byte v = (Byte)lineBreakPropertyValues.get(name);
- if (v != null) {
- byte vv = v.byteValue();
- columnHeader[columnNumber] = vv;
- columnMap[vv] = columnNumber;
- } else {
- throw new Exception(breakPairFileName + ':' + lineNumber + ": unknown column header " + name);
+
+ for (int i = 0; i < lineTokens.length; ++i) {
+ name = lineTokens[i];
+ if (name.length() > 0) {
+ if (columnNumber >= columnHeader.length) {
+ throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected column header " + name);
+ }
+ if (notInPairTableMap.get(name) != null) {
+ throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid column header " + name);
+ }
+ Byte v = (Byte)lineBreakPropertyValues.get(name);
+ if (v != null) {
+ byte vv = v.byteValue();
+ columnHeader[columnNumber] = vv;
+ columnMap[vv] = columnNumber;
+ } else {
+ throw new Exception(breakPairFileName + ':' + lineNumber + ": unknown column header " + name);
+ }
+ columnNumber++;
}
- columnNumber++;
}
if (columnNumber < columnHeader.length) {
StringBuffer missing = new StringBuffer();
@@ -156,9 +161,9 @@
throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected row " + line);
}
pairTable[rowNumber] = new byte[tableSize];
- StringTokenizer tok = new StringTokenizer(line);
- if (tok.hasMoreTokens()) {
- String name = tok.nextToken();
+ lineTokens = line.split("\\s+");
+ if (lineTokens.length > 0) {
+ name = lineTokens[0];
if (notInPairTableMap.get(name) != null) {
throw new Exception(breakPairFileName + ':' + lineNumber + ": invalid row header " + name);
}
@@ -174,27 +179,15 @@
throw new Exception(breakPairFileName + ':' + lineNumber + ": can't read row header");
}
int columnNumber = 0;
- while (tok.hasMoreTokens()) {
- String token = tok.nextToken();
+ String token;
+ for (int i = 1; i < lineTokens.length; ++i) {
+ token = lineTokens[i];
if (token.length() == 1) {
- switch (token.charAt(0)) {
- case '^' :
- pairTable[rowNumber][columnNumber] = PROHIBITED_BREAK;
- break;
- case '%' :
- pairTable[rowNumber][columnNumber] = INDIRECT_BREAK;
- break;
- case '_' :
- pairTable[rowNumber][columnNumber] = DIRECT_BREAK;
- break;
- case '#' :
- pairTable[rowNumber][columnNumber] = COMBINING_INDIRECT_BREAK;
- break;
- case '@' :
- pairTable[rowNumber][columnNumber] = COMBINING_PROHIBITED_BREAK;
- break;
- default :
- throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected token: " + token);
+ byte tokenBreakClass = (byte)BREAK_CLASS_TOKENS.indexOf(token.charAt(0));
+ if (tokenBreakClass >= 0) {
+ pairTable[rowNumber][columnNumber] = tokenBreakClass;
+ } else {
+ throw new Exception(breakPairFileName + ':' + lineNumber + ": unexpected token: " + token);
}
} else {
throw new Exception(breakPairFileName + ':' + lineNumber + ": token too long: " + token);
@@ -255,23 +248,35 @@
out.println("package org.apache.fop.text.linebreak;");
out.println();
out.println("/* ");
- out.println(" * This is a generated file, DO NOT CHANGE!");
+ out.println(" * !!! THIS IS A GENERATED FILE !!! ");
+ out.println(" * If updates to the source are needed, then:");
+ out.println(" * - apply the necessary modifications to ");
+ out.println(" * 'src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java'");
+ out.println(" * - run 'ant codegen-unicode', which will generate a new LineBreakUtils.java");
+ out.println(" * in 'src/java/org/apache/fop/text/linebreak'");
+ out.println(" * - commit BOTH changed files");
out.println(" */");
out.println();
- out.println("class LineBreakUtils {");
+ out.println("public final class LineBreakUtils {");
out.println();
+ out.println(" /** Break class constant */");
out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';');
+ out.println(" /** Break class constant */");
out.println(" public static final byte INDIRECT_BREAK = " + INDIRECT_BREAK + ';');
+ out.println(" /** Break class constant */");
out.println(" public static final byte COMBINING_INDIRECT_BREAK = " + COMBINING_INDIRECT_BREAK + ';');
+ out.println(" /** Break class constant */");
out.println(" public static final byte COMBINING_PROHIBITED_BREAK = " + COMBINING_PROHIBITED_BREAK + ';');
+ out.println(" /** Break class constant */");
out.println(" public static final byte PROHIBITED_BREAK = " + PROHIBITED_BREAK + ';');
+ out.println(" /** Break class constant */");
out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';');
out.println();
out.println(" private static final byte PAIR_TABLE[][] = {");
boolean printComma = false;
for (int i = 1; i <= lineBreakPropertyValueCount; i++) {
if (printComma) {
- out.println(',');
+ out.println(", ");
} else {
printComma = true;
}
@@ -279,7 +284,7 @@
boolean localPrintComma = false;
for (int j = 1; j <= lineBreakPropertyValueCount; j++) {
if (localPrintComma) {
- out.print(',');
+ out.print(", ");
} else {
localPrintComma = true;
}
@@ -313,7 +318,7 @@
found = true;
doStaticLinkCode.append(" lineBreakProperties[");
doStaticLinkCode.append(i);
- doStaticLinkCode.append("]=lineBreakProperties[");
+ doStaticLinkCode.append("] = lineBreakProperties[");
doStaticLinkCode.append(j);
doStaticLinkCode.append("];\n");
break;
@@ -322,7 +327,7 @@
}
if (!found) {
if (rowsPrinted >= 64) {
- out.println(" };");
+ out.println(" }");
out.println();
initSections++;
out.println(" private static void init_" + initSections + "() {");
@@ -334,7 +339,7 @@
for (int k = 0; k < blocksize; k++) {
row[i][k] = lineBreakProperties[idx + k];
if (printLocalComma) {
- out.print(',');
+ out.print(", ");
} else {
printLocalComma = true;
}
@@ -345,20 +350,21 @@
}
idx += blocksize;
}
- out.println(" };");
+ out.println(" }");
out.println();
out.println(" static {");
for (int i = 0; i <= initSections; i++) {
out.println(" init_" + i + "();");
}
out.print(doStaticLinkCode);
- out.println(" };");
+ out.println(" }");
out.println();
for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) {
String shortName = (String)lineBreakPropertyShortNames.get(i);
+ out.println(" /** Linebreak property constant */");
out.print(" public static final byte LINE_BREAK_PROPERTY_");
out.print(shortName);
- out.print('=');
+ out.print(" = ");
out.print(i + 1);
out.println(';');
}
@@ -368,9 +374,9 @@
int lineLength = shortNamePrefix.length();
printComma = false;
for (int i = 0; i < lineBreakPropertyShortNames.size(); i++) {
- String name = (String)lineBreakPropertyShortNames.get(i);
+ name = (String)lineBreakPropertyShortNames.get(i);
if (printComma) {
- out.print(',');
+ out.print(", ");
lineLength++;
} else {
printComma = true;
@@ -392,7 +398,7 @@
lineLength = longNamePrefix.length();
printComma = false;
for (int i = 0; i < lineBreakPropertyLongNames.size(); i++) {
- String name = (String)lineBreakPropertyLongNames.get(i);
+ name = (String)lineBreakPropertyLongNames.get(i);
if (printComma) {
out.print(',');
lineLength++;
@@ -411,32 +417,62 @@
}
out.println("};");
out.println();
+ out.println(" /**");
+ out.println(" * Return the short name for the linebreak property corresponding ");
+ out.println(" * to the given symbolic constant.");
+ out.println(" *");
+ out.println(" * @param i the numeric value of the linebreak property");
+ out.println(" * @return the short name of the linebreak property");
+ out.println(" */");
out.println(" public static String getLineBreakPropertyShortName(byte i) {");
- out.println(" if (i>0 && i<=lineBreakPropertyShortNames.length) {");
- out.println(" return lineBreakPropertyShortNames[i-1];");
+ out.println(" if (i > 0 && i <= lineBreakPropertyShortNames.length) {");
+ out.println(" return lineBreakPropertyShortNames[i - 1];");
out.println(" } else {");
out.println(" return null;");
out.println(" }");
out.println(" }");
out.println();
+ out.println(" /**");
+ out.println(" * Return the long name for the linebreak property corresponding ");
+ out.println(" * to the given symbolic constant.");
+ out.println(" *");
+ out.println(" * @param i the numeric value of the linebreak property");
+ out.println(" * @return the long name of the linebreak property");
+ out.println(" */");
out.println(" public static String getLineBreakPropertyLongName(byte i) {");
- out.println(" if (i>0 && i<=lineBreakPropertyLongNames.length) {");
- out.println(" return lineBreakPropertyLongNames[i-1];");
+ out.println(" if (i > 0 && i <= lineBreakPropertyLongNames.length) {");
+ out.println(" return lineBreakPropertyLongNames[i - 1];");
out.println(" } else {");
out.println(" return null;");
out.println(" }");
out.println(" }");
out.println();
+ out.println(" /**");
+ out.println(" * Return the linebreak property constant for the given <code>char</code>");
+ out.println(" *");
+ out.println(" * @param c the <code>char</code> whose linebreak property to return");
+ out.println(" * @return the constant representing the linebreak property");
+ out.println(" */");
out.println(" public static byte getLineBreakProperty(char c) {");
- out.println(" return lineBreakProperties[c/" + blocksize + "][c%" + blocksize + "];");
+ out.println(" return lineBreakProperties[c / " + blocksize + "][c % " + blocksize + "];");
out.println(" }");
out.println();
+ out.println(" /**");
+ out.println(" * Return the break class constant for the given pair of linebreak ");
+ out.println(" * property constants.");
+ out.println(" *");
+ out.println(" * @param lineBreakPropertyBefore the linebreak property for the first character");
+ out.println(" * in a two-character sequence");
+ out.println(" * @param lineBreakPropertyAfter the linebreak property for the second character");
+ out.println(" * in a two-character sequence");
+ out.println(" * @return the constant representing the break class");
+ out.println(" */");
out.println(
- " public static byte getLineBreakPairProperty(int lineBreakPropertyBefore,int lineBreakPropertyAfter) {");
- out.println(" return PAIR_TABLE[lineBreakPropertyBefore-1][lineBreakPropertyAfter-1];");
+ " public static byte getLineBreakPairProperty(int lineBreakPropertyBefore, int lineBreakPropertyAfter) {");
+ out.println(" return PAIR_TABLE[lineBreakPropertyBefore - 1][lineBreakPropertyAfter - 1];");
out.println(" }");
out.println();
- out.println("};");
+ out.println("}");
out.flush();
out.close();
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Tue Jun 10 02:52:27 2008
@@ -28,6 +28,7 @@
import org.apache.fop.fo.Constants;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
/**
* Abstract base class for breakers (page breakers, static region handlers etc.).
@@ -116,8 +117,8 @@
public KnuthSequence endSequence(Position breakPosition) {
// remove glue and penalty item at the end of the paragraph
while (this.size() > ignoreAtStart
- && !((KnuthElement)this.get(this.size() - 1)).isBox()) {
- this.remove(this.size() - 1);
+ && !((KnuthElement) ListUtil.getLast(this)).isBox()) {
+ ListUtil.removeLast(this);
}
if (this.size() > ignoreAtStart) {
// add the elements representing the space at the end of the last line
@@ -215,7 +216,7 @@
/** @return true if there's no content that could be handled. */
public boolean isEmpty() {
- return (this.blockLists.size() == 0);
+ return (this.blockLists.isEmpty());
}
protected void startPart(BlockSequence list, int breakClass) {
@@ -551,7 +552,7 @@
BlockSequence blockList;
List returnedList = getNextKnuthElements(childLC, alignment);
if (returnedList != null) {
- if (returnedList.size() == 0) {
+ if (returnedList.isEmpty()) {
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
return nextSequenceStartsOn;
}
@@ -561,10 +562,9 @@
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
Position breakPosition = null;
- if (((KnuthElement) returnedList.get(returnedList.size() - 1))
- .isForcedBreak()) {
- KnuthPenalty breakPenalty = (KnuthPenalty) returnedList
- .remove(returnedList.size() - 1);
+ if (((KnuthElement) ListUtil.getLast(returnedList)).isForcedBreak()) {
+ KnuthPenalty breakPenalty = (KnuthPenalty) ListUtil
+ .removeLast(returnedList);
breakPosition = breakPenalty.getPosition();
switch (breakPenalty.getBreakClass()) {
case Constants.EN_PAGE:
@@ -745,12 +745,12 @@
if (!bBoxSeen) {
// this is the first box met in this page
bBoxSeen = true;
- } else if (unconfirmedList.size() > 0) {
- // glue items in unconfirmedList were not after
- // the last box
- // in this page; they must be added to
- // blockSpaceList
- while (unconfirmedList.size() > 0) {
+ } else {
+ while (!unconfirmedList.isEmpty()) {
+ // glue items in unconfirmedList were not after
+ // the last box
+ // in this page; they must be added to
+ // blockSpaceList
KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
.removeFirst();
spaceMaxAdjustment.max += ((KnuthGlue) blockSpace)
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -39,6 +39,7 @@
import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.util.ListUtil;
/**
* LayoutManager for a block-container FO.
@@ -285,7 +286,7 @@
// get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment);
- if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+ if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
//Propagate keep-with-previous up from the first child
context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
childLC.clearKeepWithPreviousPending();
@@ -317,12 +318,12 @@
addInBetweenBreak(contentList, context, childLC);
}
contentList.addAll(returnedList);
- if (returnedList.size() == 0) {
+ if (returnedList.isEmpty()) {
//Avoid NoSuchElementException below (happens with empty blocks)
continue;
}
- if (((ListElement) returnedList
- .get(returnedList.size() - 1)).isForcedBreak()) {
+ if (((ListElement) ListUtil.getLast(returnedList))
+ .isForcedBreak()) {
// a descendant of this block has break-after
if (curLM.isFinished()) {
// there is no other content in this block;
@@ -754,7 +755,7 @@
// pos was created by this BCLM and was inside an element
// representing space before or after
// this means the space was not discarded
- if (positionList.size() == 0 && bcpos == null) {
+ if (positionList.isEmpty() && bcpos == null) {
// pos was in the element representing space-before
bSpaceBefore = true;
} else {
@@ -801,9 +802,10 @@
// // between consecutive pages
List splitList = new LinkedList();
int splitLength = 0;
- int iFirst = ((MappingPosition) positionList.get(0)).getFirstIndex();
- int iLast = ((MappingPosition) positionList.get(positionList
- .size() - 1)).getLastIndex();
+ int iFirst = ((MappingPosition) positionList.get(0))
+ .getFirstIndex();
+ int iLast = ((MappingPosition) ListUtil.getLast(positionList))
+ .getLastIndex();
// copy from storedList to splitList all the elements from
// iFirst to iLast
ListIterator storedListIterator = storedList.listIterator(iFirst);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -36,6 +36,7 @@
import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
/**
* Base LayoutManager class for all areas which stack their child
@@ -296,7 +297,7 @@
// get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment);
- if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+ if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
//Propagate keep-with-previous up from the first child
context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
childLC.clearKeepWithPreviousPending();
@@ -312,7 +313,7 @@
break;
}
- if (contentList.size() == 0) {
+ if (contentList.isEmpty()) {
// Empty fo:block, zero-length box makes sure the IDs and/or markers
// are registered and borders/padding are painted.
returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false));
@@ -339,17 +340,17 @@
// before the one handled by curLM
addInBetweenBreak(contentList, context, childLC);
}
- if (returnedList == null || returnedList.size() == 0) {
+ if (returnedList == null || returnedList.isEmpty()) {
//Avoid NoSuchElementException below (happens with empty blocks)
continue;
}
contentList.addAll(returnedList);
- if (((ListElement) returnedList.get(returnedList.size() - 1))
+ if (((ListElement) ListUtil.getLast(returnedList))
.isForcedBreak()) {
// a descendant of this block has break-after
if (curLM.isFinished() && !hasNextChildLM()) {
- forcedBreakAfterLast = (BreakElement) contentList
- .remove(contentList.size() - 1);
+ forcedBreakAfterLast = (BreakElement) ListUtil
+ .removeLast(contentList);
context.clearPendingMarks();
break;
}
@@ -381,7 +382,7 @@
/* end of extension */
returnedList = new LinkedList();
- if (contentList.size() > 0) {
+ if (!contentList.isEmpty()) {
wrapPositionElements(contentList, returnList);
} else if (forcedBreakAfterLast == null) {
// Empty fo:block, zero-length box makes sure the IDs and/or markers
@@ -440,8 +441,7 @@
return;
}
- ListElement last = (ListElement) contentList
- .get(contentList.size() - 1);
+ ListElement last = (ListElement) ListUtil.getLast(contentList);
if (last.isGlue()) {
// the last element in contentList is a glue;
// it is a feasible breakpoint, there is no need to add
@@ -695,8 +695,8 @@
returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new Position(this), false));
} else if (bSomethingAdded
- && !((KnuthElement) returnedList.get(returnedList
- .size() - 1)).isGlue()) {
+ && !((KnuthElement) ListUtil.getLast(returnedList))
+ .isGlue()) {
// add a null penalty to allow a break between blocks
returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
@@ -715,8 +715,8 @@
// currLM == this
// there are no more elements to add
// remove the last penalty added to returnedList
- if (returnedList.size() > 0) {
- returnedList.remove(returnedList.size() - 1);
+ if (!returnedList.isEmpty()) {
+ ListUtil.removeLast(returnedList);
}
//log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da "
// + fromIndex + " a " + workList.size());
@@ -1407,7 +1407,7 @@
oldList.remove(0);
}
if (adjustedSpaceAfter > 0) {
- oldList.remove(oldList.size() - 1);
+ ListUtil.removeLast(oldList);
}
// if space-before.conditionality is "discard", correct newList
@@ -1464,7 +1464,7 @@
newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength,
wrongBox.getPosition(), false));
// add preserved elements
- if (preserveList.size() > 0) {
+ if (!preserveList.isEmpty()) {
newList.addAll(preserveList);
}
// insert the correct glue
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Tue Jun 10 02:52:27 2008
@@ -19,16 +19,20 @@
package org.apache.fop.layoutmgr;
-import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
/**
* Utilities for Knuth element lists.
*/
-public class ElementListUtils {
+public final class ElementListUtils {
+
+ private ElementListUtils() {
+ // Utility class.
+ }
/**
* Removes legal breaks in an element list. A constraint can be specified to limit the
@@ -185,7 +189,7 @@
* @return true if the list ends with a forced break
*/
public static boolean endsWithForcedBreak(List elems) {
- ListElement last = (ListElement) elems.get(elems.size() - 1);
+ ListElement last = (ListElement) ListUtil.getLast(elems);
return last.isForcedBreak();
}
@@ -196,7 +200,7 @@
* @return true if the list ends with a non-infinite penalty
*/
public static boolean endsWithNonInfinitePenalty(List elems) {
- ListElement last = (ListElement) elems.get(elems.size() - 1);
+ ListElement last = (ListElement) ListUtil.getLast(elems);
if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
return true;
} else if (last instanceof BreakElement
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -38,6 +38,7 @@
import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.TextLayoutManager;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
/**
* LayoutManager for an fo:flow object.
@@ -142,7 +143,7 @@
returnList.addAll(returnedList);
return returnList;
} else {
- if (returnList.size() > 0) {
+ if (!returnList.isEmpty()) {
// there is a block before this one
if (prevLM.mustKeepWithNext()
|| curLM.mustKeepWithPrevious()) {
@@ -150,16 +151,16 @@
returnList.add(new KnuthPenalty(0,
KnuthElement.INFINITE, false,
new Position(this), false));
- } else if (!((KnuthElement) returnList.get(returnList
- .size() - 1)).isGlue()) {
+ } else if (!((KnuthElement) ListUtil.getLast(returnList))
+ .isGlue()) {
// add a null penalty to allow a break between blocks
returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
}
-/*LF*/ if (returnedList.size() > 0) { // controllare!
+/*LF*/ if (!returnedList.isEmpty()) { // controllare!
returnList.addAll(returnedList);
- final KnuthElement last = (KnuthElement) returnedList
- .get(returnedList.size() - 1);
+ final KnuthElement last = (KnuthElement) ListUtil
+ .getLast(returnedList);
if (last.isPenalty()
&& ((KnuthPenalty) last).getP() == -KnuthElement.INFINITE) {
// a descendant of this flow has break-after
@@ -173,10 +174,10 @@
setFinished(true);
- if (returnList.size() > 0) {
- return returnList;
- } else {
+ if (returnList.isEmpty()) {
return null;
+ } else {
+ return returnList;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -56,6 +56,7 @@
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.util.ListUtil;
/**
* LayoutManager for objects which stack children in the inline direction,
@@ -312,11 +313,11 @@
// get KnuthElements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment);
- if (returnList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+ if (returnList.isEmpty() && childLC.isKeepWithPreviousPending()) {
childLC.clearKeepWithPreviousPending();
}
if (returnedList == null
- || returnedList.size() == 0) {
+ || returnedList.isEmpty()) {
// curLM returned null or an empty list, because it finished;
// just iterate once more to see if there is another child
continue;
@@ -335,7 +336,7 @@
returnedList.remove(0);
}
// add border and padding to the first complete sequence of this LM
- if (!borderAdded && returnedList.size() != 0) {
+ if (!borderAdded && !returnedList.isEmpty()) {
addKnuthElementsForBorderPaddingStart((KnuthSequence) returnedList.get(0));
borderAdded = true;
}
@@ -367,8 +368,7 @@
context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
childLC.clearKeepsPending();
}
- lastSequence = (KnuthSequence) returnList
- .get(returnList.size() - 1);
+ lastSequence = (KnuthSequence) ListUtil.getLast(returnList);
lastChildLM = curLM;
}
@@ -379,7 +379,7 @@
setFinished(true);
log.trace(trace);
- if (returnList.size() == 0) {
+ if (returnList.isEmpty()) {
/*
* if the FO itself is empty, but has an id specified
* or associated fo:markers, then we still need a dummy
@@ -396,7 +396,7 @@
}
}
- return returnList.size() == 0 ? null : returnList;
+ return returnList.isEmpty() ? null : returnList;
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -46,6 +46,7 @@
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
import org.apache.fop.util.CharUtilities;
+import org.apache.fop.util.ListUtil;
/**
* LayoutManager for text (a sequence of characters) which generates one
@@ -624,9 +625,9 @@
sequence = this.processLinebreak(returnList, sequence);
}
- if (((List) returnList.get(returnList.size() - 1)).isEmpty()) {
+ if (((List) ListUtil.getLast(returnList)).isEmpty()) {
//Remove an empty sequence because of a trailing newline
- returnList.remove(returnList.size() - 1);
+ ListUtil.removeLast(returnList);
}
this.setFinished(true);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=666048&r1=666047&r2=666048&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Tue Jun 10 02:52:27 2008
@@ -27,7 +27,6 @@
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.Trait;
-import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.table.ConditionalBorder;
import org.apache.fop.fo.flow.table.GridUnit;
import org.apache.fop.fo.flow.table.PrimaryGridUnit;
@@ -53,6 +52,7 @@
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
/**
* LayoutManager for a table-cell FO.
@@ -152,7 +152,7 @@
if (childLC.isKeepWithNextPending()) {
log.debug("child LM signals pending keep with next");
}
- if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+ if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
primaryGridUnit.setKeepWithPreviousStrength(childLC.getKeepWithPreviousPending());
childLC.clearKeepWithPreviousPending();
}
@@ -163,7 +163,7 @@
addInBetweenBreak(contentList, context, childLC);
}
contentList.addAll(returnedList);
- if (returnedList.size() == 0) {
+ if (returnedList.isEmpty()) {
//Avoid NoSuchElementException below (happens with empty blocks)
continue;
}
@@ -177,7 +177,7 @@
primaryGridUnit.setKeepWithNextStrength(context.getKeepWithNextPending());
returnedList = new LinkedList();
- if (contentList.size() > 0) {
+ if (!contentList.isEmpty()) {
wrapPositionElements(contentList, returnList);
} else {
// In relaxed validation mode, table-cells having no children are authorised.
@@ -193,8 +193,8 @@
returnList.remove(0);
assert !returnList.isEmpty();
}
- final KnuthElement lastItem = (KnuthElement) returnList
- .get(returnList.size() - 1);
+ final KnuthElement lastItem = (KnuthElement) ListUtil
+ .getLast(returnList);
if (((KnuthElement) lastItem).isForcedBreak()) {
KnuthPenalty p = (KnuthPenalty) lastItem;
primaryGridUnit.setBreakAfter(p.getBreakClass());
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org