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 je...@apache.org on 2010/08/14 19:17:13 UTC
svn commit: r985537 [5/11] - in /xmlgraphics/fop/trunk: ./
src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/hyphenation/
src/codegen/unicode/java/org/apache/fop/text/linebreak/
src/codegen/unicode...
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpaceProperty.java Sat Aug 14 17:17:00 2010
@@ -136,13 +136,14 @@ public class SpaceProperty extends Lengt
return this.conditionality.getEnum() == Constants.EN_DISCARD;
}
+ /** {@inheritDoc} */
public String toString() {
- return "Space[" +
- "min:" + getMinimum(null).getObject() +
- ", max:" + getMaximum(null).getObject() +
- ", opt:" + getOptimum(null).getObject() +
- ", precedence:" + precedence.getObject() +
- ", conditionality:" + conditionality.getObject() + "]";
+ return "Space["
+ + "min:" + getMinimum(null).getObject()
+ + ", max:" + getMaximum(null).getObject()
+ + ", opt:" + getOptimum(null).getObject()
+ + ", precedence:" + precedence.getObject()
+ + ", conditionality:" + conditionality.getObject() + "]";
}
/**
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java Sat Aug 14 17:17:00 2010
@@ -41,6 +41,11 @@ public class SpacingPropertyMaker extend
/**
* Support for the 'normal' value.
+ * @param p the property to convert
+ * @param propertyList the property list to use in conversion
+ * @param fo the FO to use in conversion
+ * @return the converted property
+ * @throws PropertyException if a property conversion exception occurs
*/
public Property convertProperty(Property p,
PropertyList propertyList,
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/StringProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/StringProperty.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/StringProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/StringProperty.java Sat Aug 14 17:17:00 2010
@@ -83,7 +83,8 @@ public final class StringProperty extend
}
/** cache containing all canonical StringProperty instances */
- private static final PropertyCache cache = new PropertyCache(StringProperty.class);
+ private static final PropertyCache cache // CSOK: ConstantName
+ = new PropertyCache(StringProperty.class);
/** canonical instance for empty strings */
public static final StringProperty EMPTY_STRING_PROPERTY = new StringProperty("");
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java Sat Aug 14 17:17:00 2010
@@ -24,7 +24,11 @@ import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
-public class TableBorderPrecedence extends NumberProperty.Maker{
+/**
+ * A table border preference property maker.
+ */
+public class TableBorderPrecedence extends NumberProperty.Maker {
+
private static Property num0 = NumberProperty.getInstance(0);
private static Property num1 = NumberProperty.getInstance(1);
private static Property num2 = NumberProperty.getInstance(2);
@@ -33,6 +37,10 @@ public class TableBorderPrecedence exten
private static Property num5 = NumberProperty.getInstance(5);
private static Property num6 = NumberProperty.getInstance(6);
+ /**
+ * Construct a table border preference property maker.
+ * @param propId the border's property id
+ */
public TableBorderPrecedence(int propId) {
super(propId);
}
@@ -59,7 +67,8 @@ public class TableBorderPrecedence exten
return num1;
case Constants.FO_TABLE_FOOTER:
return num0;
+ default:
+ return null;
}
- return null;
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java Sat Aug 14 17:17:00 2010
@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+/* $Id$ */
+
package org.apache.fop.fo.properties;
import java.util.Iterator;
@@ -72,11 +75,11 @@ public class TextDecorationProperty exte
if (prop instanceof EnumProperty) {
//skip
} else if (prop instanceof NCnameProperty) {
- Property prop_enum = checkEnumValues(((NCnameProperty)prop).getString());
- if (prop_enum == null) {
+ Property propEnum = checkEnumValues(((NCnameProperty)prop).getString());
+ if (propEnum == null) {
throw new PropertyException("Illegal enum value: " + prop.getString());
}
- l.set(i, prop_enum);
+ l.set(i, propEnum);
} else {
throw new PropertyException("Invalid content for text-decoration "
+ "property: " + prop);
@@ -113,7 +116,8 @@ public class TextDecorationProperty exte
case Constants.EN_UNDERLINE:
case Constants.EN_NO_UNDERLINE:
if (none) {
- throw new PropertyException("'none' specified, no additional values allowed");
+ throw new PropertyException
+ ("'none' specified, no additional values allowed");
}
if (under) {
throw new PropertyException("Invalid combination of values");
@@ -123,7 +127,8 @@ public class TextDecorationProperty exte
case Constants.EN_OVERLINE:
case Constants.EN_NO_OVERLINE:
if (none) {
- throw new PropertyException("'none' specified, no additional values allowed");
+ throw new PropertyException
+ ("'none' specified, no additional values allowed");
}
if (over) {
throw new PropertyException("Invalid combination of values");
@@ -133,7 +138,8 @@ public class TextDecorationProperty exte
case Constants.EN_LINE_THROUGH:
case Constants.EN_NO_LINE_THROUGH:
if (none) {
- throw new PropertyException("'none' specified, no additional values allowed");
+ throw new PropertyException
+ ("'none' specified, no additional values allowed");
}
if (through) {
throw new PropertyException("Invalid combination of values");
@@ -143,7 +149,8 @@ public class TextDecorationProperty exte
case Constants.EN_BLINK:
case Constants.EN_NO_BLINK:
if (none) {
- throw new PropertyException("'none' specified, no additional values allowed");
+ throw new PropertyException
+ ("'none' specified, no additional values allowed");
}
if (blink) {
throw new PropertyException("Invalid combination of values");
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java Sat Aug 14 17:17:00 2010
@@ -22,22 +22,33 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+/**
+ * A special property for representing an as yet implemented implemented property.
+ */
public class ToBeImplementedProperty extends Property {
+ /**
+ * A to be implemented property maker instance.
+ */
public static class Maker extends PropertyMaker {
+ /**
+ * Instantiate a to be implemented property maker instance.
+ * @param propId a property id
+ */
public Maker(int propId) {
super(propId);
}
+ /** {@inheritDoc} */
public Property convertProperty(Property p,
PropertyList propertyList, FObj fo) {
if (p instanceof ToBeImplementedProperty) {
return p;
}
- ToBeImplementedProperty val =
- new ToBeImplementedProperty(getPropId());
+ ToBeImplementedProperty val
+ = new ToBeImplementedProperty(getPropId());
return val;
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java Sat Aug 14 17:17:00 2010
@@ -18,6 +18,7 @@
/* $Id$ */
package org.apache.fop.fo.properties;
+
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
@@ -47,6 +48,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_TOP:
switch (propId) {
@@ -58,6 +61,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_TEXT_TOP:
switch (propId) {
@@ -69,6 +74,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_MIDDLE:
switch (propId) {
@@ -80,6 +87,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_BOTTOM:
switch (propId) {
@@ -91,6 +100,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_TEXT_BOTTOM:
switch (propId) {
@@ -102,6 +113,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_SUB:
switch (propId) {
@@ -113,6 +126,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_SUB, "SUB"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
case EN_SUPER:
switch (propId) {
@@ -124,6 +139,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_SUPER, "SUPER"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
default:
switch (propId) {
@@ -135,6 +152,8 @@ public class VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
}
return null;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java Sat Aug 14 17:17:00 2010
@@ -13,7 +13,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ */
+
/* $Id$ */
package org.apache.fop.fo.properties;
@@ -22,6 +23,9 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
+/**
+ * A parser for the xml:lang property.
+ */
public class XMLLangShorthandParser extends GenericShorthandParser {
private static final char HYPHEN_MINUS = '-';
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDFontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDFontType.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDFontType.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDFontType.java Sat Aug 14 17:17:00 2010
@@ -38,6 +38,9 @@ public class CIDFontType extends ValuedE
/**
+ * Construct a CID font type.
+ * @param name a type name
+ * @param value a type value
* @see org.apache.avalon.framework.Enum#Enum(String)
*/
protected CIDFontType(String name, int value) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDSubset.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDSubset.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDSubset.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/CIDSubset.java Sat Aug 14 17:17:00 2010
@@ -55,6 +55,9 @@ public class CIDSubset {
*/
private Map/*<Integer, Character>*/ usedCharsIndex = new java.util.HashMap();
+ /**
+ * Default constructor.
+ */
public CIDSubset() {
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontSetup.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontSetup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontSetup.java Sat Aug 14 17:17:00 2010
@@ -51,12 +51,16 @@ import org.apache.fop.fonts.base14.ZapfD
* Assigns the font (with metrics) to internal names like "F1" and
* assigns family-style-weight triplets to the fonts
*/
-public class FontSetup {
+public final class FontSetup {
+
+ private FontSetup() {
+ }
/**
* logging instance
*/
- protected static Log log = LogFactory.getLog(FontSetup.class);
+ private static Log log // CSOK: ConstantName
+ = LogFactory.getLog(FontSetup.class);
/**
* Sets up a font info
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontType.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontType.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontType.java Sat Aug 14 17:17:00 2010
@@ -54,6 +54,9 @@ public class FontType {
/**
+ * Construct a font type.
+ * @param name a font type name
+ * @param value a font type value
* @see org.apache.avalon.framework.Enum#Enum(String)
*/
protected FontType(String name, int value) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontUtil.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontUtil.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontUtil.java Sat Aug 14 17:17:00 2010
@@ -23,7 +23,10 @@ package org.apache.fop.fonts;
/**
* Font utilities.
*/
-public class FontUtil {
+public final class FontUtil {
+
+ private FontUtil() {
+ }
/**
* Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Glyphs.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Glyphs.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Glyphs.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/Glyphs.java Sat Aug 14 17:17:00 2010
@@ -23,7 +23,10 @@ package org.apache.fop.fonts;
* This class provides a number of constants for glyph management.
* @deprecated Use the Glyphs class from XML Graphics Commons instead!
*/
-public class Glyphs {
+public final class Glyphs {
+
+ private Glyphs() {
+ }
/**
* Glyph name for the "notdef" glyph
@@ -33,7 +36,7 @@ public class Glyphs {
/**
* Glyph names for Mac encoding
*/
- public static final String MAC_GLYPH_NAMES[] = {
+ public static final String[] MAC_GLYPH_NAMES = {
/* 0x00 */
NOTDEF, ".null", "CR", "space", "exclam", "quotedbl", "numbersign",
"dollar", "percent", "ampersand", "quotesingle", "parenleft",
@@ -1273,7 +1276,7 @@ public class Glyphs {
* @param ch glyph to evaluate
* @return the name of the glyph
*/
- public static final String charToGlyphName(char ch) {
+ public static String charToGlyphName(char ch) {
return stringToGlyph(new Character(ch).toString());
}
@@ -1286,7 +1289,7 @@ public class Glyphs {
* TODO: javadocs for glyphToString and stringToGlyph are confused
* TODO: Improve method names
*/
- public static final String glyphToString(String name) {
+ public static String glyphToString(String name) {
for (int i = 0; i < UNICODE_GLYPHS.length; i += 2) {
if (UNICODE_GLYPHS[i + 1].equals(name)) {
return UNICODE_GLYPHS[i];
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/MultiByteFont.java Sat Aug 14 17:17:00 2010
@@ -241,7 +241,7 @@ public class MultiByteFont extends CIDFo
return subset.getSubsetGlyphs();
}
- /** {@inheritDoc} */
+ /** @return an array of the chars used */
public char[] getCharsUsed() {
if (!isEmbeddable()) {
return null;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/FontFileReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/FontFileReader.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/FontFileReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/FontFileReader.java Sat Aug 14 17:17:00 2010
@@ -317,6 +317,7 @@ public class FontFileReader {
* Read an ISO-8859-1 string of len bytes.
*
* @param len The length of the string to read
+ * @param encodingID the string encoding id (presently ignored; always uses UTF-16BE)
* @return A String
* @throws IOException If EOF is reached
*/
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFCmapEntry.java Sat Aug 14 17:17:00 2010
@@ -44,6 +44,17 @@ public class TTFCmapEntry {
/**
* {@inheritDoc}
*/
+ public int hashCode() {
+ int hc = super.hashCode();
+ hc ^= ( hc * 11 ) + unicodeStart;
+ hc ^= ( hc * 19 ) + unicodeEnd;
+ hc ^= ( hc * 23 ) + glyphStartIndex;
+ return hc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean equals(Object o) {
if (o instanceof TTFCmapEntry) {
TTFCmapEntry ce = (TTFCmapEntry)o;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/truetype/TTFFile.java Sat Aug 14 17:17:00 2010
@@ -245,7 +245,8 @@ public class TTFFile {
}
}
- private boolean readUnicodeCmap(FontFileReader in, long cmapUniOffset, int encodingID)
+ private boolean readUnicodeCmap // CSOK: MethodLength
+ (FontFileReader in, long cmapUniOffset, int encodingID)
throws IOException {
//Read CMAP table and correct mtxTab.index
int mtxPtr = 0;
@@ -961,7 +962,7 @@ public class TTFFile {
* Read the "post" table
* containing the PostScript names of the glyphs.
*/
- private final void readPostScript(FontFileReader in) throws IOException {
+ private void readPostScript(FontFileReader in) throws IOException {
seekTab(in, "post", 0);
postFormat = in.readTTFLong();
italicAngle = in.readTTFULong();
@@ -1133,7 +1134,7 @@ public class TTFFile {
* @param in FontFileReader to read from
* @throws IOException In case of a I/O problem
*/
- private final void readGlyf(FontFileReader in) throws IOException {
+ private void readGlyf(FontFileReader in) throws IOException {
TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("glyf");
if (dirTab == null) {
throw new IOException("glyf table not found, cannot continue");
@@ -1188,7 +1189,7 @@ public class TTFFile {
* @param in FontFileReader to read from
* @throws IOException In case of a I/O problem
*/
- private final void readName(FontFileReader in) throws IOException {
+ private void readName(FontFileReader in) throws IOException {
seekTab(in, "name", 2);
int i = in.getCurrentPos();
int n = in.readTTFUShort();
@@ -1259,7 +1260,7 @@ public class TTFFile {
* @param in FontFileReader to read from
* @throws IOException In case of a I/O problem
*/
- private final boolean readPCLT(FontFileReader in) throws IOException {
+ private boolean readPCLT(FontFileReader in) throws IOException {
TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("PCLT");
if (dirTab != null) {
in.seekSet(dirTab.getOffset() + 4 + 4 + 2);
@@ -1403,7 +1404,7 @@ public class TTFFile {
* @param in FontFileReader to read from
* @throws IOException In case of a I/O problem
*/
- private final void readKerning(FontFileReader in) throws IOException {
+ private void readKerning(FontFileReader in) throws IOException {
// Read kerning
kerningTab = new java.util.HashMap();
ansiKerningTab = new java.util.HashMap();
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFBParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFBParser.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFBParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/PFBParser.java Sat Aug 14 17:17:00 2010
@@ -161,7 +161,7 @@ public class PFBParser {
}
- private static final boolean byteCmp(byte[] src, int srcOffset, byte[] cmp) {
+ private static boolean byteCmp(byte[] src, int srcOffset, byte[] cmp) {
for (int i = 0; i < cmp.length; i++) {
// System.out.println("Compare: " + src[srcOffset + i] + " " + cmp[i]);
if (src[srcOffset + i] != cmp[i]) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/ByteVector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/ByteVector.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/ByteVector.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/ByteVector.java Sat Aug 14 17:17:00 2010
@@ -45,10 +45,17 @@ public class ByteVector implements Seria
*/
private int n;
+ /**
+ * Construct byte vector instance with default block size.
+ */
public ByteVector() {
this(DEFAULT_BLOCK_SIZE);
}
+ /**
+ * Construct byte vector instance.
+ * @param capacity initial block size
+ */
public ByteVector(int capacity) {
if (capacity > 0) {
blockSize = capacity;
@@ -59,12 +66,25 @@ public class ByteVector implements Seria
n = 0;
}
+ /**
+ * Construct byte vector instance.
+ * @param a byte array to use
+ * @asf.todo should n should be initialized to a.length to be consistent with
+ * CharVector behavior? [GA]
+ */
public ByteVector(byte[] a) {
blockSize = DEFAULT_BLOCK_SIZE;
array = a;
n = 0;
}
+ /**
+ * Construct byte vector instance.
+ * @param a byte array to use
+ * @param capacity initial block size
+ * @asf.todo should n should be initialized to a.length to be consistent with
+ * CharVector behavior? [GA]
+ */
public ByteVector(byte[] a, int capacity) {
if (capacity > 0) {
blockSize = capacity;
@@ -75,34 +95,52 @@ public class ByteVector implements Seria
n = 0;
}
+ /**
+ * Obtain byte vector array.
+ * @return byte array
+ */
public byte[] getArray() {
return array;
}
/**
- * return number of items in array
+ * Obtain number of items in array.
+ * @return number of items
*/
public int length() {
return n;
}
/**
- * returns current capacity of array
+ * Obtain capacity of array.
+ * @return current capacity of array
*/
public int capacity() {
return array.length;
}
+ /**
+ * Pet byte at index.
+ * @param index the index
+ * @param val a byte
+ */
public void put(int index, byte val) {
array[index] = val;
}
+ /**
+ * Get byte at index.
+ * @param index the index
+ * @return a byte
+ */
public byte get(int index) {
return array[index];
}
/**
* This is to implement memory allocation in the array. Like malloc().
+ * @param size to allocate
+ * @return previous length
*/
public int alloc(int size) {
int index = n;
@@ -116,6 +154,9 @@ public class ByteVector implements Seria
return index;
}
+ /**
+ * Trim byte vector to current length.
+ */
public void trimToSize() {
if (n < array.length) {
byte[] aux = new byte[n];
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/CharVector.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/CharVector.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/CharVector.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/CharVector.java Sat Aug 14 17:17:00 2010
@@ -45,10 +45,17 @@ public class CharVector implements Clone
*/
private int n;
+ /**
+ * Construct char vector instance with default block size.
+ */
public CharVector() {
this(DEFAULT_BLOCK_SIZE);
}
+ /**
+ * Construct char vector instance.
+ * @param capacity initial block size
+ */
public CharVector(int capacity) {
if (capacity > 0) {
blockSize = capacity;
@@ -59,12 +66,21 @@ public class CharVector implements Clone
n = 0;
}
+ /**
+ * Construct char vector instance.
+ * @param a char array to use
+ */
public CharVector(char[] a) {
blockSize = DEFAULT_BLOCK_SIZE;
array = a;
n = a.length;
}
+ /**
+ * Construct char vector instance.
+ * @param a char array to use
+ * @param capacity initial block size
+ */
public CharVector(char[] a, int capacity) {
if (capacity > 0) {
blockSize = capacity;
@@ -76,44 +92,66 @@ public class CharVector implements Clone
}
/**
- * Reset Vector but don't resize or clear elements
+ * Reset length of vector, but don't clear contents.
*/
public void clear() {
n = 0;
}
+ /** {@inheritDoc} */
public Object clone() {
CharVector cv = new CharVector((char[])array.clone(), blockSize);
cv.n = this.n;
return cv;
}
+ /**
+ * Obtain char vector array.
+ * @return char array
+ */
public char[] getArray() {
return array;
}
/**
- * return number of items in array
+ * Obtain number of items in array.
+ * @return number of items
*/
public int length() {
return n;
}
/**
- * returns current capacity of array
+ * Obtain capacity of array.
+ * @return current capacity of array
*/
public int capacity() {
return array.length;
}
+ /**
+ * Pet char at index.
+ * @param index the index
+ * @param val a char
+ */
public void put(int index, char val) {
array[index] = val;
}
+ /**
+ * Get char at index.
+ * @param index the index
+ * @return a char
+ */
public char get(int index) {
return array[index];
}
+ /**
+ * This is to implement memory allocation in the array. Like malloc().
+ * @param size to allocate
+ * @return previous length
+ */
public int alloc(int size) {
int index = n;
int len = array.length;
@@ -126,6 +164,9 @@ public class CharVector implements Clone
return index;
}
+ /**
+ * Trim char vector to current length.
+ */
public void trimToSize() {
if (n < array.length) {
char[] aux = new char[n];
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphen.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphen.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphen.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphen.java Sat Aug 14 17:17:00 2010
@@ -34,23 +34,43 @@ import java.io.Serializable;
* @author Carlos Villegas <ca...@uniscope.co.jp>
*/
+/**
+ * Represents a hyphen.
+ */
public class Hyphen implements Serializable {
- public String preBreak;
- public String noBreak;
- public String postBreak;
+ /** pre break string */
+ public String preBreak; // CSOK: VisibilityModifier
+
+ /** no break string */
+ public String noBreak; // CSOK: VisibilityModifier
+
+ /** post break string */
+ public String postBreak; // CSOK: VisibilityModifier
+
+ /**
+ * Construct a hyphen.
+ * @param pre break string
+ * @param no break string
+ * @param post break string
+ */
Hyphen(String pre, String no, String post) {
preBreak = pre;
noBreak = no;
postBreak = post;
}
+ /**
+ * Construct a hyphen.
+ * @param pre break string
+ */
Hyphen(String pre) {
preBreak = pre;
noBreak = null;
postBreak = null;
}
+ /** {@inheritDoc} */
public String toString() {
if (noBreak == null
&& postBreak == null
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenation.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenation.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenation.java Sat Aug 14 17:17:00 2010
@@ -52,6 +52,7 @@ public class Hyphenation {
}
/**
+ * @param index an index position
* @return the pre-break text, not including the hyphen character
*/
public String getPreHyphenText(int index) {
@@ -59,6 +60,7 @@ public class Hyphenation {
}
/**
+ * @param index an index position
* @return the post-break text
*/
public String getPostHyphenText(int index) {
@@ -72,6 +74,7 @@ public class Hyphenation {
return hyphenPoints;
}
+ /** {@inheritDoc} */
public String toString() {
StringBuffer str = new StringBuffer();
int start = 0;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationException.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationException.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationException.java Sat Aug 14 17:17:00 2010
@@ -20,12 +20,15 @@
package org.apache.fop.hyphenation;
/**
+ * An hyphenation exception.
* @author Carlos Villegas <ca...@uniscope.co.jp>
- * (todo) Derive from FOPException
+ * @asf.todo Derive from FOPException
*/
public class HyphenationException extends Exception {
/**
+ * Construct a hyphenation exception.
+ * @param msg a message string
* @see java.lang.Throwable#Throwable(String)
*/
public HyphenationException(String msg) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java Sat Aug 14 17:17:00 2010
@@ -66,6 +66,7 @@ public class HyphenationTree extends Ter
*/
private transient TernaryTree ivalues;
+ /** Default constructor. */
public HyphenationTree() {
stoplist = new HashMap(23); // usually a small table
classmap = new TernaryTree();
@@ -100,6 +101,11 @@ public class HyphenationTree extends Ter
return offset;
}
+ /**
+ * Unpack values.
+ * @param k an integer
+ * @return a string
+ */
protected String unpackValues(int k) {
StringBuffer buf = new StringBuffer();
byte v = vspace.get(k++);
@@ -154,6 +160,11 @@ public class HyphenationTree extends Ter
ivalues = null;
}
+ /**
+ * Find pattern.
+ * @param pat a pattern
+ * @return a string
+ */
public String findPattern(String pat) {
int k = super.find(pat);
if (k >= 0) {
@@ -164,7 +175,12 @@ public class HyphenationTree extends Ter
/**
* String compare, returns 0 if equal or
- * t is a substring of s
+ * t is a substring of s.
+ * @param s first character array
+ * @param si starting index into first array
+ * @param t second character array
+ * @param ti starting index into second array
+ * @return an integer
*/
protected int hstrcmp(char[] s, int si, char[] t, int ti) {
for (; s[si] == t[ti]; si++, ti++) {
@@ -178,6 +194,11 @@ public class HyphenationTree extends Ter
return s[si] - t[ti];
}
+ /**
+ * Get values.
+ * @param k an integer
+ * @return a byte array
+ */
protected byte[] getValues(int k) {
StringBuffer buf = new StringBuffer();
byte v = vspace.get(k++);
@@ -352,12 +373,12 @@ public class HyphenationTree extends Ter
if (nc < 0) { // found a non-letter character ...
if (i == (1 + iIgnoreAtBeginning)) {
// ... before any letter character
- iIgnoreAtBeginning ++;
+ iIgnoreAtBeginning++;
} else {
// ... after a letter character
bEndOfLetters = true;
}
- iLength --;
+ iLength--;
} else {
if (!bEndOfLetters) {
word[i - iIgnoreAtBeginning] = (char)nc;
@@ -435,6 +456,7 @@ public class HyphenationTree extends Ter
* files use only lower case characters, in this case a class
* for letter 'a', for example, should be defined as "aA", the first
* character being the normalization char.
+ * @param chargroup a character class (group)
*/
public void addClass(String chargroup) {
if (chargroup.length() > 0) {
@@ -479,6 +501,9 @@ public class HyphenationTree extends Ter
insert(pattern, (char)k);
}
+ /**
+ * Print statistics.
+ */
public void printStats() {
System.out.println("Value space size = "
+ Integer.toString(vspace.length()));
@@ -486,11 +511,16 @@ public class HyphenationTree extends Ter
}
+ /**
+ * Main entry point for this hyphenation utility application.
+ * @param argv array of command linee arguments
+ * @throws Exception in case an exception is raised but not caught
+ */
public static void main(String[] argv) throws Exception {
HyphenationTree ht = null;
int minCharCount = 2;
- BufferedReader in =
- new BufferedReader(new java.io.InputStreamReader(System.in));
+ BufferedReader in
+ = new BufferedReader(new java.io.InputStreamReader(System.in));
while (true) {
System.out.print("l:\tload patterns from XML\n"
+ "L:\tload patterns from serialized object\n"
@@ -572,8 +602,8 @@ public class HyphenationTree extends Ter
long starttime = 0;
int counter = 0;
try {
- BufferedReader reader =
- new BufferedReader(new FileReader(token));
+ BufferedReader reader
+ = new BufferedReader(new FileReader(token));
String line;
starttime = System.currentTimeMillis();
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/Hyphenator.java Sat Aug 14 17:17:00 2010
@@ -259,7 +259,8 @@ public class Hyphenator {
if (source.getSystemId() != null) {
in = new java.net.URL(source.getSystemId()).openStream();
} else {
- throw new UnsupportedOperationException("Cannot load hyphenation pattern file"
+ throw new UnsupportedOperationException
+ ("Cannot load hyphenation pattern file"
+ " with the supplied Source object: " + source);
}
}
@@ -377,7 +378,8 @@ public class Hyphenator {
* @param rightMin the minimum number of characters after the hyphenation point
* @return the hyphenation result
*/
- public static Hyphenation hyphenate(String lang, String country,
+ public static Hyphenation hyphenate(String lang, // CSOK: ParameterNumber
+ String country,
HyphenationTreeResolver resolver,
char[] word, int offset, int len,
int leftMin, int rightMin) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternConsumer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternConsumer.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternConsumer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternConsumer.java Sat Aug 14 17:17:00 2010
@@ -44,6 +44,8 @@ public interface PatternConsumer {
* fails or the user wants to provide his own hyphenation.
* A hyphenatedword is a vector of alternating String's and
* {@link Hyphen Hyphen} instances
+ * @param word word to add as an exception
+ * @param hyphenatedword pre-hyphenated word
*/
void addException(String word, ArrayList hyphenatedword);
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java Sat Aug 14 17:17:00 2010
@@ -61,6 +61,10 @@ public class PatternParser extends Defau
static final int ELEM_PATTERNS = 3;
static final int ELEM_HYPHEN = 4;
+ /**
+ * Construct a pattern parser.
+ * @throws HyphenationException if a hyphenation exception is raised
+ */
public PatternParser() throws HyphenationException {
this.consumer = this;
token = new StringBuffer();
@@ -70,6 +74,11 @@ public class PatternParser extends Defau
hyphenChar = '-'; // default
}
+ /**
+ * Construct a pattern parser.
+ * @param consumer a pattern consumer
+ * @throws HyphenationException if a hyphenation exception is raised
+ */
public PatternParser(PatternConsumer consumer) throws HyphenationException {
this();
this.consumer = consumer;
@@ -130,7 +139,7 @@ public class PatternParser extends Defau
}
}
- protected String readToken(StringBuffer chars) {
+ private String readToken(StringBuffer chars) {
String word;
boolean space = false;
int i;
@@ -175,7 +184,7 @@ public class PatternParser extends Defau
return null;
}
- protected static String getPattern(String word) {
+ private static String getPattern(String word) {
StringBuffer pat = new StringBuffer();
int len = word.length();
for (int i = 0; i < len; i++) {
@@ -186,7 +195,7 @@ public class PatternParser extends Defau
return pat.toString();
}
- protected ArrayList normalizeException(ArrayList ex) {
+ private ArrayList normalizeException(ArrayList ex) {
ArrayList res = new ArrayList();
for (int i = 0; i < ex.size(); i++) {
Object item = ex.get(i);
@@ -217,7 +226,7 @@ public class PatternParser extends Defau
return res;
}
- protected String getExceptionWord(ArrayList ex) {
+ private String getExceptionWord(ArrayList ex) {
StringBuffer res = new StringBuffer();
for (int i = 0; i < ex.size(); i++) {
Object item = ex.get(i);
@@ -232,7 +241,7 @@ public class PatternParser extends Defau
return res.toString();
}
- protected static String getInterletterValues(String pat) {
+ private static String getInterletterValues(String pat) {
StringBuffer il = new StringBuffer();
String word = pat + "a"; // add dummy letter to serve as sentinel
int len = word.length();
@@ -248,6 +257,7 @@ public class PatternParser extends Defau
return il.toString();
}
+ /** @throws SAXException if not caught */
protected void getExternalClasses() throws SAXException {
XMLReader mainParser = parser;
parser = createParser();
@@ -328,6 +338,8 @@ public class PatternParser extends Defau
case ELEM_HYPHEN:
// nothing to do
break;
+ default:
+ break;
}
if (currElement != ELEM_HYPHEN) {
token.setLength(0);
@@ -347,7 +359,7 @@ public class PatternParser extends Defau
/**
* {@inheritDoc}
*/
- public void characters(char ch[], int start, int length) {
+ public void characters(char[] ch, int start, int length) {
StringBuffer chars = new StringBuffer(length);
chars.append(ch, start, length);
String word = readToken(chars);
@@ -368,6 +380,8 @@ public class PatternParser extends Defau
consumer.addPattern(getPattern(word),
getInterletterValues(word));
break;
+ default:
+ break;
}
word = readToken(chars);
}
@@ -426,15 +440,26 @@ public class PatternParser extends Defau
} // getLocationString(SAXParseException):String
- // PatternConsumer implementation for testing purposes
+ /**
+ * For testing purposes only.
+ * {@inheritDoc}
+ */
public void addClass(String c) {
testOut.println("class: " + c);
}
+ /**
+ * For testing purposes only.
+ * {@inheritDoc}
+ */
public void addException(String w, ArrayList e) {
testOut.println("exception: " + w + " : " + e.toString());
}
+ /**
+ * For testing purposes only.
+ * {@inheritDoc}
+ */
public void addPattern(String p, String v) {
testOut.println("pattern: " + p + " : " + v);
}
@@ -442,17 +467,26 @@ public class PatternParser extends Defau
private PrintStream testOut = System.out;
/**
+ * Set test out stream.
* @param testOut the testOut to set
*/
public void setTestOut(PrintStream testOut) {
this.testOut = testOut;
}
+ /**
+ * Close test out file.
+ */
public void closeTestOut() {
testOut.flush();
testOut.close();
}
+ /**
+ * Main entry point when used as an application.
+ * @param args array of command line arguments
+ * @throws Exception in case of uncaught exception
+ */
public static void main(String[] args) throws Exception {
if (args.length > 0) {
PatternParser pp = new PatternParser();
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/TernaryTree.java Sat Aug 14 17:17:00 2010
@@ -107,16 +107,22 @@ public class TernaryTree implements Clon
*/
protected CharVector kv;
+ /** root */
protected char root;
+ /** free node */
protected char freenode;
- protected int length; // number of items in tree
+ /** number of items in tree */
+ protected int length;
- protected static final int BLOCK_SIZE = 2048; // allocation size for arrays
+ /** allocation size for arrays */
+ protected static final int BLOCK_SIZE = 2048;
+ /** default constructor */
TernaryTree() {
init();
}
+ /** initialize */
protected void init() {
root = 0;
freenode = 1;
@@ -135,6 +141,8 @@ public class TernaryTree implements Clon
* another key with same prefix
* is inserted. This saves a lot of space,
* specially for long keys.
+ * @param key the key
+ * @param val a value
*/
public void insert(String key, char val) {
// make sure we have enough room in the arrays
@@ -143,12 +151,18 @@ public class TernaryTree implements Clon
if (freenode + len > eq.length) {
redimNodeArrays(eq.length + BLOCK_SIZE);
}
- char strkey[] = new char[len--];
+ char[] strkey = new char[len--];
key.getChars(0, len, strkey, 0);
strkey[len] = 0;
root = insert(root, strkey, 0, val);
}
+ /**
+ * Insert key.
+ * @param key the key
+ * @param start offset into key array
+ * @param val a value
+ */
public void insert(char[] key, int start, char val) {
int len = strlen(key) + 1;
if (freenode + len > eq.length) {
@@ -232,6 +246,11 @@ public class TernaryTree implements Clon
/**
* Compares 2 null terminated char arrays
+ * @param a a character array
+ * @param startA an index into character array
+ * @param b a character array
+ * @param startB an index into character array
+ * @return an integer
*/
public static int strcmp(char[] a, int startA, char[] b, int startB) {
for (; a[startA] == b[startB]; startA++, startB++) {
@@ -244,6 +263,10 @@ public class TernaryTree implements Clon
/**
* Compares a string with null terminated char array
+ * @param str a string
+ * @param a a character array
+ * @param start an index into character array
+ * @return an integer
*/
public static int strcmp(String str, char[] a, int start) {
int i, d, len = str.length();
@@ -263,6 +286,12 @@ public class TernaryTree implements Clon
}
+ /**
+ * @param dst a character array
+ * @param di an index into character array
+ * @param src a character array
+ * @param si an index into character array
+ */
public static void strcpy(char[] dst, int di, char[] src, int si) {
while (src[si] != 0) {
dst[di++] = src[si++];
@@ -270,6 +299,11 @@ public class TernaryTree implements Clon
dst[di] = 0;
}
+ /**
+ * @param a a character array
+ * @param start an index into character array
+ * @return an integer
+ */
public static int strlen(char[] a, int start) {
int len = 0;
for (int i = start; i < a.length && a[i] != 0; i++) {
@@ -278,19 +312,34 @@ public class TernaryTree implements Clon
return len;
}
+ /**
+ * @param a a character array
+ * @return an integer
+ */
public static int strlen(char[] a) {
return strlen(a, 0);
}
+ /**
+ * Find key.
+ * @param key the key
+ * @return result
+ */
public int find(String key) {
int len = key.length();
- char strkey[] = new char[len + 1];
+ char[] strkey = new char[len + 1];
key.getChars(0, len, strkey, 0);
strkey[len] = 0;
return find(strkey, 0);
}
+ /**
+ * Find key.
+ * @param key the key
+ * @param start offset into key array
+ * @return result
+ */
public int find(char[] key, int start) {
int d;
char p = root;
@@ -322,6 +371,10 @@ public class TernaryTree implements Clon
return -1;
}
+ /**
+ * @param key a key
+ * @return trye if key present
+ */
public boolean knows(String key) {
return (find(key) >= 0);
}
@@ -343,10 +396,12 @@ public class TernaryTree implements Clon
sc = na;
}
+ /** @return length */
public int size() {
return length;
}
+ /** {@inheritDoc} */
public Object clone() {
TernaryTree t = new TernaryTree();
t.lo = (char[])this.lo.clone();
@@ -366,6 +421,10 @@ public class TernaryTree implements Clon
* lower and upper halves, and so on in order to get a balanced
* tree. The array of keys is assumed to be sorted in ascending
* order.
+ * @param k array of keys
+ * @param v array of values
+ * @param offset where to insert
+ * @param n count to insert
*/
protected void insertBalanced(String[] k, char[] v, int offset, int n) {
int m;
@@ -453,37 +512,47 @@ public class TernaryTree implements Clon
}
}
-
+ /** @return the keys */
public Enumeration keys() {
return new Iterator();
}
+ /** an iterator */
public class Iterator implements Enumeration {
/**
* current node index
*/
- int cur;
+ int cur; // CSOK: VisibilityModifier
/**
* current key
*/
- String curkey;
+ String curkey; // CSOK: VisibilityModifier
private class Item implements Cloneable {
- char parent;
- char child;
+ /** parent */
+ char parent; // CSOK: VisibilityModifier
+ /** child */
+ char child; // CSOK: VisibilityModifier
+ /** default constructor */
public Item() {
parent = 0;
child = 0;
}
+ /**
+ * Construct item.
+ * @param p a char
+ * @param c a char
+ */
public Item(char p, char c) {
parent = p;
child = c;
}
+ /** {@inheritDoc} */
public Object clone() {
return new Item(parent, child);
}
@@ -493,13 +562,14 @@ public class TernaryTree implements Clon
/**
* Node stack
*/
- Stack ns;
+ Stack ns; // CSOK: VisibilityModifier
/**
* key stack implemented with a StringBuffer
*/
- StringBuffer ks;
+ StringBuffer ks; // CSOK: VisibilityModifier
+ /** default constructor */
public Iterator() {
cur = -1;
ns = new Stack();
@@ -507,6 +577,7 @@ public class TernaryTree implements Clon
rewind();
}
+ /** rewind iterator */
public void rewind() {
ns.removeAllElements();
ks.setLength(0);
@@ -514,6 +585,7 @@ public class TernaryTree implements Clon
run();
}
+ /** @return next element */
public Object nextElement() {
String res = new String(curkey);
cur = up();
@@ -521,6 +593,7 @@ public class TernaryTree implements Clon
return res;
}
+ /** @return value */
public char getValue() {
if (cur >= 0) {
return eq[cur];
@@ -528,6 +601,7 @@ public class TernaryTree implements Clon
return 0;
}
+ /** @return true if more elements */
public boolean hasMoreElements() {
return (cur != -1);
}
@@ -633,6 +707,9 @@ public class TernaryTree implements Clon
}
+ /**
+ * Print stats (for testing).
+ */
public void printStats() {
System.out.println("Number of keys = " + Integer.toString(length));
System.out.println("Node count = " + Integer.toString(freenode));
@@ -653,6 +730,11 @@ public class TernaryTree implements Clon
}
+ /**
+ * Main entry point for testing.
+ * @param args not used
+ * @throws Exception if not caught
+ */
public static void main(String[] args) throws Exception {
TernaryTree tt = new TernaryTree();
tt.insert("Carlos", 'C');
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/BatikUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/BatikUtil.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/BatikUtil.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/BatikUtil.java Sat Aug 14 17:17:00 2010
@@ -27,7 +27,10 @@ import org.apache.batik.dom.util.DOMUtil
/**
* Helper utilities for Apache Batik.
*/
-public class BatikUtil {
+public final class BatikUtil {
+
+ private BatikUtil() {
+ }
/**
* Checks whether Apache Batik is available in the classpath.
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java Sat Aug 14 17:17:00 2010
@@ -102,7 +102,11 @@ public class PreloaderSVG extends Abstra
* attempt to load Batik related classes when constructing the SVGPreloader
* class.
*/
- class Loader {
+ private final class Loader {
+
+ private Loader() {
+ }
+
private ImageInfo getImage(String uri, Source src,
ImageContext context) {
// parse document and get the size attributes of the svg element
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java Sat Aug 14 17:17:00 2010
@@ -78,7 +78,11 @@ public class PreloaderWMF extends Abstra
* attempt to load Batik related classes when constructing the WMFPreloader
* class.
*/
- class Loader {
+ private final class Loader {
+
+ private Loader() {
+ }
+
private ImageInfo getImage(String uri, Source src,
ImageContext context) {
// parse document and get the size attributes of the svg element
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Sat Aug 14 17:17:00 2010
@@ -42,15 +42,19 @@ public abstract class AbstractBreaker {
/** logging instance */
protected static Log log = LogFactory.getLog(AbstractBreaker.class);
+ /**
+ * A page break position.
+ */
public static class PageBreakPosition extends LeafPosition {
- double bpdAdjust; // Percentage to adjust (stretch or shrink)
- int difference;
- int footnoteFirstListIndex;
- int footnoteFirstElementIndex;
- int footnoteLastListIndex;
- int footnoteLastElementIndex;
+ // Percentage to adjust (stretch or shrink)
+ double bpdAdjust; // CSOK: VisibilityModifier
+ int difference; // CSOK: VisibilityModifier
+ int footnoteFirstListIndex; // CSOK: VisibilityModifier
+ int footnoteFirstElementIndex; // CSOK: VisibilityModifier
+ int footnoteLastListIndex; // CSOK: VisibilityModifier
+ int footnoteLastElementIndex; // CSOK: VisibilityModifier
- PageBreakPosition(LayoutManager lm, int breakIndex,
+ PageBreakPosition(LayoutManager lm, int breakIndex, // CSOK: ParameterNumber
int ffli, int ffei, int flli, int flei,
double bpdA, int diff) {
super(lm, breakIndex);
@@ -90,9 +94,9 @@ public abstract class AbstractBreaker {
public class BlockSequence extends BlockKnuthSequence {
/** Number of elements to ignore at the beginning of the list. */
- public int ignoreAtStart = 0;
+ int ignoreAtStart = 0; // CSOK: VisibilityModifier
/** Number of elements to ignore at the end of the list. */
- public int ignoreAtEnd = 0;
+ int ignoreAtEnd = 0; // CSOK: VisibilityModifier
/**
* startOn represents where on the page/which page layout
@@ -198,15 +202,34 @@ public abstract class AbstractBreaker {
private List blockLists = null;
+ /** desired text alignment */
protected int alignment;
+
private int alignmentLast;
+ /** footnote separator length */
protected MinOptMax footnoteSeparatorLength = MinOptMax.ZERO;
+ /** @return current display alignment */
protected abstract int getCurrentDisplayAlign();
+
+ /** @return true if content not exhausted */
protected abstract boolean hasMoreContent();
+
+ /**
+ * Tell the layout manager to add all the child areas implied
+ * by Position objects which will be returned by the
+ * Iterator.
+ *
+ * @param posIter the position iterator
+ * @param context the context
+ */
protected abstract void addAreas(PositionIterator posIter, LayoutContext context);
+
+ /** @return top level layout manager */
protected abstract LayoutManager getTopLevelLM();
+
+ /** @return current child layout manager */
protected abstract LayoutManager getCurrentChildLM();
/**
@@ -244,13 +267,27 @@ public abstract class AbstractBreaker {
return null;
}
- /*
- * This method is to contain the logic to determine the LM's
- * getNextKnuthElements() implementation(s) that are to be called.
- * @return LinkedList of Knuth elements.
+ /**
+ * Get a sequence of KnuthElements representing the content
+ * of the node assigned to the LM
+ *
+ * @param context the LayoutContext used to store layout information
+ * @param alignment the desired text alignment
+ * @return the list of KnuthElements
*/
protected abstract List getNextKnuthElements(LayoutContext context, int alignment);
+ /**
+ * Get a sequence of KnuthElements representing the content
+ * of the node assigned to the LM
+ *
+ * @param context the LayoutContext used to store layout information
+ * @param alignment the desired text alignment
+ * @param positionAtIPDChange last element on the part before an IPD change
+ * @param restartAtLM the layout manager from which to restart, if IPD
+ * change occurs between two LMs
+ * @return the list of KnuthElements
+ */
protected List getNextKnuthElements(LayoutContext context, int alignment,
Position positionAtIPDChange, LayoutManager restartAtLM) {
throw new UnsupportedOperationException("TODO: implement acceptable fallback");
@@ -261,6 +298,11 @@ public abstract class AbstractBreaker {
return (this.blockLists.isEmpty());
}
+ /**
+ * Start part.
+ * @param list a block sequence
+ * @param breakClass a break class
+ */
protected void startPart(BlockSequence list, int breakClass) {
//nop
}
@@ -272,6 +314,11 @@ public abstract class AbstractBreaker {
//nop
}
+ /**
+ * Finish part.
+ * @param alg a page breaking algorithm
+ * @param pbp a page break posittion
+ */
protected abstract void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp);
/**
@@ -809,8 +856,8 @@ public abstract class AbstractBreaker {
* @param availableBPD the available BPD
* @return the effective list
*/
- private BlockSequence justifyBoxes(BlockSequence blockList, PageBreakingAlgorithm alg,
- int availableBPD) {
+ private BlockSequence justifyBoxes // CSOK: MethodLength
+ (BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD) {
int iOptPageNumber;
alg.setConstantLineWidth(availableBPD);
iOptPageNumber = alg.findBreakingPoints(blockList, /*availableBPD,*/
@@ -843,15 +890,18 @@ public abstract class AbstractBreaker {
// inside the
// while loop must be a box
KnuthElement firstElement;
- while (!(firstElement = (KnuthElement) sequenceIterator
- .next()).isBox()) {
- //
- log.debug("PLM> ignoring glue or penalty element "
- + "at the beginning of the sequence");
- if (firstElement.isGlue()) {
- ((BlockLevelLayoutManager) firstElement
- .getLayoutManager())
+ while ( sequenceIterator.hasNext() ) {
+ firstElement = (KnuthElement) sequenceIterator.next();
+ if ( !firstElement.isBox() ) {
+ log.debug("PLM> ignoring glue or penalty element "
+ + "at the beginning of the sequence");
+ if (firstElement.isGlue()) {
+ ((BlockLevelLayoutManager) firstElement
+ .getLayoutManager())
.discardSpace((KnuthGlue) firstElement);
+ }
+ } else {
+ break;
}
}
firstElementIndex = sequenceIterator.previousIndex();
@@ -904,8 +954,10 @@ public abstract class AbstractBreaker {
// blockSpaceList
KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
.removeFirst();
- spaceMaxAdjustment = spaceMaxAdjustment.plusMax(blockSpace.getStretch());
- spaceMaxAdjustment = spaceMaxAdjustment.minusMin(blockSpace.getShrink());
+ spaceMaxAdjustment
+ = spaceMaxAdjustment.plusMax(blockSpace.getStretch());
+ spaceMaxAdjustment
+ = spaceMaxAdjustment.minusMin(blockSpace.getShrink());
blockSpacesList.add(blockSpace);
}
}
@@ -995,7 +1047,9 @@ public abstract class AbstractBreaker {
+ (((int)((float) partial * difference / total)) - adjustedDiff)
+ " / " + difference);
}
- int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
+ int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager())
+ .negotiateBPDAdjustment
+ (((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
adjustedDiff += newAdjust;
}
return adjustedDiff;
@@ -1003,7 +1057,13 @@ public abstract class AbstractBreaker {
private int adjustLineNumbers(LinkedList lineList, int difference, int total) {
if (log.isDebugEnabled()) {
- log.debug("AdjustLineNumbers: difference " + difference + " / " + total + " on " + lineList.size() + " elements");
+ log.debug("AdjustLineNumbers: difference "
+ + difference
+ + " / "
+ + total
+ + " on "
+ + lineList.size()
+ + " elements");
}
ListIterator lineListIterator = lineList.listIterator();
@@ -1012,7 +1072,9 @@ public abstract class AbstractBreaker {
while (lineListIterator.hasNext()) {
KnuthGlue line = (KnuthGlue)lineListIterator.next();
partial += (difference > 0 ? line.getStretch() : line.getShrink());
- int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
+ int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager())
+ .negotiateBPDAdjustment
+ (((int) ((float) partial * difference / total)) - adjustedDiff, line);
adjustedDiff += newAdjust;
}
return adjustedDiff;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -123,6 +123,10 @@ public abstract class AbstractLayoutMana
return null;
}
+ /**
+ * Set currently active child layout manager.
+ * @param childLM the child layout manager
+ */
protected void setCurrentChildLM(LayoutManager childLM) {
curChildLM = childLM;
childLMiter = new LMiter(this);
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -275,8 +275,8 @@ public abstract class AbstractPageSequen
/**
* Makes a new page
*
- * @param bIsBlank whether this page is blank or not
- * @param bIsLast whether this page is the last page or not
+ * @param isBlank whether this page is blank or not
+ * @param isLast whether this page is the last page or not
* @return a new page
*/
protected Page makeNewPage(boolean isBlank, boolean isLast) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Sat Aug 14 17:17:00 2010
@@ -27,7 +27,10 @@ import org.apache.fop.layoutmgr.SpaceRes
/**
* Utility class which provides common code for the addAreas stage.
*/
-public class AreaAdditionUtil {
+public final class AreaAdditionUtil {
+
+ private AreaAdditionUtil() {
+ }
private static class StackingIter extends PositionIterator {
StackingIter(Iterator parentIter) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java Sat Aug 14 17:17:00 2010
@@ -21,6 +21,7 @@ package org.apache.fop.layoutmgr;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.fo.Constants;
import org.apache.fop.traits.MinOptMax;
/**
@@ -29,13 +30,33 @@ import org.apache.fop.traits.MinOptMax;
*/
public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
- private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
+ private static final Log log // CSOK: ConstantName
+ = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class);
private int columnCount;
private int fullLen;
private int idealPartLen;
- public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
+ /**
+ * Construct a balancing column breaking algorithm.
+ * @param topLevelLM the top level layout manager
+ * @param pageProvider the page provider
+ * @param layoutListener the layout listener
+ * @param alignment alignment of the paragraph/page. One of {@link Constants#EN_START},
+ * {@link Constants#EN_JUSTIFY}, {@link Constants#EN_CENTER},
+ * {@link Constants#EN_END}.
+ * For pages, {@link Constants#EN_BEFORE} and {@link Constants#EN_AFTER}
+ * are mapped to the corresponding inline properties,
+ * {@link Constants#EN_START} and {@link Constants#EN_END}.
+ * @param alignmentLast alignment of the paragraph's last line
+ * @param footnoteSeparatorLength length of footnote separator
+ * @param partOverflowRecovery {@code true} if too long elements should be moved to
+ * the next line/part
+ * @param columnCount number of columns
+ * @see PageBreakingAlgorithm
+ */
+ public BalancingColumnBreakingAlgorithm // CSOK: ParameterNumber
+ (LayoutManager topLevelLM,
PageProvider pageProvider,
PageBreakingLayoutListener layoutListener,
int alignment, int alignmentLast,
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -187,7 +187,8 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment) {
resetSpaces();
if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment);
@@ -404,8 +405,9 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
- Position restartPosition, LayoutManager restartAtLM) {
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment, Stack lmStack,
+ Position restartPosition, LayoutManager restartAtLM) {
resetSpaces();
if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment);
@@ -990,8 +992,8 @@ public class BlockContainerLayoutManager
}
/** {@inheritDoc} */
- public void addAreas(PositionIterator parentIter,
- LayoutContext layoutContext) {
+ public void addAreas // CSOK: MethodLength
+ (PositionIterator parentIter, LayoutContext layoutContext) {
getParentArea(null);
// if this will create the first block area in a page
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -234,8 +234,8 @@ public class BlockLayoutManager extends
}
/** {@inheritDoc} */
- public void addAreas(PositionIterator parentIter,
- LayoutContext layoutContext) {
+ public void addAreas // CSOK: MethodLength
+ (PositionIterator parentIter, LayoutContext layoutContext) {
getParentArea(null);
// if this will create the first block area in a page
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -26,8 +26,18 @@ import org.apache.fop.fo.properties.Keep
*/
public interface BlockLevelLayoutManager extends LayoutManager {
+ /**
+ * Negotiate BPD adjustment.
+ * @param adj amount to adjust
+ * @param lastElement the last knuth element
+ * @return the resulting adjusted BPD
+ */
int negotiateBPDAdjustment(int adj, KnuthElement lastElement);
+ /**
+ * Discard space.
+ * @param spaceGlue the space
+ */
void discardSpace(KnuthGlue spaceGlue);
/**
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=985537&r1=985536&r2=985537&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Sat Aug 14 17:17:00 2010
@@ -55,6 +55,7 @@ public abstract class BlockStackingLayou
*/
private static Log log = LogFactory.getLog(BlockStackingLayoutManager.class);
+ /** parent area */
protected BlockParent parentArea;
/** Value of the block-progression-unit (non-standard property) */
@@ -360,7 +361,8 @@ public abstract class BlockStackingLayou
}
/** {@inheritDoc} */
- public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
+ public List getNextKnuthElements // CSOK: MethodLength
+ (LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
referenceIPD = context.getRefIPD();
updateContentAreaIPDwithOverconstrainedAdjust();
@@ -582,8 +584,8 @@ public abstract class BlockStackingLayou
/**
* Adds a break element to the content list between individual child elements.
- * @param contentList
- * @param parentLC
+ * @param contentList the content list
+ * @param parentLC the parent layout context
* @param childLC the currently active child layout context
*/
protected void addInBetweenBreak(List contentList, LayoutContext parentLC,
@@ -758,7 +760,7 @@ public abstract class BlockStackingLayou
/**
* {@inheritDoc}
*/
- public List getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) { // CSOK: MethodLength
/*LF*/ //log.debug("");
/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
// + oldList.size());
@@ -1377,7 +1379,12 @@ public abstract class BlockStackingLayou
}*/
}
- protected List createUnitElements(List oldList) {
+ /**
+ * Create unit elements.
+ * @param oldList the old list
+ * @return the new list
+ */
+ protected List createUnitElements(List oldList) { // CSOK: MethodLength
//log.debug("Start conversion: " + oldList.size()
// + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
// + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
@@ -1640,7 +1647,8 @@ public abstract class BlockStackingLayou
// insert the correct elements
newList.addFirst(new KnuthBox(wrongBox.getWidth() - decreasedLength,
wrongBox.getPosition(), false));
- newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, Adjustment.SPACE_BEFORE_ADJUSTMENT,
+ newList.addFirst(new KnuthGlue(decreasedLength, 0, 0,
+ Adjustment.SPACE_BEFORE_ADJUSTMENT,
wrongBox.getPosition(), false));
//log.debug(" rimosso box " + neededUnits(wrongBox.getWidth()));
//log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0");
@@ -1692,34 +1700,58 @@ public abstract class BlockStackingLayou
return newList;
}
+ /** A stack iterator. */
protected static class StackingIter extends PositionIterator {
+
+ /**
+ * Construct a stacking iterator.
+ * @param parentIter the parent iterator
+ */
StackingIter(Iterator parentIter) {
super(parentIter);
}
+ /**
+ * @param nextObj the next position
+ * @return the layout manager of the next position
+ */
protected LayoutManager getLM(Object nextObj) {
return ((Position) nextObj).getLM();
}
+ /**
+ * @param nextObj the next position
+ * @return the next position
+ */
protected Position getPos(Object nextObj) {
return ((Position) nextObj);
}
}
+ /** A mapping position. */
protected static class MappingPosition extends Position {
+
private int iFirstIndex;
private int iLastIndex;
+ /**
+ * Construct mapping position.
+ * @param lm layout manager
+ * @param first position
+ * @param last position
+ */
public MappingPosition(LayoutManager lm, int first, int last) {
super(lm);
iFirstIndex = first;
iLastIndex = last;
}
+ /** @return first index */
public int getFirstIndex() {
return iFirstIndex;
}
+ /** @return last index */
public int getLastIndex() {
return iLastIndex;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org