git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761020 13f79535-47bb-0310-9956-ffa450edef68pull/3/head
@@ -455,8 +455,7 @@ public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHand | |||
double[][] quadParts = CubicBezierApproximator.fixedMidPointApproximation( | |||
cubicCoords); | |||
if (quadParts.length >= 4) { | |||
for (int segIndex = 0; segIndex < quadParts.length; segIndex++) { | |||
double[] quadPts = quadParts[segIndex]; | |||
for (double[] quadPts : quadParts) { | |||
if (quadPts != null && quadPts.length == 4) { | |||
graphicsObj.addFillet(new int[]{ | |||
(int) Math.round(quadPts[X1]), |
@@ -551,9 +551,9 @@ public class DataStream { | |||
*/ | |||
public void createPageTagLogicalElement(TagLogicalElement.State[] attributes) { | |||
for (int i = 0; i < attributes.length; i++) { | |||
for (TagLogicalElement.State attribute : attributes) { | |||
currentPage.createTagLogicalElement(attributes[i]); | |||
currentPage.createTagLogicalElement(attribute); | |||
} | |||
} | |||
@@ -564,8 +564,8 @@ public class DataStream { | |||
* the array of key value pairs. | |||
*/ | |||
public void createPageGroupTagLogicalElement(TagLogicalElement.State[] attributes) { | |||
for (int i = 0; i < attributes.length; i++) { | |||
currentPageGroup.createTagLogicalElement(attributes[i]); | |||
for (TagLogicalElement.State attribute : attributes) { | |||
currentPageGroup.createTagLogicalElement(attribute); | |||
} | |||
} | |||
@@ -302,8 +302,7 @@ public abstract class CharacterSetBuilder { | |||
//process D3AC89 Font Position | |||
processFontPosition(structuredFieldReader, characterSetOrientations, normalizer); | |||
//process D38C89 Font Index (per orientation) | |||
for (int i = 0; i < characterSetOrientations.length; i++) { | |||
CharacterSetOrientation characterSetOrientation = characterSetOrientations[i]; | |||
for (CharacterSetOrientation characterSetOrientation : characterSetOrientations) { | |||
processFontIndex(structuredFieldReader, characterSetOrientation, codePage, normalizer); | |||
characterSet.addCharacterSetOrientation(characterSetOrientation); | |||
} |
@@ -111,14 +111,14 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder { | |||
if (colSpaceType == ColorSpace.TYPE_CMYK) { | |||
colspace = CMYK; | |||
colsizes = new byte[] {0x08, 0x08, 0x08, 0x08}; | |||
for (int i = 0; i < colorComponents.length; i++) { | |||
baout.write(Math.round(colorComponents[i] * 255)); | |||
for (float colorComponent : colorComponents) { | |||
baout.write(Math.round(colorComponent * 255)); | |||
} | |||
} else if (colSpaceType == ColorSpace.TYPE_RGB) { | |||
colspace = RGB; | |||
colsizes = new byte[] {0x08, 0x08, 0x08, 0x00}; | |||
for (int i = 0; i < colorComponents.length; i++) { | |||
baout.write(Math.round(colorComponents[i] * 255)); | |||
for (float colorComponent : colorComponents) { | |||
baout.write(Math.round(colorComponent * 255)); | |||
} | |||
} else if (cs instanceof CIELabColorSpace) { | |||
colspace = CIELAB; |
@@ -125,8 +125,8 @@ public class MapPageOverlay extends AbstractAFPObject { | |||
//now add the name | |||
byte[] name = (byte[]) overLays.get(i); | |||
for (int j = 0; j < name.length; j++) { | |||
data[++pos] = name[j]; | |||
for (byte aName : name) { | |||
data[++pos] = aName; | |||
} | |||
data[++pos] = 0x04; //Resource Local Identifier (RLI) |
@@ -682,8 +682,7 @@ public class FOUserAgent { | |||
Configuration userConfig = null; | |||
Configuration[] cfgs = cfg.getChild(type + "s").getChildren(type); | |||
for (int i = 0; i < cfgs.length; ++i) { | |||
Configuration child = cfgs[i]; | |||
for (Configuration child : cfgs) { | |||
try { | |||
if (child.getAttribute(mime).equals(mimeType)) { | |||
userConfig = child; |
@@ -370,8 +370,7 @@ public class FopConfParser { | |||
ImageImplRegistry registry = fopFactoryBuilder.getImageManager().getRegistry(); | |||
Configuration[] penalties = parent.getChildren("penalty"); | |||
try { | |||
for (int i = 0, c = penalties.length; i < c; i++) { | |||
Configuration penaltyCfg = penalties[i]; | |||
for (Configuration penaltyCfg : penalties) { | |||
String className = penaltyCfg.getAttribute("class"); | |||
String value = penaltyCfg.getAttribute("value"); | |||
Penalty p = null; |
@@ -21,7 +21,6 @@ package org.apache.fop.area; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.area.inline.InlineArea; | |||
@@ -132,8 +131,7 @@ public class LineArea extends Area { | |||
* @param inlineAreas the list of inline areas | |||
*/ | |||
public void setInlineAreas(List inlineAreas) { | |||
for (Iterator<InlineArea> it = inlineAreas.iterator(); it.hasNext();) { | |||
InlineArea ia = it.next(); | |||
for (InlineArea ia : (Iterable<InlineArea>) inlineAreas) { | |||
Area pa = ia.getParentArea(); | |||
if (pa == null) { | |||
ia.setParentArea(this); | |||
@@ -189,9 +187,9 @@ public class LineArea extends Area { | |||
public void updateExtentsFromChildren() { | |||
int ipd = 0; | |||
int bpd = 0; | |||
for (int i = 0, len = inlineAreas.size(); i < len; i++) { | |||
ipd = Math.max(ipd, inlineAreas.get(i).getAllocIPD()); | |||
bpd += inlineAreas.get(i).getAllocBPD(); | |||
for (InlineArea inlineArea : inlineAreas) { | |||
ipd = Math.max(ipd, inlineArea.getAllocIPD()); | |||
bpd += inlineArea.getAllocBPD(); | |||
} | |||
setIPD(ipd); | |||
setBPD(bpd); | |||
@@ -258,8 +256,8 @@ public class LineArea extends Area { | |||
// justified line: apply the variation factor | |||
boolean bUnresolvedAreasPresent = false; | |||
// recursively apply variation factor to descendant areas | |||
for (int i = 0, len = inlineAreas.size(); i < len; i++) { | |||
bUnresolvedAreasPresent |= inlineAreas.get(i) | |||
for (InlineArea inlineArea : inlineAreas) { | |||
bUnresolvedAreasPresent |= inlineArea | |||
.applyVariationFactor(adjustingInfo.variationFactor, | |||
adjustingInfo.availableStretch, | |||
adjustingInfo.availableShrink); |
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.area; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.fo.Constants; | |||
@@ -196,14 +195,14 @@ public class Span extends Area { | |||
switch (wmtg.getColumnProgressionDirection().getEnumValue()) { | |||
case Constants.EN_RL: | |||
setBidiLevel(1); | |||
for (Iterator<NormalFlow> it = flowAreas.iterator(); it.hasNext();) { | |||
it.next().setBidiLevel(1); | |||
for (NormalFlow flowArea1 : flowAreas) { | |||
flowArea1.setBidiLevel(1); | |||
} | |||
break; | |||
default: | |||
resetBidiLevel(); | |||
for (Iterator<NormalFlow> it = flowAreas.iterator(); it.hasNext();) { | |||
it.next().resetBidiLevel(); | |||
for (NormalFlow flowArea : flowAreas) { | |||
flowArea.resetBidiLevel(); | |||
} | |||
break; | |||
} |
@@ -438,8 +438,7 @@ public final class Trait implements Serializable { | |||
String dest = null; | |||
boolean newWindow = false; | |||
String[] values = traitValue.split(","); | |||
for (int i = 0, c = values.length; i < c; i++) { | |||
String v = values[i]; | |||
for (String v : values) { | |||
if (v.startsWith("dest=")) { | |||
dest = v.substring(5); | |||
} else if (v.startsWith("newWindow=")) { |
@@ -22,7 +22,6 @@ package org.apache.fop.area.inline; | |||
import java.io.IOException; | |||
import java.io.ObjectInputStream; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.area.Area; | |||
@@ -108,8 +107,7 @@ public class InlineParent extends InlineArea { | |||
boolean hasUnresolvedAreas = false; | |||
int cumulativeIPD = 0; | |||
// recursively apply variation factor to descendant areas | |||
for (int i = 0, len = inlines.size(); i < len; i++) { | |||
InlineArea inline = inlines.get(i); | |||
for (InlineArea inline : inlines) { | |||
hasUnresolvedAreas |= inline.applyVariationFactor( | |||
variationFactor, lineStretch, lineShrink); | |||
cumulativeIPD += inline.getIPD(); //Update this area's IPD based on changes to children | |||
@@ -121,8 +119,7 @@ public class InlineParent extends InlineArea { | |||
@Override | |||
public List collectInlineRuns(List runs) { | |||
for (Iterator<InlineArea> it = getChildAreas().iterator(); it.hasNext();) { | |||
InlineArea ia = it.next(); | |||
for (InlineArea ia : getChildAreas()) { | |||
runs = ia.collectInlineRuns(runs); | |||
} | |||
return runs; | |||
@@ -133,8 +130,8 @@ public class InlineParent extends InlineArea { | |||
* signalling that they will inherit the level of their parent text area. | |||
*/ | |||
public void resetChildrenLevel() { | |||
for (Iterator it = inlines.iterator(); it.hasNext();) { | |||
((InlineArea) it.next()) .resetBidiLevel(); | |||
for (InlineArea inline : inlines) { | |||
(inline).resetBidiLevel(); | |||
} | |||
} | |||
@@ -184,8 +184,7 @@ public class TextArea extends AbstractTextArea { | |||
private static int findMinLevel(int[] levels, int defaultLevel) { | |||
if (levels != null) { | |||
int lMin = Integer.MAX_VALUE; | |||
for (int i = 0, n = levels.length; i < n; i++) { | |||
int l = levels [ i ]; | |||
for (int l : levels) { | |||
if ((l >= 0) && (l < lMin)) { | |||
lMin = l; | |||
} |
@@ -599,8 +599,7 @@ public class CommandLineOptions { | |||
&& (args[i + 1].charAt(0) != '-')) { | |||
String arg = args[i + 1]; | |||
String[] parts = arg.split(","); | |||
for (int j = 0; j < parts.length; j++) { | |||
String s = parts[j]; | |||
for (String s : parts) { | |||
if (s.matches("\\d+")) { | |||
renderingOptions.put(PrintRenderer.START_PAGE, Integer.valueOf(s)); | |||
} else if (s.matches("\\d+-\\d+")) { | |||
@@ -702,8 +701,8 @@ public class CommandLineOptions { | |||
if ("list".equals(mime)) { | |||
String[] mimes = factory.getRendererFactory().listSupportedMimeTypes(); | |||
System.out.println("Supported MIME types:"); | |||
for (int j = 0; j < mimes.length; j++) { | |||
System.out.println(" " + mimes[j]); | |||
for (String mime1 : mimes) { | |||
System.out.println(" " + mime1); | |||
} | |||
// @SuppressFBWarnings("DM_EXIT") | |||
System.exit(0); |
@@ -84,16 +84,16 @@ public final class Main { | |||
} | |||
files = libDir.listFiles(filter); | |||
if (files != null) { | |||
for (int i = 0, size = files.length; i < size; i++) { | |||
jars.add(files[i].toURI().toURL()); | |||
for (File file : files) { | |||
jars.add(file.toURI().toURL()); | |||
} | |||
} | |||
String optionalLib = System.getProperty("fop.optional.lib"); | |||
if (optionalLib != null) { | |||
files = new File(optionalLib).listFiles(filter); | |||
if (files != null) { | |||
for (int i = 0, size = files.length; i < size; i++) { | |||
jars.add(files[i].toURI().toURL()); | |||
for (File file : files) { | |||
jars.add(file.toURI().toURL()); | |||
} | |||
} | |||
} |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.bidi; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Stack; | |||
import java.util.Vector; | |||
@@ -119,8 +118,8 @@ public final class BidiResolver { | |||
} | |||
private static void resolveInlineDirectionality(List ranges) { | |||
for (Iterator it = ranges.iterator(); it.hasNext(); ) { | |||
DelimitedTextRange r = (DelimitedTextRange) it.next(); | |||
for (Object range : ranges) { | |||
DelimitedTextRange r = (DelimitedTextRange) range; | |||
r.resolve(); | |||
if (log.isDebugEnabled()) { | |||
log.debug(r); | |||
@@ -129,8 +128,8 @@ public final class BidiResolver { | |||
} | |||
private static List collectRuns(List inlines, List runs) { | |||
for (Iterator it = inlines.iterator(); it.hasNext(); ) { | |||
InlineArea ia = (InlineArea) it.next(); | |||
for (Object inline : inlines) { | |||
InlineArea ia = (InlineArea) inline; | |||
runs = ia.collectInlineRuns(runs); | |||
} | |||
return runs; | |||
@@ -138,8 +137,8 @@ public final class BidiResolver { | |||
private static List splitRuns(List runs) { | |||
List runsNew = new Vector(); | |||
for (Iterator it = runs.iterator(); it.hasNext(); ) { | |||
InlineRun ir = (InlineRun) it.next(); | |||
for (Object run : runs) { | |||
InlineRun ir = (InlineRun) run; | |||
if (ir.isHomogenous()) { | |||
runsNew.add(ir); | |||
} else { | |||
@@ -156,8 +155,8 @@ public final class BidiResolver { | |||
if (mm == null) { | |||
mm = new int[] {Integer.MAX_VALUE, Integer.MIN_VALUE}; | |||
} | |||
for (Iterator it = runs.iterator(); it.hasNext(); ) { | |||
InlineRun ir = (InlineRun) it.next(); | |||
for (Object run : runs) { | |||
InlineRun ir = (InlineRun) run; | |||
ir.updateMinMax(mm); | |||
} | |||
return mm; | |||
@@ -205,8 +204,8 @@ public final class BidiResolver { | |||
return runsNew; | |||
} | |||
private static void reverseWords(List runs, boolean mirror) { | |||
for (Iterator it = runs.iterator(); it.hasNext(); ) { | |||
InlineRun ir = (InlineRun) it.next(); | |||
for (Object run : runs) { | |||
InlineRun ir = (InlineRun) run; | |||
ir.maybeReverseWord(mirror); | |||
} | |||
} | |||
@@ -217,8 +216,8 @@ public final class BidiResolver { | |||
} | |||
private static void replaceInlines(LineArea la, List runs) { | |||
List<InlineArea> inlines = new ArrayList<InlineArea>(); | |||
for (Iterator it = runs.iterator(); it.hasNext(); ) { | |||
InlineRun ir = (InlineRun) it.next(); | |||
for (Object run : runs) { | |||
InlineRun ir = (InlineRun) run; | |||
inlines.add(ir.getInline()); | |||
} | |||
la.setInlineAreas(unflattenInlines(inlines)); | |||
@@ -228,22 +227,22 @@ public final class BidiResolver { | |||
} | |||
private static void dumpRuns(String header, List runs) { | |||
log.debug(header); | |||
for (Iterator it = runs.iterator(); it.hasNext(); ) { | |||
InlineRun ir = (InlineRun) it.next(); | |||
for (Object run : runs) { | |||
InlineRun ir = (InlineRun) run; | |||
log.debug(ir); | |||
} | |||
} | |||
private static void dumpRanges(String header, List ranges) { | |||
log.debug(header); | |||
for (Iterator it = ranges.iterator(); it.hasNext(); ) { | |||
DelimitedTextRange r = (DelimitedTextRange) it.next(); | |||
for (Object range : ranges) { | |||
DelimitedTextRange r = (DelimitedTextRange) range; | |||
log.debug(r); | |||
} | |||
} | |||
private static List pruneEmptyRanges(List ranges) { | |||
Vector rv = new Vector(); | |||
for (Iterator it = ranges.iterator(); it.hasNext(); ) { | |||
DelimitedTextRange r = (DelimitedTextRange) it.next(); | |||
for (Object range : ranges) { | |||
DelimitedTextRange r = (DelimitedTextRange) range; | |||
if (!r.isEmpty()) { | |||
rv.add(r); | |||
} |
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.complexscripts.bidi; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Vector; | |||
@@ -114,8 +113,8 @@ public class DelimitedTextRange { | |||
StringBuffer sb = new StringBuffer("DR: " + fn.getLocalName() + " { <" + CharUtilities.toNCRefs(buffer.toString()) + ">"); | |||
sb.append(", intervals <"); | |||
boolean first = true; | |||
for (Iterator it = intervals.iterator(); it.hasNext(); ) { | |||
TextInterval ti = (TextInterval) it.next(); | |||
for (Object interval : intervals) { | |||
TextInterval ti = (TextInterval) interval; | |||
if (first) { | |||
first = false; | |||
} else { | |||
@@ -144,8 +143,8 @@ public class DelimitedTextRange { | |||
*/ | |||
private void assignLevels(int[] levels) { | |||
Vector intervalsNew = new Vector(intervals.size()); | |||
for (Iterator it = intervals.iterator(); it.hasNext(); ) { | |||
TextInterval ti = (TextInterval) it.next(); | |||
for (Object interval : intervals) { | |||
TextInterval ti = (TextInterval) interval; | |||
intervalsNew.addAll(assignLevels(ti, levels)); | |||
} | |||
if (!intervalsNew.equals(intervals)) { | |||
@@ -196,15 +195,15 @@ public class DelimitedTextRange { | |||
* <p>Assign resolved levels for each interval to source #PCDATA in the associated FOText.</p> | |||
*/ | |||
private void assignTextLevels() { | |||
for (Iterator it = intervals.iterator(); it.hasNext(); ) { | |||
TextInterval ti = (TextInterval) it.next(); | |||
for (Object interval : intervals) { | |||
TextInterval ti = (TextInterval) interval; | |||
ti.assignTextLevels(); | |||
} | |||
} | |||
private void assignBlockLevel(Direction paragraphEmbeddingLevel) { | |||
int defaultLevel = (paragraphEmbeddingLevel == Direction.RL) ? 1 : 0; | |||
for (Iterator it = intervals.iterator(); it.hasNext(); ) { | |||
TextInterval ti = (TextInterval) it.next(); | |||
for (Object interval : intervals) { | |||
TextInterval ti = (TextInterval) interval; | |||
assignBlockLevel(ti.getNode(), defaultLevel); | |||
} | |||
} |
@@ -93,8 +93,7 @@ public class InlineRun { | |||
int mn = Integer.MAX_VALUE; | |||
int mx = Integer.MIN_VALUE; | |||
if ((levels != null) && (levels.length > 0)) { | |||
for (int i = 0, n = levels.length; i < n; i++) { | |||
int l = levels [ i ]; | |||
for (int l : levels) { | |||
if (l < mn) { | |||
mn = l; | |||
} | |||
@@ -265,8 +264,7 @@ public class InlineRun { | |||
StringBuffer lb = new StringBuffer(); | |||
int maxLevel = -1; | |||
int numLevels = levels.length; | |||
for (int i = 0; i < numLevels; i++) { | |||
int l = levels [ i ]; | |||
for (int l : levels) { | |||
if (l > maxLevel) { | |||
maxLevel = l; | |||
} | |||
@@ -275,19 +273,19 @@ public class InlineRun { | |||
// leave level buffer empty | |||
} else if (maxLevel < 10) { | |||
// use string of decimal digits | |||
for (int i = 0; i < numLevels; i++) { | |||
lb.append((char) ('0' + levels [ i ])); | |||
for (int level : levels) { | |||
lb.append((char) ('0' + level)); | |||
} | |||
} else { | |||
// use comma separated list | |||
boolean first = true; | |||
for (int i = 0; i < numLevels; i++) { | |||
for (int level : levels) { | |||
if (first) { | |||
first = false; | |||
} else { | |||
lb.append(','); | |||
} | |||
lb.append(levels [ i ]); | |||
lb.append(level); | |||
} | |||
} | |||
return lb.toString(); |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.bidi; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import java.util.Stack; | |||
@@ -61,8 +60,8 @@ class UnflattenProcessor { | |||
} | |||
List unflatten() { | |||
if (il != null) { | |||
for (Iterator<InlineArea> it = il.iterator(); it.hasNext(); ) { | |||
process(it.next()); | |||
for (InlineArea anIl : il) { | |||
process(anIl); | |||
} | |||
} | |||
finishAll(); | |||
@@ -125,8 +124,7 @@ class UnflattenProcessor { | |||
} | |||
private void finishInlineContainer(List<InlineParent> ich, TextArea tc, InlineArea ia) { | |||
if ((ich != null) && !ich.isEmpty()) { // finish non-matching inner inline container(s) | |||
for (Iterator<InlineParent> it = ich.iterator(); it.hasNext(); ) { | |||
InlineParent ic = it.next(); | |||
for (InlineParent ic : ich) { | |||
InlineParent ic0 = icOrig.empty() ? null : icOrig.peek(); | |||
if (ic0 == null) { | |||
assert icNew.empty(); | |||
@@ -191,8 +189,8 @@ class UnflattenProcessor { | |||
} | |||
} | |||
private boolean alreadyUnflattened(InlineArea ia) { | |||
for (Iterator<InlineArea> it = ilNew.iterator(); it.hasNext(); ) { | |||
if (ia.isAncestorOrSelf(it.next())) { | |||
for (InlineArea anIlNew : ilNew) { | |||
if (ia.isAncestorOrSelf(anIlNew)) { | |||
return true; | |||
} | |||
} | |||
@@ -200,16 +198,14 @@ class UnflattenProcessor { | |||
} | |||
private void pushInlineContainers(List<InlineParent> ich) { | |||
LinkedList<InlineParent> icl = new LinkedList<InlineParent>(); | |||
for (Iterator<InlineParent> it = ich.iterator(); it.hasNext(); ) { | |||
InlineParent ic = it.next(); | |||
for (InlineParent ic : ich) { | |||
if (icOrig.search(ic) >= 0) { | |||
break; | |||
} else { | |||
icl.addFirst(ic); | |||
} | |||
} | |||
for (Iterator<InlineParent> it = icl.iterator(); it.hasNext(); ) { | |||
InlineParent ic = it.next(); | |||
for (InlineParent ic : icl) { | |||
icOrig.push(ic); | |||
icNew.push(generateInlineContainer(ic)); | |||
} | |||
@@ -307,8 +303,7 @@ class UnflattenProcessor { | |||
} | |||
private void updateIPD(TextArea tc) { | |||
int numAdjustable = 0; | |||
for (Iterator it = tc.getChildAreas().iterator(); it.hasNext(); ) { | |||
InlineArea ia = (InlineArea) it.next(); | |||
for (InlineArea ia : tc.getChildAreas()) { | |||
if (ia instanceof SpaceArea) { | |||
SpaceArea sa = (SpaceArea) ia; | |||
if (sa.isAdjustable()) { |
@@ -97,8 +97,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla | |||
if ((entries == null) || (entries.size() == 0)) { | |||
return false; | |||
} else { | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (!(o instanceof Integer)) { | |||
return false; | |||
} | |||
@@ -111,8 +110,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla | |||
if ((entries == null) || (entries.size() == 0)) { | |||
return false; | |||
} else { | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (!(o instanceof MappingRange)) { | |||
return false; | |||
} | |||
@@ -125,8 +123,7 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla | |||
if ((entries == null) || (entries.size() == 0)) { | |||
return false; | |||
} else { | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (!(o instanceof GlyphCoverageTable)) { | |||
return false; | |||
} | |||
@@ -161,8 +158,8 @@ public final class GlyphClassTable extends GlyphMappingTable implements GlyphCla | |||
List entries = new java.util.ArrayList(); | |||
entries.add(firstGlyph); | |||
if (gca != null) { | |||
for (int i = 0, n = gca.length; i < n; i++) { | |||
entries.add(gca[i]); | |||
for (int aGca : gca) { | |||
entries.add(aGca); | |||
} | |||
} | |||
return entries; |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.util.Arrays; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.commons.logging.Log; | |||
@@ -99,8 +98,7 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph | |||
if ((entries == null) || (entries.size() == 0)) { | |||
return false; | |||
} else { | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (!(o instanceof Integer)) { | |||
return false; | |||
} | |||
@@ -113,8 +111,7 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph | |||
if ((entries == null) || (entries.size() == 0)) { | |||
return false; | |||
} else { | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (!(o instanceof MappingRange)) { | |||
return false; | |||
} | |||
@@ -146,8 +143,8 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph | |||
public List getEntries() { | |||
List entries = new java.util.ArrayList(); | |||
if (map != null) { | |||
for (int i = 0, n = map.length; i < n; i++) { | |||
entries.add(map[i]); | |||
for (int aMap : map) { | |||
entries.add(aMap); | |||
} | |||
} | |||
return entries; | |||
@@ -178,13 +175,12 @@ public final class GlyphCoverageTable extends GlyphMappingTable implements Glyph | |||
int n = entries.size(); | |||
int gidMax = -1; | |||
int[] map = new int [ n ]; | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (o instanceof Integer) { | |||
int gid = (Integer) o; | |||
if ((gid >= 0) && (gid < 65536)) { | |||
if (gid > gidMax) { | |||
map [ i++ ] = gidMax = gid; | |||
map[i++] = gidMax = gid; | |||
} else { | |||
log.info("ignoring out of order or duplicate glyph index: " + gid); | |||
skipped++; |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.commons.logging.Log; | |||
@@ -78,8 +77,7 @@ public class GlyphDefinitionTable extends GlyphTable { | |||
if ((subtables == null) || (subtables.size() == 0)) { | |||
throw new AdvancedTypographicTableFormatException("subtables must be non-empty"); | |||
} else { | |||
for (Iterator it = subtables.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : subtables) { | |||
if (o instanceof GlyphDefinitionSubtable) { | |||
addSubtable((GlyphSubtable) o); | |||
} else { |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.util.Arrays; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
// CSOFF: LineLengthCheck | |||
@@ -186,8 +185,7 @@ public class GlyphMappingTable { | |||
int[] sa = new int [ n ]; | |||
int[] ea = new int [ n ]; | |||
int[] ma = new int [ n ]; | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (o instanceof MappingRange) { | |||
MappingRange r = (MappingRange) o; | |||
int gs = r.getStart(); | |||
@@ -205,9 +203,9 @@ public class GlyphMappingTable { | |||
throw new AdvancedTypographicTableFormatException("illegal mapping index: " + mi); | |||
} else { | |||
int miLast; | |||
sa [ i ] = gs; | |||
ea [ i ] = gidMax = ge; | |||
ma [ i ] = mi; | |||
sa[i] = gs; | |||
ea[i] = gidMax = ge; | |||
ma[i] = mi; | |||
if ((miLast = mi + (ge - gs)) > miMax) { | |||
miMax = miLast; | |||
} |
@@ -184,8 +184,7 @@ public class GlyphPositioningState extends GlyphProcessingState { | |||
public boolean apply(GlyphTable.RuleLookup[] lookups, int nig) { | |||
if ((lookups != null) && (lookups.length > 0)) { | |||
// apply each rule lookup to extracted input glyph array | |||
for (int i = 0, n = lookups.length; i < n; i++) { | |||
GlyphTable.RuleLookup l = lookups [ i ]; | |||
for (GlyphTable.RuleLookup l : lookups) { | |||
if (l != null) { | |||
GlyphTable.LookupTable lt = l.getLookup(); | |||
if (lt != null) { |
@@ -21,7 +21,6 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -76,8 +75,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
if ((subtables == null) || (subtables.size() == 0)) { | |||
throw new AdvancedTypographicTableFormatException("subtables must be non-empty"); | |||
} else { | |||
for (Iterator it = subtables.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : subtables) { | |||
if (o instanceof GlyphPositioningSubtable) { | |||
addSubtable((GlyphSubtable) o); | |||
} else { | |||
@@ -342,8 +340,8 @@ public class GlyphPositioningTable extends GlyphTable { | |||
public List getEntries() { | |||
if (values != null) { | |||
List entries = new ArrayList(values.length); | |||
for (int i = 0, n = values.length; i < n; i++) { | |||
entries.add(values[i]); | |||
for (Value value : values) { | |||
entries.add(value); | |||
} | |||
return entries; | |||
} else { | |||
@@ -487,8 +485,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
public PairValues getPairValues(int ci, int gi1, int gi2) { | |||
if ((pvm != null) && (ci < pvm.length)) { | |||
PairValues[] pvt = pvm [ ci ]; | |||
for (int i = 0, n = pvt.length; i < n; i++) { | |||
PairValues pv = pvt [ i ]; | |||
for (PairValues pv : pvt) { | |||
if (pv != null) { | |||
int g = pv.getGlyph(); | |||
if (g < gi2) { | |||
@@ -1225,8 +1222,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) { | |||
ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r; | |||
int[] iga = cr.getGlyphs(gi); | |||
@@ -1313,8 +1309,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedClassSequenceRule)) { | |||
ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r; | |||
int[] ca = cr.getClasses(cdt.getClassIndex(gi, ps.getClassMatchSet(gi))); | |||
@@ -1415,8 +1410,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) { | |||
ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r; | |||
GlyphCoverageTable[] gca = cr.getCoverages(); | |||
@@ -1552,8 +1546,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) { | |||
ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r; | |||
int[] iga = cr.getGlyphs(gi); | |||
@@ -1628,8 +1621,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedClassSequenceRule)) { | |||
ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r; | |||
int[] ica = cr.getClasses(icdt.getClassIndex(gi, ps.getClassMatchSet(gi))); | |||
@@ -1719,8 +1711,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) { | |||
ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r; | |||
GlyphCoverageTable[] igca = cr.getCoverages(); |
@@ -204,8 +204,7 @@ public class GlyphSubstitutionState extends GlyphProcessingState { | |||
int nog = 0; | |||
if ((lookups != null) && (lookups.length > 0)) { | |||
// apply each rule lookup to extracted input glyph array | |||
for (int i = 0, n = lookups.length; i < n; i++) { | |||
GlyphTable.RuleLookup l = lookups [ i ]; | |||
for (GlyphTable.RuleLookup l : lookups) { | |||
if (l != null) { | |||
GlyphTable.LookupTable lt = l.getLookup(); | |||
if (lt != null) { |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -74,8 +73,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
if ((subtables == null) || (subtables.size() == 0)) { | |||
throw new AdvancedTypographicTableFormatException("subtables must be non-empty"); | |||
} else { | |||
for (Iterator it = subtables.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : subtables) { | |||
if (o instanceof GlyphSubstitutionSubtable) { | |||
addSubtable((GlyphSubtable) o); | |||
} else { | |||
@@ -324,8 +322,8 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
/** {@inheritDoc} */ | |||
public List getEntries() { | |||
List entries = new ArrayList(glyphs.length); | |||
for (int i = 0, n = glyphs.length; i < n; i++) { | |||
entries.add(glyphs[i]); | |||
for (int glyph : glyphs) { | |||
entries.add(glyph); | |||
} | |||
return entries; | |||
} | |||
@@ -343,12 +341,11 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
int i = 0; | |||
int n = entries.size(); | |||
int[] glyphs = new int [ n ]; | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (o instanceof Integer) { | |||
int gid = (Integer) o; | |||
if ((gid >= 0) && (gid < 65536)) { | |||
glyphs [ i++ ] = gid; | |||
glyphs[i++] = gid; | |||
} else { | |||
throw new AdvancedTypographicTableFormatException("illegal glyph index: " + gid); | |||
} | |||
@@ -509,8 +506,8 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
/** {@inheritDoc} */ | |||
public List getEntries() { | |||
List entries = new ArrayList(gaa.length); | |||
for (int i = 0, n = gaa.length; i < n; i++) { | |||
entries.add(gaa[i]); | |||
for (int[] aGaa : gaa) { | |||
entries.add(aGaa); | |||
} | |||
return entries; | |||
} | |||
@@ -528,10 +525,9 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
int i = 0; | |||
int n = entries.size(); | |||
int[][] gaa = new int [ n ][]; | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (o instanceof int[]) { | |||
gaa [ i++ ] = (int[]) o; | |||
gaa[i++] = (int[]) o; | |||
} else { | |||
throw new AdvancedTypographicTableFormatException("illegal entries entry, must be int[]: " + o); | |||
} | |||
@@ -642,8 +638,8 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
/** {@inheritDoc} */ | |||
public List getEntries() { | |||
List entries = new ArrayList(ligatureSets.length); | |||
for (int i = 0, n = ligatureSets.length; i < n; i++) { | |||
entries.add(ligatureSets[i]); | |||
for (LigatureSet ligatureSet : ligatureSets) { | |||
entries.add(ligatureSet); | |||
} | |||
return entries; | |||
} | |||
@@ -661,10 +657,9 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
int i = 0; | |||
int n = entries.size(); | |||
LigatureSet[] ligatureSets = new LigatureSet [ n ]; | |||
for (Iterator it = entries.iterator(); it.hasNext();) { | |||
Object o = it.next(); | |||
for (Object o : entries) { | |||
if (o instanceof LigatureSet) { | |||
ligatureSets [ i++ ] = (LigatureSet) o; | |||
ligatureSets[i++] = (LigatureSet) o; | |||
} else { | |||
throw new AdvancedTypographicTableFormatException("illegal ligatures entry, must be LigatureSet: " + o); | |||
} | |||
@@ -754,8 +749,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) { | |||
ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r; | |||
int[] iga = cr.getGlyphs(gi); | |||
@@ -842,8 +836,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedClassSequenceRule)) { | |||
ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r; | |||
int[] ca = cr.getClasses(cdt.getClassIndex(gi, ss.getClassMatchSet(gi))); | |||
@@ -944,8 +937,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) { | |||
ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r; | |||
GlyphCoverageTable[] gca = cr.getCoverages(); | |||
@@ -1082,8 +1074,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedGlyphSequenceRule)) { | |||
ChainedGlyphSequenceRule cr = (ChainedGlyphSequenceRule) r; | |||
int[] iga = cr.getGlyphs(gi); | |||
@@ -1154,8 +1145,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedClassSequenceRule)) { | |||
ChainedClassSequenceRule cr = (ChainedClassSequenceRule) r; | |||
int[] ica = cr.getClasses(icdt.getClassIndex(gi, ss.getClassMatchSet(gi))); | |||
@@ -1249,8 +1239,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
RuleSet rs = rsa [ 0 ]; | |||
if (rs != null) { | |||
Rule[] ra = rs.getRules(); | |||
for (int i = 0, n = ra.length; i < n; i++) { | |||
Rule r = ra [ i ]; | |||
for (Rule r : ra) { | |||
if ((r != null) && (r instanceof ChainedCoverageSequenceRule)) { | |||
ChainedCoverageSequenceRule cr = (ChainedCoverageSequenceRule) r; | |||
GlyphCoverageTable[] igca = cr.getCoverages(); | |||
@@ -1348,8 +1337,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
} else if (components == null) { | |||
throw new AdvancedTypographicTableFormatException("invalid ligature components, must be non-null array"); | |||
} else { | |||
for (int i = 0, n = components.length; i < n; i++) { | |||
int gc = components [ i ]; | |||
for (int gc : components) { | |||
if ((gc < 0) || (gc > 65535)) { | |||
throw new AdvancedTypographicTableFormatException("invalid component glyph index: " + gc); | |||
} | |||
@@ -1436,8 +1424,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
} else { | |||
this.ligatures = ligatures; | |||
int ncMax = -1; | |||
for (int i = 0, n = ligatures.length; i < n; i++) { | |||
Ligature l = ligatures [ i ]; | |||
for (Ligature l : ligatures) { | |||
int nc = l.getNumComponents() + 1; | |||
if (nc > ncMax) { | |||
ncMax = nc; |
@@ -271,8 +271,8 @@ public abstract class GlyphSubtable implements Comparable { | |||
if ((subtables == null) || (subtables.length == 0)) { | |||
return false; | |||
} else { | |||
for (int i = 0, n = subtables.length; i < n; i++) { | |||
if (subtables[i].usesReverseScan()) { | |||
for (GlyphSubtable subtable : subtables) { | |||
if (subtable.usesReverseScan()) { | |||
return true; | |||
} | |||
} | |||
@@ -292,16 +292,16 @@ public abstract class GlyphSubtable implements Comparable { | |||
} else { | |||
int flags = 0; | |||
// obtain first non-zero value of flags in array of subtables | |||
for (int i = 0, n = subtables.length; i < n; i++) { | |||
int f = subtables[i].getFlags(); | |||
for (GlyphSubtable subtable1 : subtables) { | |||
int f = subtable1.getFlags(); | |||
if (flags == 0) { | |||
flags = f; | |||
break; | |||
} | |||
} | |||
// enforce flag consistency | |||
for (int i = 0, n = subtables.length; i < n; i++) { | |||
int f = subtables[i].getFlags(); | |||
for (GlyphSubtable subtable : subtables) { | |||
int f = subtable.getFlags(); | |||
if (f != flags) { | |||
throw new IllegalStateException("inconsistent lookup flags " + f + ", expected " + flags); | |||
} |
@@ -22,7 +22,6 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.LinkedHashMap; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
@@ -117,8 +116,8 @@ public class GlyphTable { | |||
public List/*<LookupTable>*/ getLookupTables() { | |||
TreeSet/*<String>*/ lids = new TreeSet/*<String>*/(lookupTables.keySet()); | |||
List/*<LookupTable>*/ ltl = new ArrayList/*<LookupTable>*/(lids.size()); | |||
for (Iterator it = lids.iterator(); it.hasNext(); ) { | |||
String lid = (String) it.next(); | |||
for (Object lid1 : lids) { | |||
String lid = (String) lid1; | |||
ltl.add(lookupTables.get(lid)); | |||
} | |||
return ltl; | |||
@@ -162,8 +161,8 @@ public class GlyphTable { | |||
*/ | |||
protected void freezeSubtables() { | |||
if (!frozen) { | |||
for (Iterator it = lookupTables.values().iterator(); it.hasNext(); ) { | |||
LookupTable lt = (LookupTable) it.next(); | |||
for (Object o : lookupTables.values()) { | |||
LookupTable lt = (LookupTable) o; | |||
lt.freezeSubtables(lookupTables); | |||
} | |||
frozen = true; | |||
@@ -181,8 +180,8 @@ public class GlyphTable { | |||
public List/*<LookupSpec>*/ matchLookupSpecs(String script, String language, String feature) { | |||
Set/*<LookupSpec>*/ keys = lookups.keySet(); | |||
List/*<LookupSpec>*/ matches = new ArrayList/*<LookupSpec>*/(); | |||
for (Iterator it = keys.iterator(); it.hasNext();) { | |||
LookupSpec ls = (LookupSpec) it.next(); | |||
for (Object key : keys) { | |||
LookupSpec ls = (LookupSpec) key; | |||
if (!"*".equals(script)) { | |||
if (!ls.getScript().equals(script)) { | |||
continue; | |||
@@ -217,8 +216,8 @@ public class GlyphTable { | |||
if (lm == null) { | |||
lm = new LinkedHashMap(); | |||
List/*<LookupSpec>*/ lsl = matchLookupSpecs(script, language, feature); | |||
for (Iterator it = lsl.iterator(); it.hasNext(); ) { | |||
LookupSpec ls = (LookupSpec) it.next(); | |||
for (Object aLsl : lsl) { | |||
LookupSpec ls = (LookupSpec) aLsl; | |||
lm.put(ls, findLookupTables(ls)); | |||
} | |||
matchedLookups.put(lsm, lm); | |||
@@ -239,8 +238,8 @@ public class GlyphTable { | |||
TreeSet/*<LookupTable>*/ lts = new TreeSet/*<LookupTable>*/(); | |||
List/*<String>*/ ids; | |||
if ((ids = (List/*<String>*/) lookups.get(ls)) != null) { | |||
for (Iterator it = ids.iterator(); it.hasNext();) { | |||
String lid = (String) it.next(); | |||
for (Object id : ids) { | |||
String lid = (String) id; | |||
LookupTable lt; | |||
if ((lt = (LookupTable) lookupTables.get(lid)) != null) { | |||
lts.add(lt); | |||
@@ -259,16 +258,15 @@ public class GlyphTable { | |||
*/ | |||
public UseSpec[] assembleLookups(String[] features, Map/*<LookupSpec,List<LookupTable>>*/ lookups) { | |||
TreeSet/*<UseSpec>*/ uss = new TreeSet/*<UseSpec>*/(); | |||
for (int i = 0, n = features.length; i < n; i++) { | |||
String feature = features[i]; | |||
for (Iterator it = lookups.entrySet().iterator(); it.hasNext(); ) { | |||
Map.Entry/*<LookupSpec,List<LookupTable>>*/ e = (Map.Entry/*<LookupSpec,List<LookupTable>>*/) it.next(); | |||
for (String feature : features) { | |||
for (Object o : lookups.entrySet()) { | |||
Map.Entry/*<LookupSpec,List<LookupTable>>*/ e = (Map.Entry/*<LookupSpec,List<LookupTable>>*/) o; | |||
LookupSpec ls = (LookupSpec) e.getKey(); | |||
if (ls.getFeature().equals(feature)) { | |||
List/*<LookupTable>*/ ltl = (List/*<LookupTable>*/) e.getValue(); | |||
if (ltl != null) { | |||
for (Iterator ltit = ltl.iterator(); ltit.hasNext(); ) { | |||
LookupTable lt = (LookupTable) ltit.next(); | |||
for (Object aLtl : ltl) { | |||
LookupTable lt = (LookupTable) aLtl; | |||
uss.add(new UseSpec(lt, feature)); | |||
} | |||
} | |||
@@ -334,8 +332,7 @@ public class GlyphTable { | |||
*/ | |||
public static void resolveLookupReferences(RuleSet[] rsa, Map/*<String,LookupTable>*/ lookupTables) { | |||
if ((rsa != null) && (lookupTables != null)) { | |||
for (int i = 0, n = rsa.length; i < n; i++) { | |||
RuleSet rs = rsa [ i ]; | |||
for (RuleSet rs : rsa) { | |||
if (rs != null) { | |||
rs.resolveLookupReferences(lookupTables); | |||
} | |||
@@ -498,8 +495,8 @@ public class GlyphTable { | |||
this.idOrdinal = Integer.parseInt(id.substring(2)); | |||
this.subtables = new LinkedList/*<GlyphSubtable>*/(); | |||
if (subtables != null) { | |||
for (Iterator it = subtables.iterator(); it.hasNext(); ) { | |||
GlyphSubtable st = (GlyphSubtable) it.next(); | |||
for (Object subtable : subtables) { | |||
GlyphSubtable st = (GlyphSubtable) subtable; | |||
addSubtable(st); | |||
} | |||
} | |||
@@ -600,8 +597,7 @@ public class GlyphTable { | |||
private void resolveLookupReferences(GlyphSubtable[] subtables, Map/*<String,LookupTable>*/ lookupTables) { | |||
if (subtables != null) { | |||
for (int i = 0, n = subtables.length; i < n; i++) { | |||
GlyphSubtable st = subtables [ i ]; | |||
for (GlyphSubtable st : subtables) { | |||
if (st != null) { | |||
st.resolveLookupReferences(lookupTables); | |||
} | |||
@@ -936,8 +932,7 @@ public class GlyphTable { | |||
*/ | |||
public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) { | |||
if (lookups != null) { | |||
for (int i = 0, n = lookups.length; i < n; i++) { | |||
RuleLookup l = lookups [ i ]; | |||
for (RuleLookup l : lookups) { | |||
if (l != null) { | |||
l.resolveLookupReferences(lookupTables); | |||
} | |||
@@ -1274,8 +1269,7 @@ public class GlyphTable { | |||
*/ | |||
public void resolveLookupReferences(Map/*<String,LookupTable>*/ lookupTables) { | |||
if (rules != null) { | |||
for (int i = 0, n = rules.length; i < n; i++) { | |||
Rule r = rules [ i ]; | |||
for (Rule r : rules) { | |||
if (r != null) { | |||
r.resolveLookupReferences(lookupTables); | |||
} |
@@ -21,7 +21,6 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -3577,8 +3576,8 @@ public final class OTFAdvancedTypographicTableReader { | |||
} | |||
private void constructLookupsFeatures(Map lookups, String st, String lt, List/*<String>*/ fids) { | |||
for (Iterator fit = fids.iterator(); fit.hasNext();) { | |||
String fid = (String) fit.next(); | |||
for (Object fid1 : fids) { | |||
String fid = (String) fid1; | |||
constructLookupsFeature(lookups, st, lt, fid); | |||
} | |||
} | |||
@@ -3597,16 +3596,16 @@ public final class OTFAdvancedTypographicTableReader { | |||
} | |||
private void constructLookupsLanguages(Map lookups, String st, List/*<String>*/ ll, Map/*<String,Object[2]>*/ languages) { | |||
for (Iterator lit = ll.iterator(); lit.hasNext();) { | |||
String lt = (String) lit.next(); | |||
for (Object aLl : ll) { | |||
String lt = (String) aLl; | |||
constructLookupsLanguage(lookups, st, lt, languages); | |||
} | |||
} | |||
private Map constructLookups() { | |||
Map/*<GlyphTable.LookupSpec,List<String>>*/ lookups = new java.util.LinkedHashMap(); | |||
for (Iterator sit = seScripts.keySet().iterator(); sit.hasNext();) { | |||
String st = (String) sit.next(); | |||
for (Object o : seScripts.keySet()) { | |||
String st = (String) o; | |||
Object[] sp = (Object[]) seScripts.get(st); | |||
if (sp != null) { | |||
assert sp.length == 3; | |||
@@ -3625,8 +3624,8 @@ public final class OTFAdvancedTypographicTableReader { | |||
private List constructGDEFSubtables() { | |||
List/*<GlyphDefinitionSubtable>*/ subtables = new java.util.ArrayList(); | |||
if (seSubtables != null) { | |||
for (Iterator it = seSubtables.iterator(); it.hasNext();) { | |||
Object[] stp = (Object[]) it.next(); | |||
for (Object seSubtable : seSubtables) { | |||
Object[] stp = (Object[]) seSubtable; | |||
GlyphSubtable st; | |||
if ((st = constructGDEFSubtable(stp)) != null) { | |||
subtables.add(st); | |||
@@ -3661,8 +3660,8 @@ public final class OTFAdvancedTypographicTableReader { | |||
private List constructGSUBSubtables() { | |||
List/*<GlyphSubtable>*/ subtables = new java.util.ArrayList(); | |||
if (seSubtables != null) { | |||
for (Iterator it = seSubtables.iterator(); it.hasNext();) { | |||
Object[] stp = (Object[]) it.next(); | |||
for (Object seSubtable : seSubtables) { | |||
Object[] stp = (Object[]) seSubtable; | |||
GlyphSubtable st; | |||
if ((st = constructGSUBSubtable(stp)) != null) { | |||
subtables.add(st); | |||
@@ -3697,8 +3696,8 @@ public final class OTFAdvancedTypographicTableReader { | |||
private List constructGPOSSubtables() { | |||
List/*<GlyphSubtable>*/ subtables = new java.util.ArrayList(); | |||
if (seSubtables != null) { | |||
for (Iterator it = seSubtables.iterator(); it.hasNext();) { | |||
Object[] stp = (Object[]) it.next(); | |||
for (Object seSubtable : seSubtables) { | |||
Object[] stp = (Object[]) seSubtable; | |||
GlyphSubtable st; | |||
if ((st = constructGPOSSubtable(stp)) != null) { | |||
subtables.add(st); | |||
@@ -3786,13 +3785,13 @@ public final class OTFAdvancedTypographicTableReader { | |||
sb.append('-'); | |||
} else { | |||
boolean first = true; | |||
for (int i = 0; i < ia.length; i++) { | |||
for (int anIa : ia) { | |||
if (!first) { | |||
sb.append(' '); | |||
} else { | |||
first = false; | |||
} | |||
sb.append(ia[i]); | |||
sb.append(anIa); | |||
} | |||
} | |||
return sb.toString(); |
@@ -184,8 +184,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { | |||
for (int i = 0, n = sa.length; i < n; i++) { | |||
GlyphSequence s = sa [ i ]; | |||
// apply basic shaping subs | |||
for (int j = 0, m = usa.length; j < m; j++) { | |||
GlyphTable.UseSpec us = usa [ j ]; | |||
for (GlyphTable.UseSpec us : usa) { | |||
if (isBasicShapingUse(us)) { | |||
s.setPredications(true); | |||
s = us.substitute(s, script, language, sct); | |||
@@ -196,8 +195,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { | |||
// reorder reph | |||
s = reorderReph(s); | |||
// apply presentation subs | |||
for (int j = 0, m = usa.length; j < m; j++) { | |||
GlyphTable.UseSpec us = usa [ j ]; | |||
for (GlyphTable.UseSpec us : usa) { | |||
if (isPresentationUse(us)) { | |||
s.setPredications(true); | |||
s = us.substitute(s, script, language, sct); | |||
@@ -503,19 +501,18 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { | |||
int[] ga = gs.getGlyphArray(false); | |||
CharAssociation[] aa = gs.getAssociations(0, -1); | |||
Vector<GlyphSequence> nsv = new Vector<GlyphSequence>(); | |||
for (int i = 0, ns = sa.length; i < ns; i++) { | |||
Segment s = sa [ i ]; | |||
for (Segment s : sa) { | |||
Vector<Integer> ngv = new Vector<Integer>(ng); | |||
Vector<CharAssociation> nav = new Vector<CharAssociation>(ng); | |||
for (int j = 0; j < ng; j++) { | |||
CharAssociation ca = aa [ j ]; | |||
CharAssociation ca = aa[j]; | |||
if (ca.contained(s.getOffset(), s.getCount())) { | |||
ngv.add(ga [ j ]); | |||
ngv.add(ga[j]); | |||
nav.add(ca); | |||
} | |||
} | |||
if (ngv.size() > 0) { | |||
nsv.add(new GlyphSequence(gs, null, toIntArray(ngv), null, null, nav.toArray(new CharAssociation [ nav.size() ]), null)); | |||
nsv.add(new GlyphSequence(gs, null, toIntArray(ngv), null, null, nav.toArray(new CharAssociation[nav.size()]), null)); | |||
} | |||
} | |||
if (nsv.size() > 0) { |
@@ -109,8 +109,7 @@ public abstract class ScriptProcessor { | |||
*/ | |||
public GlyphSequence substitute(GlyphSequence gs, String script, String language, GlyphTable.UseSpec[] usa, ScriptContextTester sct) { | |||
assert usa != null; | |||
for (int i = 0, n = usa.length; i < n; i++) { | |||
GlyphTable.UseSpec us = usa [ i ]; | |||
for (GlyphTable.UseSpec us : usa) { | |||
gs = us.substitute(gs, script, language, sct); | |||
} | |||
return gs; | |||
@@ -186,8 +185,7 @@ public abstract class ScriptProcessor { | |||
public boolean position(GlyphSequence gs, String script, String language, int fontSize, GlyphTable.UseSpec[] usa, int[] widths, int[][] adjustments, ScriptContextTester sct) { | |||
assert usa != null; | |||
boolean adjusted = false; | |||
for (int i = 0, n = usa.length; i < n; i++) { | |||
GlyphTable.UseSpec us = usa [ i ]; | |||
for (GlyphTable.UseSpec us : usa) { | |||
if (us.position(gs, script, language, fontSize, widths, adjustments, sct)) { | |||
adjusted = true; | |||
} |
@@ -358,8 +358,7 @@ public class CharAssociation implements Cloneable { | |||
*/ | |||
private static int[] extractIntervals(CharAssociation[] aa) { | |||
int ni = 0; | |||
for (int i = 0, n = aa.length; i < n; i++) { | |||
CharAssociation a = aa [ i ]; | |||
for (CharAssociation a : aa) { | |||
if (a.isDisjoint()) { | |||
ni += a.getSubIntervalCount(); | |||
} else { | |||
@@ -401,25 +400,25 @@ public class CharAssociation implements Cloneable { | |||
assert sa.length == ea.length; | |||
int ni = sa.length; | |||
int[] incr = (ni < 21) ? SORT_INCREMENTS_03 : SORT_INCREMENTS_16; | |||
for (int k = 0; k < incr.length; k++) { | |||
for (int h = incr [ k ], i = h, n = ni, j; i < n; i++) { | |||
int s1 = sa [ i ]; | |||
int e1 = ea [ i ]; | |||
for (int anIncr : incr) { | |||
for (int h = anIncr, i = h, n = ni, j; i < n; i++) { | |||
int s1 = sa[i]; | |||
int e1 = ea[i]; | |||
for (j = i; j >= h; j -= h) { | |||
int s2 = sa [ j - h ]; | |||
int e2 = ea [ j - h ]; | |||
int s2 = sa[j - h]; | |||
int e2 = ea[j - h]; | |||
if (s2 > s1) { | |||
sa [ j ] = s2; | |||
ea [ j ] = e2; | |||
sa[j] = s2; | |||
ea[j] = e2; | |||
} else if ((s2 == s1) && (e2 > e1)) { | |||
sa [ j ] = s2; | |||
ea [ j ] = e2; | |||
sa[j] = s2; | |||
ea[j] = e2; | |||
} else { | |||
break; | |||
} | |||
} | |||
sa [ j ] = s1; | |||
ea [ j ] = e1; | |||
sa[j] = s1; | |||
ea[j] = e1; | |||
} | |||
} | |||
int[] ia = new int [ ni * 2 ]; |
@@ -22,7 +22,6 @@ package org.apache.fop.complexscripts.util; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
import java.util.Set; | |||
@@ -712,8 +711,8 @@ public final class CharScript { | |||
} | |||
int[] sa = new int [ s.size() ]; | |||
int ns = 0; | |||
for (Iterator it = s.iterator(); it.hasNext();) { | |||
sa [ ns++ ] = (Integer) it.next(); | |||
for (Object value : s) { | |||
sa[ns++] = (Integer) value; | |||
} | |||
Arrays.sort(sa); | |||
return sa; | |||
@@ -739,23 +738,23 @@ public final class CharScript { | |||
} | |||
int sMax = -1; | |||
int cMax = -1; | |||
for (Iterator it = m.entrySet().iterator(); it.hasNext();) { | |||
Map.Entry e = (Map.Entry) it.next(); | |||
for (Object o : m.entrySet()) { | |||
Map.Entry e = (Map.Entry) o; | |||
Integer k = (Integer) e.getKey(); | |||
int s = k; | |||
switch (s) { | |||
case SCRIPT_UNDETERMINED: | |||
case SCRIPT_UNCODED: | |||
break; | |||
default: | |||
Integer v = (Integer) e.getValue(); | |||
assert v != null; | |||
int c = v; | |||
if (c > cMax) { | |||
cMax = c; | |||
sMax = s; | |||
} | |||
break; | |||
case SCRIPT_UNDETERMINED: | |||
case SCRIPT_UNCODED: | |||
break; | |||
default: | |||
Integer v = (Integer) e.getValue(); | |||
assert v != null; | |||
int c = v; | |||
if (c > cMax) { | |||
cMax = c; | |||
sMax = s; | |||
} | |||
break; | |||
} | |||
} | |||
if (sMax < 0) { |
@@ -459,18 +459,18 @@ public class GlyphSequence implements Cloneable { | |||
if (na > 0) { | |||
List gl = new ArrayList(na); | |||
if (baa != null) { | |||
for (int i = 0; i < baa.length; i++) { | |||
gl.add(baa[i]); | |||
for (CharAssociation aBaa : baa) { | |||
gl.add(aBaa); | |||
} | |||
} | |||
if (iaa != null) { | |||
for (int i = 0; i < iaa.length; i++) { | |||
gl.add(iaa[i]); | |||
for (CharAssociation anIaa : iaa) { | |||
gl.add(anIaa); | |||
} | |||
} | |||
if (laa != null) { | |||
for (int i = 0; i < laa.length; i++) { | |||
gl.add(laa[i]); | |||
for (CharAssociation aLaa : laa) { | |||
gl.add(aLaa); | |||
} | |||
} | |||
return gl; | |||
@@ -489,8 +489,7 @@ public class GlyphSequence implements Cloneable { | |||
assert sa != null; | |||
int tg = 0; | |||
int ta = 0; | |||
for (int i = 0, n = sa.length; i < n; i++) { | |||
GlyphSequence s = sa [ i ]; | |||
for (GlyphSequence s : sa) { | |||
IntBuffer ga = s.getGlyphs(); | |||
assert ga != null; | |||
int ng = ga.limit(); | |||
@@ -503,8 +502,7 @@ public class GlyphSequence implements Cloneable { | |||
} | |||
IntBuffer uga = IntBuffer.allocate(tg); | |||
ArrayList ual = new ArrayList(ta); | |||
for (int i = 0, n = sa.length; i < n; i++) { | |||
GlyphSequence s = sa [ i ]; | |||
for (GlyphSequence s : sa) { | |||
uga.put(s.getGlyphs()); | |||
ual.addAll(s.getAssociations()); | |||
} |
@@ -160,15 +160,14 @@ public class NumberConverter { | |||
int tokenType = TOKEN_NONE; | |||
List<Integer> token = new ArrayList<Integer>(); | |||
Integer[] ca = UTF32.toUTF32(format, 0, true); | |||
for (int i = 0, n = ca.length; i < n; i++) { | |||
int c = ca[i]; | |||
for (Integer c : ca) { | |||
int tokenTypeNew = isAlphaNumeric(c) ? TOKEN_ALPHANUMERIC : TOKEN_NONALPHANUMERIC; | |||
if (tokenTypeNew != tokenType) { | |||
if (token.size() > 0) { | |||
if (tokenType == TOKEN_ALPHANUMERIC) { | |||
tokens.add(token.toArray(new Integer [ token.size() ])); | |||
tokens.add(token.toArray(new Integer[token.size()])); | |||
} else { | |||
separators.add(token.toArray(new Integer [ token.size() ])); | |||
separators.add(token.toArray(new Integer[token.size()])); | |||
} | |||
token.clear(); | |||
} | |||
@@ -429,8 +428,8 @@ public class NumberConverter { | |||
for (String[] el : equivalentLanguages) { | |||
assert el.length >= 2; | |||
if (el[0].equals(i3c)) { | |||
for (int i = 0, n = el.length; i < n; i++) { | |||
if (el[i].equals(lc)) { | |||
for (String anEl : el) { | |||
if (anEl.equals(lc)) { | |||
return true; | |||
} | |||
} |
@@ -132,8 +132,8 @@ public final class URISpecification { | |||
} else { | |||
try { | |||
byte[] utf8 = Character.toString(ch).getBytes("UTF-8"); | |||
for (int j = 0, cj = utf8.length; j < cj; j++) { | |||
appendEscape(sb, utf8[j]); | |||
for (byte anUtf8 : utf8) { | |||
appendEscape(sb, anUtf8); | |||
} | |||
} catch (UnsupportedEncodingException e) { | |||
throw new Error("Incompatible JVM. UTF-8 not supported."); |
@@ -121,8 +121,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
/** Integrates the border-after of the part. */ | |||
void resolveBordersLastRowInPart(List/*<GridUnit>*/ row, boolean withNormal, | |||
boolean withLeadingTrailing, boolean withRest) { | |||
for (int i = 0; i < row.size(); i++) { | |||
((GridUnit) row.get(i)).integrateBorderSegment(CommonBorderPaddingBackground.AFTER, | |||
for (Object aRow : row) { | |||
((GridUnit) aRow).integrateBorderSegment(CommonBorderPaddingBackground.AFTER, | |||
tablePart, withNormal, withLeadingTrailing, withRest); | |||
} | |||
} | |||
@@ -203,8 +203,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
// Resolve before- and after-borders for the table-row | |||
if (container instanceof TableRow) { | |||
TableRow tableRow = (TableRow) container; | |||
for (Iterator iter = row.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object aRow : row) { | |||
GridUnit gu = (GridUnit) aRow; | |||
boolean first = (gu.getRowSpanIndex() == 0); | |||
boolean last = gu.isLastGridUnitRowSpan(); | |||
gu.integrateBorderSegment(CommonBorderPaddingBackground.BEFORE, tableRow, | |||
@@ -219,8 +219,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
} | |||
if (firstInPart) { | |||
// Integrate the border-before of the part | |||
for (int i = 0; i < row.size(); i++) { | |||
((GridUnit) row.get(i)).integrateBorderSegment( | |||
for (Object aRow : row) { | |||
((GridUnit) aRow).integrateBorderSegment( | |||
CommonBorderPaddingBackground.BEFORE, tablePart, true, true, true); | |||
} | |||
firstInPart = false; | |||
@@ -269,8 +269,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
* To represent those values we (ab)use the normal and the rest fields of | |||
* ConditionalBorder. But strictly speaking this is not their purposes. | |||
*/ | |||
for (Iterator guIter = row.iterator(); guIter.hasNext();) { | |||
ConditionalBorder borderBefore = ((GridUnit) guIter.next()).borderBefore; | |||
for (Object aRow : row) { | |||
ConditionalBorder borderBefore = ((GridUnit) aRow).borderBefore; | |||
borderBefore.leadingTrailing = borderBefore.normal; | |||
borderBefore.rest = borderBefore.normal; | |||
} | |||
@@ -291,8 +291,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
* grid units from the body will always resolve against the same, normal | |||
* header border. | |||
*/ | |||
for (Iterator guIter = previousRow.iterator(); guIter.hasNext();) { | |||
ConditionalBorder borderAfter = ((GridUnit) guIter.next()).borderAfter; | |||
for (Object aPreviousRow : previousRow) { | |||
ConditionalBorder borderAfter = ((GridUnit) aPreviousRow).borderAfter; | |||
borderAfter.leadingTrailing = borderAfter.normal; | |||
borderAfter.rest = borderAfter.normal; | |||
leadingBorders.add(borderAfter); | |||
@@ -324,8 +324,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
resolveBordersLastRowInPart(footerLastRow, true, true, true); | |||
trailingBorders = new ArrayList(table.getNumberOfColumns()); | |||
// See same method in ResolverInHeader for an explanation of the hack | |||
for (Iterator guIter = footerFirstRow.iterator(); guIter.hasNext();) { | |||
ConditionalBorder borderBefore = ((GridUnit) guIter.next()).borderBefore; | |||
for (Object aFooterFirstRow : footerFirstRow) { | |||
ConditionalBorder borderBefore = ((GridUnit) aFooterFirstRow).borderBefore; | |||
borderBefore.leadingTrailing = borderBefore.normal; | |||
borderBefore.rest = borderBefore.normal; | |||
trailingBorders.add(borderBefore); | |||
@@ -337,8 +337,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
// first row of table-footer | |||
resolveBordersBetweenRows(previousRow, footerFirstRow); | |||
// See endRow method in ResolverInHeader for an explanation of the hack | |||
for (Iterator guIter = footerLastRow.iterator(); guIter.hasNext();) { | |||
ConditionalBorder borderAfter = ((GridUnit) guIter.next()).borderAfter; | |||
for (Object aFooterLastRow : footerLastRow) { | |||
ConditionalBorder borderAfter = ((GridUnit) aFooterLastRow).borderAfter; | |||
borderAfter.leadingTrailing = borderAfter.normal; | |||
borderAfter.rest = borderAfter.normal; | |||
} | |||
@@ -364,8 +364,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
previousRow = row; | |||
if (firstInBody) { | |||
firstInBody = false; | |||
for (Iterator iter = row.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object aRow : row) { | |||
GridUnit gu = (GridUnit) aRow; | |||
gu.borderBefore.leadingTrailing = gu.borderBefore.normal; | |||
} | |||
} | |||
@@ -378,8 +378,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
// Trailing and rest borders already resolved with integrateTrailingBorders | |||
resolveBordersLastRowInTable(previousRow, true, false, false); | |||
} | |||
for (Iterator iter = previousRow.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object aPreviousRow : previousRow) { | |||
GridUnit gu = (GridUnit) aPreviousRow; | |||
gu.borderAfter.leadingTrailing = gu.borderAfter.normal; | |||
} | |||
} | |||
@@ -422,8 +422,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
if (leadingBorders == null || table.omitHeaderAtBreak()) { | |||
// No header, leading borders determined by the table | |||
leadingBorders = new ArrayList(table.getNumberOfColumns()); | |||
for (Iterator colIter = table.getColumns().iterator(); colIter.hasNext();) { | |||
ConditionalBorder border = ((TableColumn) colIter.next()).borderBefore; | |||
for (Object o : table.getColumns()) { | |||
ConditionalBorder border = ((TableColumn) o).borderBefore; | |||
leadingBorders.add(border); | |||
} | |||
} | |||
@@ -434,8 +434,8 @@ class CollapsingBorderResolver implements BorderResolver { | |||
if (trailingBorders == null || table.omitFooterAtBreak()) { | |||
// No footer, trailing borders determined by the table | |||
trailingBorders = new ArrayList(table.getNumberOfColumns()); | |||
for (Iterator colIter = table.getColumns().iterator(); colIter.hasNext();) { | |||
ConditionalBorder border = ((TableColumn) colIter.next()).borderAfter; | |||
for (Object o : table.getColumns()) { | |||
ConditionalBorder border = ((TableColumn) o).borderAfter; | |||
trailingBorders.add(border); | |||
} | |||
} | |||
@@ -456,14 +456,14 @@ class CollapsingBorderResolver implements BorderResolver { | |||
delegate = null; | |||
/* TODO Temporary hack for resolved borders in header */ | |||
if (headerLastRow != null) { | |||
for (Iterator iter = headerLastRow.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object aHeaderLastRow : headerLastRow) { | |||
GridUnit gu = (GridUnit) aHeaderLastRow; | |||
gu.borderAfter.leadingTrailing = gu.borderAfter.normal; | |||
} | |||
} | |||
if (footerLastRow != null) { | |||
for (Iterator iter = footerLastRow.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object aFooterLastRow : footerLastRow) { | |||
GridUnit gu = (GridUnit) aFooterLastRow; | |||
gu.borderAfter.leadingTrailing = gu.borderAfter.normal; | |||
} | |||
} |
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.fop.fo.Constants; | |||
@@ -57,8 +56,7 @@ public class EffRow { | |||
this.bodyType = bodyType; | |||
this.gridUnits = gridUnits; | |||
// TODO this is ugly, but we may eventually be able to do without that index | |||
for (Iterator guIter = gridUnits.iterator(); guIter.hasNext();) { | |||
Object gu = guIter.next(); | |||
for (Object gu : gridUnits) { | |||
if (gu instanceof PrimaryGridUnit) { | |||
((PrimaryGridUnit) gu).setRowIndex(index); | |||
} | |||
@@ -175,8 +173,8 @@ public class EffRow { | |||
if (row != null) { | |||
keep = Keep.getKeep(row.getKeepWithPrevious()); | |||
} | |||
for (Iterator iter = gridUnits.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object gridUnit : gridUnits) { | |||
GridUnit gu = (GridUnit) gridUnit; | |||
if (gu.isPrimary()) { | |||
keep = keep.compare(gu.getPrimary().getKeepWithPrevious()); | |||
} | |||
@@ -196,8 +194,8 @@ public class EffRow { | |||
if (row != null) { | |||
keep = Keep.getKeep(row.getKeepWithNext()); | |||
} | |||
for (Iterator iter = gridUnits.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object gridUnit : gridUnits) { | |||
GridUnit gu = (GridUnit) gridUnit; | |||
if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) { | |||
keep = keep.compare(gu.getPrimary().getKeepWithNext()); | |||
} | |||
@@ -233,8 +231,8 @@ public class EffRow { | |||
*/ | |||
public int getBreakBefore() { | |||
int breakBefore = Constants.EN_AUTO; | |||
for (Iterator iter = gridUnits.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object gridUnit : gridUnits) { | |||
GridUnit gu = (GridUnit) gridUnit; | |||
if (gu.isPrimary()) { | |||
breakBefore = BreakUtil.compareBreakClasses(breakBefore, | |||
gu.getPrimary().getBreakBefore()); | |||
@@ -257,8 +255,8 @@ public class EffRow { | |||
*/ | |||
public int getBreakAfter() { | |||
int breakAfter = Constants.EN_AUTO; | |||
for (Iterator iter = gridUnits.iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object gridUnit : gridUnits) { | |||
GridUnit gu = (GridUnit) gridUnit; | |||
if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) { | |||
breakAfter = BreakUtil.compareBreakClasses(breakAfter, | |||
gu.getPrimary().getBreakAfter()); |
@@ -20,9 +20,7 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.ListIterator; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.ValidationException; | |||
@@ -106,8 +104,8 @@ class FixedColRowGroupBuilder extends RowGroupBuilder { | |||
} | |||
private static void setFlagForCols(int flag, List row) { | |||
for (ListIterator iter = row.listIterator(); iter.hasNext();) { | |||
((GridUnit) iter.next()).setFlag(flag); | |||
for (Object aRow : row) { | |||
((GridUnit) aRow).setFlag(flag); | |||
} | |||
} | |||
@@ -132,8 +130,8 @@ class FixedColRowGroupBuilder extends RowGroupBuilder { | |||
eventProducer.breakIgnoredDueToRowSpanning(this, currentTableRow.getName(), false, | |||
currentTableRow.getLocator()); | |||
} | |||
for (Iterator iter = ((List) rows.get(currentRowIndex)).iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object o : ((List) rows.get(currentRowIndex))) { | |||
GridUnit gu = (GridUnit) o; | |||
// The row hasn't been filled with empty grid units yet | |||
if (gu != null) { | |||
gu.setRow(currentTableRow); |
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.fo.flow.table; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
@@ -112,8 +111,8 @@ class VariableColRowGroupBuilder extends RowGroupBuilder { | |||
/** {@inheritDoc} */ | |||
void endTable() throws ValidationException { | |||
RowGroupBuilder delegate = new FixedColRowGroupBuilder(table); | |||
for (Iterator eventIter = events.iterator(); eventIter.hasNext();) { | |||
((Event) eventIter.next()).play(delegate); | |||
for (Object event : events) { | |||
((Event) event).play(delegate); | |||
} | |||
delegate.endTable(); | |||
} |
@@ -64,8 +64,8 @@ public class DimensionPropertyMaker extends CorrespondingPropertyMaker { | |||
if (super.isCorrespondingForced(propertyList)) { | |||
return true; | |||
} | |||
for (int i = 0; i < extraCorresponding.length; i++) { | |||
int wmcorr = extraCorresponding[i][0]; //propertyList.getWritingMode()]; | |||
for (int[] anExtraCorresponding : extraCorresponding) { | |||
int wmcorr = anExtraCorresponding[0]; //propertyList.getWritingMode()]; | |||
if (propertyList.getExplicit(wmcorr) != null) { | |||
return true; | |||
} |
@@ -53,9 +53,7 @@ public class CustomFontCollection implements FontCollection { | |||
String internalName = null; | |||
for (int i = 0; i < embedFontInfoList.size(); i++) { | |||
EmbedFontInfo embedFontInfo = embedFontInfoList.get(i); | |||
for (EmbedFontInfo embedFontInfo : embedFontInfoList) { | |||
internalName = "F" + num; | |||
num++; | |||
@@ -63,8 +61,7 @@ public class CustomFontCollection implements FontCollection { | |||
fontInfo.addMetrics(internalName, font); | |||
List<FontTriplet> triplets = embedFontInfo.getFontTriplets(); | |||
for (int tripletIndex = 0; tripletIndex < triplets.size(); tripletIndex++) { | |||
FontTriplet triplet = triplets.get(tripletIndex); | |||
for (FontTriplet triplet : triplets) { | |||
fontInfo.addFontProperties(internalName, triplet); | |||
} | |||
} |
@@ -179,8 +179,7 @@ public class DefaultFontConfigurator implements FontConfigurator<EmbedFontInfo> | |||
URI embedFile = embedFontInfo.getEmbedURI(); | |||
log.debug("Adding font " + (embedFile != null ? embedFile + ", " : "") | |||
+ "metrics URI " + embedFontInfo.getMetricsURI()); | |||
for (int j = 0; j < tripletList.size(); ++j) { | |||
FontTriplet triplet = tripletList.get(j); | |||
for (FontTriplet triplet : tripletList) { | |||
log.debug(" Font triplet " | |||
+ triplet.getName() + ", " | |||
+ triplet.getStyle() + ", " |
@@ -64,8 +64,7 @@ public class FontAdder { | |||
if (embedFontInfos == null) { | |||
continue; | |||
} | |||
for (int i = 0, c = embedFontInfos.length; i < c; i++) { | |||
EmbedFontInfo fontInfo = embedFontInfos[i]; | |||
for (EmbedFontInfo fontInfo : embedFontInfos) { | |||
if (fontInfo != null) { | |||
fontInfoList.add(fontInfo); | |||
} |
@@ -284,8 +284,7 @@ public final class FontCache implements Serializable { | |||
* @return file font file | |||
*/ | |||
public static File getFileFromUrls(String[] urls) { | |||
for (int i = 0; i < urls.length; i++) { | |||
String urlStr = urls[i]; | |||
for (String urlStr : urls) { | |||
if (urlStr != null) { | |||
File fontFile = null; | |||
if (urlStr.startsWith("file:")) { |
@@ -113,8 +113,8 @@ public class FontInfo { | |||
* @param weight font weight | |||
*/ | |||
public void addFontProperties(String name, String[] families, String style, int weight) { | |||
for (int i = 0; i < families.length; i++) { | |||
addFontProperties(name, families[i], style, weight); | |||
for (String family : families) { | |||
addFontProperties(name, family, style, weight); | |||
} | |||
} | |||
@@ -382,8 +382,8 @@ public class FontInfo { | |||
private List<FontTriplet> fontLookup(String[] families, String style, int weight, boolean substitutable) { | |||
List<FontTriplet> matchingTriplets = new ArrayList<FontTriplet>(); | |||
FontTriplet triplet = null; | |||
for (int i = 0; i < families.length; i++) { | |||
triplet = fontLookup(families[i], style, weight, substitutable); | |||
for (String family : families) { | |||
triplet = fontLookup(family, style, weight, substitutable); | |||
if (triplet != null) { | |||
matchingTriplets.add(triplet); | |||
} |
@@ -159,8 +159,8 @@ public class FontManager { | |||
public void setup(FontInfo fontInfo, FontCollection[] fontCollections) { | |||
int startNum = 1; | |||
for (int i = 0, c = fontCollections.length; i < c; i++) { | |||
startNum = fontCollections[i].setup(startNum, fontInfo); | |||
for (FontCollection fontCollection : fontCollections) { | |||
startNum = fontCollection.setup(startNum, fontInfo); | |||
} | |||
// Make any defined substitutions in the font info | |||
getFontSubstitutions().adjustFontInfo(fontInfo); |
@@ -147,10 +147,10 @@ public class FontManagerConfigurator { | |||
Configuration cfg, boolean strict) throws FOPException { | |||
List<FontTriplet.Matcher> matcherList = new java.util.ArrayList<FontTriplet.Matcher>(); | |||
Configuration[] matches = cfg.getChildren("match"); | |||
for (int i = 0; i < matches.length; i++) { | |||
for (Configuration matche : matches) { | |||
try { | |||
matcherList.add(new FontFamilyRegExFontTripletMatcher( | |||
matches[i].getAttribute("font-family"))); | |||
matche.getAttribute("font-family"))); | |||
} catch (ConfigurationException ce) { | |||
LogUtil.handleException(log, ce, strict); | |||
continue; | |||
@@ -189,8 +189,8 @@ public class FontManagerConfigurator { | |||
/** {@inheritDoc} */ | |||
public boolean matches(FontTriplet triplet) { | |||
for (int i = 0, c = matchers.length; i < c; i++) { | |||
if (matchers[i].matches(triplet)) { | |||
for (FontTriplet.Matcher matcher : matchers) { | |||
if (matcher.matches(triplet)) { | |||
return true; | |||
} | |||
} |
@@ -40,8 +40,8 @@ public final class FontSelector { | |||
CommonFont commonFont, PercentBaseContext context) { | |||
FontInfo fi = fonode.getFOEventHandler().getFontInfo(); | |||
FontTriplet[] fontkeys = commonFont.getFontState(fi); | |||
for (int i = 0; i < fontkeys.length; i++) { | |||
Font font = fi.getFontInstance(fontkeys[i], commonFont.fontSize | |||
for (FontTriplet fontkey : fontkeys) { | |||
Font font = fi.getFontInstance(fontkey, commonFont.fontSize | |||
.getValue(context)); | |||
if (font.hasChar(c)) { | |||
return font; |
@@ -208,8 +208,7 @@ public final class FontSetup { | |||
fontInfo.addMetrics(internalName, font); | |||
List<FontTriplet> triplets = embedFontInfo.getFontTriplets(); | |||
for (int tripletIndex = 0; tripletIndex < triplets.size(); tripletIndex++) { | |||
FontTriplet triplet = triplets.get(tripletIndex); | |||
for (FontTriplet triplet : triplets) { | |||
fontInfo.addFontProperties(internalName, triplet); | |||
} | |||
} |
@@ -104,8 +104,8 @@ public final class FontUtil { | |||
*/ | |||
public static String guessStyle(String fontName) { | |||
if (fontName != null) { | |||
for (int i = 0; i < ITALIC_WORDS.length; i++) { | |||
if (fontName.indexOf(ITALIC_WORDS[i]) != -1) { | |||
for (String word : ITALIC_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
return Font.STYLE_ITALIC; | |||
} | |||
} | |||
@@ -122,34 +122,34 @@ public final class FontUtil { | |||
// weight | |||
int weight = Font.WEIGHT_NORMAL; | |||
for (int i = 0; i < BOLD_WORDS.length; i++) { | |||
if (fontName.indexOf(BOLD_WORDS[i]) != -1) { | |||
for (String word : BOLD_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
weight = Font.WEIGHT_BOLD; | |||
break; | |||
} | |||
} | |||
for (int i = 0; i < MEDIUM_WORDS.length; i++) { | |||
if (fontName.indexOf(MEDIUM_WORDS[i]) != -1) { | |||
for (String word : MEDIUM_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
weight = Font.WEIGHT_NORMAL + 100; //500 | |||
break; | |||
} | |||
} | |||
//Search for "semi/demi" before "light", but after "bold" | |||
//(normally semi/demi-bold is meant, but it can also be semi/demi-light) | |||
for (int i = 0; i < DEMI_WORDS.length; i++) { | |||
if (fontName.indexOf(DEMI_WORDS[i]) != -1) { | |||
for (String word : DEMI_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
weight = Font.WEIGHT_BOLD - 100; //600 | |||
break; | |||
} | |||
} | |||
for (int i = 0; i < EXTRA_BOLD_WORDS.length; i++) { | |||
if (fontName.indexOf(EXTRA_BOLD_WORDS[i]) != -1) { | |||
for (String word : EXTRA_BOLD_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
weight = Font.WEIGHT_EXTRA_BOLD; | |||
break; | |||
} | |||
} | |||
for (int i = 0; i < LIGHT_WORDS.length; i++) { | |||
if (fontName.indexOf(LIGHT_WORDS[i]) != -1) { | |||
for (String word : LIGHT_WORDS) { | |||
if (fontName.indexOf(word) != -1) { | |||
weight = Font.WEIGHT_LIGHT; | |||
break; | |||
} |
@@ -588,10 +588,9 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl | |||
private int[][] scaleAdjustments(int[][] adjustments, int fontSize) { | |||
if (adjustments != null) { | |||
for (int i = 0, n = adjustments.length; i < n; i++) { | |||
int[] gpa = adjustments [ i ]; | |||
for (int[] gpa : adjustments) { | |||
for (int k = 0; k < 4; k++) { | |||
gpa [ k ] = (gpa [ k ] * fontSize) / 1000; | |||
gpa[k] = (gpa[k] * fontSize) / 1000; | |||
} | |||
} | |||
return adjustments; | |||
@@ -710,9 +709,9 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl | |||
for (int i = 0, n = cs.length(); i < n; i++) { | |||
int cc = cs.charAt(i); | |||
int[] da = CharNormalize.decompose(cc, daBuffer); | |||
for (int j = 0; j < da.length; j++) { | |||
if (da[j] > 0) { | |||
sb.append((char) da[j]); | |||
for (int aDa : da) { | |||
if (aDa > 0) { | |||
sb.append((char) aDa); | |||
} else { | |||
break; | |||
} | |||
@@ -752,8 +751,7 @@ public class MultiByteFont extends CIDFont implements Substitutable, Positionabl | |||
private static boolean hasElidableControl(GlyphSequence gs) { | |||
int[] ca = gs.getCharacterArray(false); | |||
for (int i = 0, n = ca.length; i < n; ++i) { | |||
int ch = ca [ i ]; | |||
for (int ch : ca) { | |||
if (isElidableControl(ch)) { | |||
return true; | |||
} |
@@ -172,12 +172,12 @@ public class SingleByteFont extends CustomFont { | |||
String charName = Glyphs.charToGlyphName(c); | |||
String[] charNameAlternatives = Glyphs.getCharNameAlternativesFor(charName); | |||
if (charNameAlternatives != null && charNameAlternatives.length > 0) { | |||
for (int i = 0; i < charNameAlternatives.length; i++) { | |||
for (String charNameAlternative : charNameAlternatives) { | |||
if (log.isDebugEnabled()) { | |||
log.debug("Checking alternative for char " + c + " (charname=" | |||
+ charName + "): " + charNameAlternatives[i]); | |||
+ charName + "): " + charNameAlternative); | |||
} | |||
String s = Glyphs.getUnicodeSequenceForGlyphName(charNameAlternatives[i]); | |||
String s = Glyphs.getUnicodeSequenceForGlyphName(charNameAlternative); | |||
if (s != null) { | |||
d = lookupChar(s.charAt(0)); | |||
if (d != SingleByteEncoding.NOT_FOUND_CODE_POINT) { |
@@ -290,8 +290,8 @@ public class XMLFontMetricsReader extends DefaultHandler { | |||
} else if ("cid-widths".equals(localName)) { | |||
int[] wds = new int[cidWidths.size()]; | |||
int j = 0; | |||
for (int count = 0; count < cidWidths.size(); count++) { | |||
wds[j++] = cidWidths.get(count); | |||
for (Integer cidWidth : cidWidths) { | |||
wds[j++] = cidWidth; | |||
} | |||
//multiFont.addCIDWidthEntry(cidWidthIndex, wds); |
@@ -36,8 +36,8 @@ public abstract class NativeFontDirFinder implements FontDirFinder { | |||
List<File> fontDirList = new java.util.ArrayList<File>(); | |||
String[] searchableDirectories = getSearchableDirectories(); | |||
if (searchableDirectories != null) { | |||
for (int i = 0; i < searchableDirectories.length; i++) { | |||
File fontDir = new File(searchableDirectories[i]); | |||
for (String searchableDirectory : searchableDirectories) { | |||
File fontDir = new File(searchableDirectory); | |||
if (fontDir.exists() && fontDir.canRead()) { | |||
fontDirList.add(fontDir); | |||
} |
@@ -19,7 +19,6 @@ | |||
package org.apache.fop.fonts.substitute; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Set; | |||
@@ -86,10 +85,9 @@ public class FontQualifier { | |||
public void setFontWeight(String fontWeight) { | |||
AttributeValue fontWeightAttribute = AttributeValue.valueOf(fontWeight); | |||
if (fontWeightAttribute != null) { | |||
for (Iterator it = fontWeightAttribute.iterator(); it.hasNext();) { | |||
Object weightObj = it.next(); | |||
for (Object weightObj : fontWeightAttribute) { | |||
if (weightObj instanceof String) { | |||
String weightString = ((String)weightObj).trim(); | |||
String weightString = ((String) weightObj).trim(); | |||
try { | |||
FontUtil.parseCSS2FontWeight(weightString); | |||
} catch (IllegalArgumentException ex) { | |||
@@ -157,14 +155,13 @@ public class FontQualifier { | |||
List/*<FontTriplet>*/ matchingTriplets = new java.util.ArrayList/*<FontTriplet>*/(); | |||
// try to find matching destination font triplet | |||
for (Iterator attrIt = fontFamilyValue.iterator(); attrIt.hasNext();) { | |||
String fontFamilyString = (String)attrIt.next(); | |||
Map/*<FontTriplet>*/ triplets = (Map/*<FontTriplet>*/)fontInfo.getFontTriplets(); | |||
for (Object aFontFamilyValue : fontFamilyValue) { | |||
String fontFamilyString = (String) aFontFamilyValue; | |||
Map/*<FontTriplet>*/ triplets = (Map/*<FontTriplet>*/) fontInfo.getFontTriplets(); | |||
if (triplets != null) { | |||
Set/*<FontTriplet>*/ tripletSet = triplets.keySet(); | |||
for (Iterator/*<FontTriplet>*/ tripletIt = tripletSet.iterator(); | |||
tripletIt.hasNext();) { | |||
FontTriplet triplet = (FontTriplet)tripletIt.next(); | |||
for (Object aTripletSet : tripletSet) { | |||
FontTriplet triplet = (FontTriplet) aTripletSet; | |||
String fontName = triplet.getName(); | |||
// matched font family name | |||
@@ -173,22 +170,21 @@ public class FontQualifier { | |||
// try and match font weight | |||
boolean weightMatched = false; | |||
int fontWeight = triplet.getWeight(); | |||
for (Iterator weightIt = weightValue.iterator(); weightIt.hasNext();) { | |||
Object weightObj = weightIt.next(); | |||
for (Object weightObj : weightValue) { | |||
if (weightObj instanceof FontWeightRange) { | |||
FontWeightRange intRange = (FontWeightRange)weightObj; | |||
FontWeightRange intRange = (FontWeightRange) weightObj; | |||
if (intRange.isWithinRange(fontWeight)) { | |||
weightMatched = true; | |||
} | |||
} else if (weightObj instanceof String) { | |||
String fontWeightString = (String)weightObj; | |||
String fontWeightString = (String) weightObj; | |||
int fontWeightValue = FontUtil.parseCSS2FontWeight( | |||
fontWeightString); | |||
if (fontWeightValue == fontWeight) { | |||
weightMatched = true; | |||
} | |||
} else if (weightObj instanceof Integer) { | |||
Integer fontWeightInteger = (Integer)weightObj; | |||
Integer fontWeightInteger = (Integer) weightObj; | |||
int fontWeightValue = fontWeightInteger; | |||
if (fontWeightValue == fontWeight) { | |||
weightMatched = true; | |||
@@ -199,8 +195,8 @@ public class FontQualifier { | |||
// try and match font style | |||
boolean styleMatched = false; | |||
String fontStyleString = triplet.getStyle(); | |||
for (Iterator styleIt = styleValue.iterator(); styleIt.hasNext();) { | |||
String style = (String)styleIt.next(); | |||
for (Object aStyleValue : styleValue) { | |||
String style = (String) aStyleValue; | |||
if (fontStyleString.equals(style)) { | |||
styleMatched = true; | |||
} | |||
@@ -227,8 +223,8 @@ public class FontQualifier { | |||
if (matchingTriplets.size() == 1) { | |||
bestTriplet = (FontTriplet)matchingTriplets.get(0); | |||
} else { | |||
for (Iterator iterator = matchingTriplets.iterator(); iterator.hasNext();) { | |||
FontTriplet triplet = (FontTriplet)iterator.next(); | |||
for (Object matchingTriplet : matchingTriplets) { | |||
FontTriplet triplet = (FontTriplet) matchingTriplet; | |||
if (bestTriplet == null) { | |||
bestTriplet = triplet; | |||
} else { | |||
@@ -249,29 +245,27 @@ public class FontQualifier { | |||
List/*<FontTriplet>*/ triplets = new java.util.ArrayList/*<FontTriplet>*/(); | |||
AttributeValue fontFamilyValue = getFontFamily(); | |||
for (Iterator fontFamilyIt = fontFamilyValue.iterator(); fontFamilyIt.hasNext();) { | |||
String name = (String)fontFamilyIt.next(); | |||
for (Object aFontFamilyValue : fontFamilyValue) { | |||
String name = (String) aFontFamilyValue; | |||
AttributeValue styleValue = getFontStyle(); | |||
for (Iterator styleIt = styleValue.iterator(); styleIt.hasNext();) { | |||
String style = (String)styleIt.next(); | |||
for (Object aStyleValue : styleValue) { | |||
String style = (String) aStyleValue; | |||
AttributeValue weightValue = getFontWeight(); | |||
for (Iterator weightIt = weightValue.iterator(); weightIt.hasNext();) { | |||
Object weightObj = weightIt.next(); | |||
for (Object weightObj : weightValue) { | |||
if (weightObj instanceof FontWeightRange) { | |||
FontWeightRange fontWeightRange = (FontWeightRange)weightObj; | |||
FontWeightRange fontWeightRange = (FontWeightRange) weightObj; | |||
int[] weightRange = fontWeightRange.toArray(); | |||
for (int i = 0; i < weightRange.length; i++) { | |||
triplets.add(new FontTriplet(name, style, weightRange[i])); | |||
for (int aWeightRange : weightRange) { | |||
triplets.add(new FontTriplet(name, style, aWeightRange)); | |||
} | |||
} else if (weightObj instanceof String) { | |||
String weightString = (String)weightObj; | |||
String weightString = (String) weightObj; | |||
int weight = FontUtil.parseCSS2FontWeight(weightString); | |||
triplets.add(new FontTriplet(name, style, weight)); | |||
} else if (weightObj instanceof Integer) { | |||
Integer weightInteger = (Integer)weightObj; | |||
Integer weightInteger = (Integer) weightObj; | |||
int weight = weightInteger; | |||
triplets.add(new FontTriplet(name, style, weight)); | |||
} |
@@ -58,8 +58,8 @@ public class FontSubstitutions extends java.util.ArrayList/*<Substitutions>*/ { | |||
FontQualifier fromQualifier = substitution.getFromQualifier(); | |||
List/*<FontTriplet>*/ tripletList = fromQualifier.getTriplets(); | |||
for (Iterator tripletit = tripletList.iterator(); tripletit.hasNext();) { | |||
FontTriplet triplet = (FontTriplet) tripletit.next(); | |||
for (Object aTripletList : tripletList) { | |||
FontTriplet triplet = (FontTriplet) aTripletList; | |||
fontInfo.addFontProperties(internalFontKey, triplet); | |||
} | |||
} |
@@ -66,12 +66,12 @@ public class FontSubstitutionsConfigurator { | |||
*/ | |||
public void configure(FontSubstitutions substitutions) throws FOPException { | |||
Configuration[] substitutionCfgs = cfg.getChildren("substitution"); | |||
for (int i = 0; i < substitutionCfgs.length; i++) { | |||
Configuration fromCfg = substitutionCfgs[i].getChild("from", false); | |||
for (Configuration substitutionCfg : substitutionCfgs) { | |||
Configuration fromCfg = substitutionCfg.getChild("from", false); | |||
if (fromCfg == null) { | |||
throw new FOPException("'substitution' element without child 'from' element"); | |||
} | |||
Configuration toCfg = substitutionCfgs[i].getChild("to", false); | |||
Configuration toCfg = substitutionCfg.getChild("to", false); | |||
if (fromCfg == null) { | |||
throw new FOPException("'substitution' element without child 'to' element"); | |||
} |
@@ -1504,30 +1504,30 @@ public abstract class OpenFont { | |||
int localXHeight = 0; | |||
int localAscender = 0; | |||
int localDescender = 0; | |||
for (int i = 0; i < mtxTab.length; i++) { | |||
if ("H".equals(mtxTab[i].getName())) { | |||
localCapHeight = mtxTab[i].getBoundingBox()[3]; | |||
} else if ("x".equals(mtxTab[i].getName())) { | |||
localXHeight = mtxTab[i].getBoundingBox()[3]; | |||
} else if ("d".equals(mtxTab[i].getName())) { | |||
localAscender = mtxTab[i].getBoundingBox()[3]; | |||
} else if ("p".equals(mtxTab[i].getName())) { | |||
localDescender = mtxTab[i].getBoundingBox()[1]; | |||
for (OFMtxEntry aMtxTab : mtxTab) { | |||
if ("H".equals(aMtxTab.getName())) { | |||
localCapHeight = aMtxTab.getBoundingBox()[3]; | |||
} else if ("x".equals(aMtxTab.getName())) { | |||
localXHeight = aMtxTab.getBoundingBox()[3]; | |||
} else if ("d".equals(aMtxTab.getName())) { | |||
localAscender = aMtxTab.getBoundingBox()[3]; | |||
} else if ("p".equals(aMtxTab.getName())) { | |||
localDescender = aMtxTab.getBoundingBox()[1]; | |||
} else { | |||
// OpenType Fonts with a version 3.0 "post" table don't have glyph names. | |||
// Use Unicode indices instead. | |||
List unicodeIndex = mtxTab[i].getUnicodeIndex(); | |||
List unicodeIndex = aMtxTab.getUnicodeIndex(); | |||
if (unicodeIndex.size() > 0) { | |||
//Only the first index is used | |||
char ch = (char)((Integer)unicodeIndex.get(0)).intValue(); | |||
char ch = (char) ((Integer) unicodeIndex.get(0)).intValue(); | |||
if (ch == 'H') { | |||
localCapHeight = mtxTab[i].getBoundingBox()[3]; | |||
localCapHeight = aMtxTab.getBoundingBox()[3]; | |||
} else if (ch == 'x') { | |||
localXHeight = mtxTab[i].getBoundingBox()[3]; | |||
localXHeight = aMtxTab.getBoundingBox()[3]; | |||
} else if (ch == 'd') { | |||
localAscender = mtxTab[i].getBoundingBox()[3]; | |||
localAscender = aMtxTab.getBoundingBox()[3]; | |||
} else if (ch == 'p') { | |||
localDescender = mtxTab[i].getBoundingBox()[1]; | |||
localDescender = aMtxTab.getBoundingBox()[1]; | |||
} | |||
} | |||
} | |||
@@ -1640,8 +1640,8 @@ public abstract class OpenFont { | |||
while (uniMap.hasNext()) { | |||
Integer unicodeKey = (Integer)uniMap.next(); | |||
Integer[] ansiKeys = unicodeToWinAnsi(unicodeKey); | |||
for (int u = 0; u < ansiKeys.length; u++) { | |||
akpx.put(ansiKeys[u], kern); | |||
for (Integer ansiKey : ansiKeys) { | |||
akpx.put(ansiKey, kern); | |||
} | |||
} | |||
} | |||
@@ -1651,8 +1651,8 @@ public abstract class OpenFont { | |||
while (uniMap.hasNext()) { | |||
Integer unicodeKey = (Integer)uniMap.next(); | |||
Integer[] ansiKeys = unicodeToWinAnsi(unicodeKey); | |||
for (int u = 0; u < ansiKeys.length; u++) { | |||
ansiKerningTab.put(ansiKeys[u], akpx); | |||
for (Integer ansiKey : ansiKeys) { | |||
ansiKerningTab.put(ansiKey, akpx); | |||
} | |||
} | |||
} |
@@ -264,9 +264,9 @@ public class HyphenationTree extends TernaryTree implements PatternConsumer { | |||
if (hstrcmp(word, i, kv.getArray(), lo[p]) == 0) { | |||
values = getValues(eq[p]); // data pointer is in eq[] | |||
int j = index; | |||
for (int k = 0; k < values.length; k++) { | |||
if (j < il.length && values[k] > il[j]) { | |||
il[j] = values[k]; | |||
for (byte value : values) { | |||
if (j < il.length && value > il[j]) { | |||
il[j] = value; | |||
} | |||
j++; | |||
} | |||
@@ -291,9 +291,9 @@ public class HyphenationTree extends TernaryTree implements PatternConsumer { | |||
if (sc[q] == 0) { | |||
values = getValues(eq[q]); | |||
int j = index; | |||
for (int k = 0; k < values.length; k++) { | |||
if (j < il.length && values[k] > il[j]) { | |||
il[j] = values[k]; | |||
for (byte value : values) { | |||
if (j < il.length && value > il[j]) { | |||
il[j] = value; | |||
} | |||
j++; | |||
} |
@@ -195,10 +195,9 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { | |||
private ArrayList normalizeException(ArrayList ex) { | |||
ArrayList res = new ArrayList(); | |||
for (int i = 0; i < ex.size(); i++) { | |||
Object item = ex.get(i); | |||
for (Object item : ex) { | |||
if (item instanceof String) { | |||
String str = (String)item; | |||
String str = (String) item; | |||
StringBuffer buf = new StringBuffer(); | |||
for (int j = 0; j < str.length(); j++) { | |||
char c = str.charAt(j); | |||
@@ -226,13 +225,12 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { | |||
private String getExceptionWord(ArrayList ex) { | |||
StringBuffer res = new StringBuffer(); | |||
for (int i = 0; i < ex.size(); i++) { | |||
Object item = ex.get(i); | |||
for (Object item : ex) { | |||
if (item instanceof String) { | |||
res.append((String)item); | |||
res.append((String) item); | |||
} else { | |||
if (((Hyphen)item).noBreak != null) { | |||
res.append(((Hyphen)item).noBreak); | |||
if (((Hyphen) item).noBreak != null) { | |||
res.append(((Hyphen) item).noBreak); | |||
} | |||
} | |||
} |
@@ -409,9 +409,9 @@ public final class SpaceResolver { | |||
private MinOptMax sum(MinOptMax[] lengths) { | |||
MinOptMax sum = MinOptMax.ZERO; | |||
for (int i = 0; i < lengths.length; i++) { | |||
if (lengths[i] != null) { | |||
sum = sum.plus(lengths[i]); | |||
for (MinOptMax length : lengths) { | |||
if (length != null) { | |||
sum = sum.plus(length); | |||
} | |||
} | |||
return sum; |
@@ -20,7 +20,6 @@ | |||
package org.apache.fop.layoutmgr.inline; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import java.util.ListIterator; | |||
@@ -270,8 +269,8 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager | |||
Object obj = returnedList.remove(0); | |||
if (obj instanceof KnuthSequence) { | |||
KnuthSequence ks = (KnuthSequence)obj; | |||
for (Iterator it = ks.iterator(); it.hasNext();) { | |||
contentElement = (KnuthElement)it.next(); | |||
for (Object k : ks) { | |||
contentElement = (KnuthElement) k; | |||
stackSize += contentElement.getWidth(); | |||
contentList.add(contentElement); | |||
} |
@@ -295,8 +295,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
* @return true if the sequence contains a box | |||
*/ | |||
public boolean containsBox() { | |||
for (int i = 0; i < this.size(); i++) { | |||
KnuthElement el = (KnuthElement)this.get(i); | |||
for (Object o : this) { | |||
KnuthElement el = (KnuthElement) o; | |||
if (el.isBox()) { | |||
return true; | |||
} |
@@ -211,8 +211,8 @@ public class ColumnSetup { | |||
* and work out the total number of factors to use to distribute | |||
* the remaining space (if any) | |||
*/ | |||
for (Iterator i = colWidths.iterator(); i.hasNext();) { | |||
Length colWidth = (Length) i.next(); | |||
for (Object colWidth1 : colWidths) { | |||
Length colWidth = (Length) colWidth1; | |||
if (colWidth != null) { | |||
sumCols += colWidth.getValue(percentBaseContext); | |||
if (colWidth instanceof RelativeNumericProperty) { |
@@ -95,10 +95,10 @@ class RowGroupLayoutManager { | |||
int bodyType, LinkedList returnList) { | |||
log.debug("Handling row group with " + rowGroup.length + " rows..."); | |||
EffRow row; | |||
for (int rgi = 0; rgi < rowGroup.length; rgi++) { | |||
row = rowGroup[rgi]; | |||
for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (EffRow aRowGroup : rowGroup) { | |||
row = aRowGroup; | |||
for (Object o : row.getGridUnits()) { | |||
GridUnit gu = (GridUnit) o; | |||
if (gu.isPrimary()) { | |||
PrimaryGridUnit primary = gu.getPrimary(); | |||
// TODO a new LM must be created for every new static-content | |||
@@ -118,7 +118,7 @@ class RowGroupLayoutManager { | |||
//Get the element list for the cell contents | |||
List elems = primary.getCellLM().getNextKnuthElements( | |||
childLC, alignment); | |||
childLC, alignment); | |||
ElementListObserver.observe(elems, "table-cell", primary.getCell().getId()); | |||
primary.setElements(elems); | |||
} | |||
@@ -155,8 +155,8 @@ class RowGroupLayoutManager { | |||
rowHeights[rgi] = rowBPD.toMinOptMax(tableLM); | |||
explicitRowHeight = rowBPD.toMinOptMax(tableLM); | |||
} | |||
for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) { | |||
GridUnit gu = (GridUnit) iter.next(); | |||
for (Object o : row.getGridUnits()) { | |||
GridUnit gu = (GridUnit) o; | |||
if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) { | |||
PrimaryGridUnit primary = gu.getPrimary(); | |||
int effectiveCellBPD = 0; |
@@ -126,8 +126,8 @@ class RowPainter { | |||
if (tablePartBackground != null) { | |||
TableLayoutManager tableLM = tclm.getTableLM(); | |||
for (Iterator iter = tablePartBackgroundAreas.iterator(); iter.hasNext();) { | |||
Block backgroundArea = (Block) iter.next(); | |||
for (Object tablePartBackgroundArea : tablePartBackgroundAreas) { | |||
Block backgroundArea = (Block) tablePartBackgroundArea; | |||
TraitSetter.addBackground(backgroundArea, tablePartBackground, tableLM, | |||
-backgroundArea.getXOffset(), tablePartOffset - backgroundArea.getYOffset(), | |||
tableLM.getContentAreaIPD(), currentRowOffset - tablePartOffset); |
@@ -291,8 +291,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager { | |||
return; | |||
} | |||
int n = childrenLMs.size(); | |||
for (int j = 0; j < n; j++) { | |||
LayoutManager lm = childrenLMs.get(j); | |||
for (LayoutManager lm : childrenLMs) { | |||
if (lm == null) { | |||
return; | |||
} else if (lm instanceof RetrieveTableMarkerLayoutManager) { |
@@ -564,8 +564,8 @@ public class TableContentLayoutManager implements PercentBaseContext { | |||
getTableLM().registerMarkers(body.getMarkers(), true, isFirstPos, isLastPos); | |||
} | |||
painter.startTablePart(body); | |||
for (Iterator iter = positions.iterator(); iter.hasNext();) { | |||
painter.handleTableContentPosition((TableContentPosition) iter.next()); | |||
for (Object position : positions) { | |||
painter.handleTableContentPosition((TableContentPosition) position); | |||
} | |||
getTableLM().getCurrentPV().registerMarkers(body.getMarkers(), | |||
false, isFirstPos, isLastPos); |
@@ -386,8 +386,8 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager | |||
curBlockArea.setBPD(tableHeight); | |||
if (columnBackgroundAreas != null) { | |||
for (Iterator iter = columnBackgroundAreas.iterator(); iter.hasNext();) { | |||
ColumnBackgroundInfo b = (ColumnBackgroundInfo) iter.next(); | |||
for (Object columnBackgroundArea : columnBackgroundAreas) { | |||
ColumnBackgroundInfo b = (ColumnBackgroundInfo) columnBackgroundArea; | |||
TraitSetter.addBackground(b.backgroundArea, | |||
b.column.getCommonBorderPaddingBackground(), this, | |||
b.xShift, -b.backgroundArea.getYOffset(), | |||
@@ -558,8 +558,7 @@ public class TableLayoutManager extends SpacedBorderedPaddedBlockLayoutManager | |||
// if we get to this stage then we are at the footer of the table fragment; this means that no more | |||
// different TCLM need to be saved (we already have all); we flag the list as being complete then | |||
areAllTCLMsSaved = true; | |||
for (int i = 0; i < savedTCLMs.size(); i++) { | |||
TableCellLayoutManager tclm = savedTCLMs.get(i); | |||
for (TableCellLayoutManager tclm : savedTCLMs) { | |||
if (this.repeatedHeader) { | |||
tclm.setHasRepeatedHeader(true); | |||
} |
@@ -92,8 +92,8 @@ public class TableRowIterator { | |||
List rowGroup = (List) rowGroupsIter.next(); | |||
EffRow[] effRowGroup = new EffRow[rowGroup.size()]; | |||
int i = 0; | |||
for (Iterator rowIter = rowGroup.iterator(); rowIter.hasNext();) { | |||
List gridUnits = (List) rowIter.next(); | |||
for (Object aRowGroup : rowGroup) { | |||
List gridUnits = (List) aRowGroup; | |||
effRowGroup[i++] = new EffRow(rowIndex++, tablePart, gridUnits); | |||
} | |||
return effRowGroup; |
@@ -121,8 +121,8 @@ public class TableStepper { | |||
private void calcTotalHeight() { | |||
totalHeight = 0; | |||
for (int i = 0; i < rowGroup.length; i++) { | |||
totalHeight += rowGroup[i].getHeight().getOpt(); | |||
for (EffRow aRowGroup : rowGroup) { | |||
totalHeight += aRowGroup.getHeight().getOpt(); | |||
} | |||
if (log.isDebugEnabled()) { | |||
log.debug("totalHeight=" + totalHeight); | |||
@@ -131,8 +131,8 @@ public class TableStepper { | |||
private int getMaxRemainingHeight() { | |||
int maxW = 0; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
int remain = activeCell.getRemainingLength(); | |||
PrimaryGridUnit pgu = activeCell.getPrimaryGridUnit(); | |||
for (int i = activeRowIndex + 1; i < pgu.getRowIndex() - rowGroup[0].getIndex() | |||
@@ -202,8 +202,8 @@ public class TableStepper { | |||
LinkedList footnoteList = new LinkedList(); | |||
//Put all involved grid units into a list | |||
List cellParts = new java.util.ArrayList(activeCells.size()); | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell2 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell2; | |||
CellPart part = activeCell.createCellPart(); | |||
cellParts.add(part); | |||
activeCell.addFootnotes(footnoteList); | |||
@@ -242,8 +242,8 @@ public class TableStepper { | |||
Keep keep = getTableLM().getKeepTogether(); | |||
int stepPenalty = 0; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
keep = keep.compare(activeCell.getKeepWithNext()); | |||
stepPenalty = Math.max(stepPenalty, activeCell.getPenaltyValue()); | |||
} | |||
@@ -342,8 +342,8 @@ public class TableStepper { | |||
* previous rows and spanning over this one) | |||
*/ | |||
private void computeRowFirstStep(List cells) { | |||
for (Iterator iter = cells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object cell : cells) { | |||
ActiveCell activeCell = (ActiveCell) cell; | |||
rowFirstStep = Math.max(rowFirstStep, activeCell.getFirstStep()); | |||
} | |||
} | |||
@@ -356,8 +356,8 @@ public class TableStepper { | |||
private int computeMinStep() { | |||
int minStep = Integer.MAX_VALUE; | |||
boolean stepFound = false; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
int nextStep = activeCell.getNextStep(); | |||
if (nextStep >= 0) { | |||
stepFound = true; | |||
@@ -378,8 +378,8 @@ public class TableStepper { | |||
* @see ActiveCell#signalRowFirstStep(int) | |||
*/ | |||
private void signalRowFirstStep() { | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
activeCell.signalRowFirstStep(rowFirstStep); | |||
} | |||
} | |||
@@ -391,8 +391,8 @@ public class TableStepper { | |||
*/ | |||
private void signalNextStep(int step) { | |||
nextBreakClass = Constants.EN_AUTO; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
nextBreakClass = BreakUtil.compareBreakClasses(nextBreakClass, | |||
activeCell.signalNextStep(step)); | |||
} | |||
@@ -417,8 +417,8 @@ public class TableStepper { | |||
*/ | |||
private int considerRowLastStep(int step) { | |||
rowFinished = true; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell3 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell3; | |||
if (activeCell.endsOnRow(activeRowIndex)) { | |||
if (!activeCell.finishes(step)) { | |||
rowFinished = false; | |||
@@ -431,8 +431,8 @@ public class TableStepper { | |||
log.trace("Row finished, computing last step"); | |||
} | |||
int maxStep = 0; | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell2 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell2; | |||
if (activeCell.endsOnRow(activeRowIndex)) { | |||
maxStep = Math.max(maxStep, activeCell.getLastStep()); | |||
} | |||
@@ -440,8 +440,8 @@ public class TableStepper { | |||
if (log.isTraceEnabled()) { | |||
log.trace("Max step: " + maxStep); | |||
} | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
activeCell.endRow(activeRowIndex); | |||
if (!activeCell.endsOnRow(activeRowIndex)) { | |||
activeCell.signalRowLastStep(maxStep); | |||
@@ -493,8 +493,8 @@ public class TableStepper { | |||
if (log.isTraceEnabled()) { | |||
log.trace("Switching to row " + (activeRowIndex + 1)); | |||
} | |||
for (Iterator iter = activeCells.iterator(); iter.hasNext();) { | |||
ActiveCell activeCell = (ActiveCell) iter.next(); | |||
for (Object activeCell1 : activeCells) { | |||
ActiveCell activeCell = (ActiveCell) activeCell1; | |||
activeCell.nextRowStarts(); | |||
} | |||
activeCells.addAll(nextActiveCells); |
@@ -61,8 +61,8 @@ public class PDFArray extends PDFObject { | |||
/* generic creation of PDF object */ | |||
super(parent); | |||
for (int i = 0, c = values.length; i < c; i++) { | |||
this.values.add(values[i]); | |||
for (int value : values) { | |||
this.values.add(value); | |||
} | |||
} | |||
@@ -75,8 +75,8 @@ public class PDFArray extends PDFObject { | |||
/* generic creation of PDF object */ | |||
super(parent); | |||
for (int i = 0, c = values.length; i < c; i++) { | |||
this.values.add(values[i]); | |||
for (double value : values) { | |||
this.values.add(value); | |||
} | |||
} | |||
@@ -119,8 +119,8 @@ public class PDFArray extends PDFObject { | |||
/* generic creation of PDF object */ | |||
super(parent); | |||
for (int i = 0, c = values.length; i < c; i++) { | |||
this.values.add(values[i]); | |||
for (Object value : values) { | |||
this.values.add(value); | |||
} | |||
} | |||
@@ -72,8 +72,7 @@ public class PDFColorHandler { | |||
ColorWithAlternatives colExt = (ColorWithAlternatives)color; | |||
//Alternate colors have priority | |||
Color[] alt = colExt.getAlternativeColors(); | |||
for (int i = 0, c = alt.length; i < c; i++) { | |||
Color col = alt[i]; | |||
for (Color col : alt) { | |||
boolean established = establishColorFromColor(codeBuffer, col, fill); | |||
if (established) { | |||
return; | |||
@@ -223,8 +222,8 @@ public class PDFColorHandler { | |||
if (comps.length != componentCount) { | |||
throw new IllegalStateException("Color with unexpected component count encountered"); | |||
} | |||
for (int i = 0, c = comps.length; i < c; i++) { | |||
DoubleFormatUtil.formatDouble(comps[i], 4, 4, codeBuffer); | |||
for (float comp : comps) { | |||
DoubleFormatUtil.formatDouble(comp, 4, 4, codeBuffer); | |||
codeBuffer.append(" "); | |||
} | |||
codeBuffer.append(command).append("\n"); |
@@ -191,8 +191,8 @@ public class PDFFilterList { | |||
addFilter(new FlateFilter()); | |||
} | |||
} else { | |||
for (int i = 0; i < filterset.size(); i++) { | |||
String v = (String)filterset.get(i); | |||
for (Object aFilterset : filterset) { | |||
String v = (String) aFilterset; | |||
addFilter(v); | |||
} | |||
} | |||
@@ -249,8 +249,7 @@ public class PDFFilterList { | |||
private int populateNamesAndParms(List names, List parms) { | |||
// run the filters | |||
int nonNullParams = 0; | |||
for (int count = 0; count < filters.size(); count++) { | |||
PDFFilter filter = filters.get(count); | |||
for (PDFFilter filter : filters) { | |||
// place the names in our local vector in reverse order | |||
if (filter.getName().length() > 0) { | |||
names.add(0, filter.getName()); | |||
@@ -269,8 +268,8 @@ public class PDFFilterList { | |||
private String buildFilterEntries(List names) { | |||
int filterCount = 0; | |||
StringBuffer sb = new StringBuffer(64); | |||
for (int i = 0; i < names.size(); i++) { | |||
final String name = (String)names.get(i); | |||
for (Object name1 : names) { | |||
final String name = (String) name1; | |||
if (name.length() > 0) { | |||
filterCount++; | |||
sb.append(name); | |||
@@ -290,8 +289,8 @@ public class PDFFilterList { | |||
private void putFilterEntries(PDFDictionary dict, List names) { | |||
PDFArray array = new PDFArray(dict); | |||
for (int i = 0, c = names.size(); i < c; i++) { | |||
final String name = (String)names.get(i); | |||
for (Object name1 : names) { | |||
final String name = (String) name1; | |||
if (name.length() > 0) { | |||
array.add(new PDFName(name)); | |||
} | |||
@@ -313,8 +312,8 @@ public class PDFFilterList { | |||
if (parms.size() > 1) { | |||
sb.append("[ "); | |||
} | |||
for (int count = 0; count < parms.size(); count++) { | |||
String s = (String)parms.get(count); | |||
for (Object parm : parms) { | |||
String s = (String) parm; | |||
if (s != null) { | |||
sb.append(s); | |||
needParmsEntry = true; | |||
@@ -336,8 +335,7 @@ public class PDFFilterList { | |||
private void putDecodeParams(PDFDictionary dict, List parms) { | |||
boolean needParmsEntry = false; | |||
PDFArray array = new PDFArray(dict); | |||
for (int i = 0, c = parms.size(); i < c; i++) { | |||
Object obj = parms.get(i); | |||
for (Object obj : parms) { | |||
if (obj != null) { | |||
array.add(obj); | |||
needParmsEntry = true; |
@@ -110,8 +110,7 @@ public class PDFPages extends PDFObject { | |||
sb.append("<< /Type /Pages\n/Count ") | |||
.append(this.getCount()) | |||
.append("\n/Kids ["); | |||
for (int i = 0; i < kids.size(); i++) { | |||
Object kid = kids.get(i); | |||
for (Object kid : kids) { | |||
if (kid == null) { | |||
throw new IllegalStateException("Gap in the kids list!"); | |||
} |
@@ -24,7 +24,6 @@ import java.awt.Paint; | |||
import java.awt.Shape; | |||
import java.awt.geom.Area; | |||
import java.awt.geom.GeneralPath; | |||
import java.util.Iterator; | |||
import org.apache.xmlgraphics.java2d.color.ColorUtil; | |||
@@ -172,8 +171,8 @@ public class PDFPaintingState extends org.apache.fop.util.AbstractPaintingState | |||
PDFGState state; | |||
PDFGState newState = new PDFGState(); | |||
newState.addValues(defaultState); | |||
for (Iterator it = getStateStack().iterator(); it.hasNext();) { | |||
PDFData data = (PDFData)it.next(); | |||
for (AbstractData abstractData : getStateStack()) { | |||
PDFData data = (PDFData) abstractData; | |||
state = data.gstate; | |||
if (state != null) { | |||
newState.addValues(state); |
@@ -151,9 +151,9 @@ public class PDFText extends PDFObject { | |||
if (brackets) { | |||
sb.append("<"); | |||
} | |||
for (int i = 0; i < data.length; i++) { | |||
sb.append(DIGITS[(data[i] >>> 4) & 0x0F]); | |||
sb.append(DIGITS[data[i] & 0x0F]); | |||
for (byte aData : data) { | |||
sb.append(DIGITS[(aData >>> 4) & 0x0F]); | |||
sb.append(DIGITS[aData & 0x0F]); | |||
} | |||
if (brackets) { | |||
sb.append(">"); | |||
@@ -198,9 +198,9 @@ public class PDFText extends PDFObject { | |||
throw new CascadingRuntimeException("Incompatible VM", uee); | |||
} | |||
for (int i = 0; i < uniBytes.length; i++) { | |||
buf.append(DIGITS[(uniBytes[i] >>> 4) & 0x0F]); | |||
buf.append(DIGITS[uniBytes[i] & 0x0F]); | |||
for (byte uniByte : uniBytes) { | |||
buf.append(DIGITS[(uniByte >>> 4) & 0x0F]); | |||
buf.append(DIGITS[uniByte & 0x0F]); | |||
} | |||
return buf.toString(); | |||
} | |||
@@ -287,8 +287,7 @@ public class PDFText extends PDFObject { | |||
public static final byte[] escapeByteArray(byte[] data) { | |||
ByteArrayOutputStream bout = new ByteArrayOutputStream(data.length); | |||
bout.write((int)'('); | |||
for (int i = 0; i < data.length; i++) { | |||
final int b = data[i]; | |||
for (final byte b : data) { | |||
switch (b) { | |||
case '\n': | |||
bout.write('\\'); |
@@ -100,16 +100,15 @@ public class PDFWArray { | |||
StringBuffer p = new StringBuffer(); | |||
p.append("[ "); | |||
int len = entries.size(); | |||
for (int i = 0; i < len; i++) { | |||
Object entry = entries.get(i); | |||
for (Object entry : entries) { | |||
if (entry instanceof int[]) { | |||
int[] line = (int[])entry; | |||
for (int j = 0; j < line.length; j++) { | |||
p.append(line[j]); | |||
int[] line = (int[]) entry; | |||
for (int aLine : line) { | |||
p.append(aLine); | |||
p.append(" "); | |||
} | |||
} else { | |||
((Entry)entry).fillInPDF(p); | |||
((Entry) entry).fillInPDF(p); | |||
} | |||
} | |||
p.append("]"); | |||
@@ -131,8 +130,8 @@ public class PDFWArray { | |||
// p.setLength(0); | |||
p.append(start); | |||
p.append(" ["); | |||
for (int i = 0; i < metrics.length; i++) { | |||
p.append(this.metrics[i]); | |||
for (int metric : metrics) { | |||
p.append(metric); | |||
p.append(" "); | |||
} | |||
p.append("] "); |
@@ -58,8 +58,8 @@ public abstract class AbstractFOEventHandlerMaker { | |||
*/ | |||
public boolean isMimeTypeSupported(String mimeType) { | |||
String[] mimes = getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
if (mimes[i].equals(mimeType)) { | |||
for (String mime : mimes) { | |||
if (mime.equals(mimeType)) { | |||
return true; | |||
} | |||
} |
@@ -202,11 +202,12 @@ public abstract class AbstractRenderer | |||
private String convertToString(List children) { | |||
StringBuffer sb = new StringBuffer(); | |||
for (int count = 0; count < children.size(); count++) { | |||
InlineArea inline = (InlineArea) children.get(count); | |||
for (Object aChildren : children) { | |||
InlineArea inline = (InlineArea) aChildren; | |||
//if (inline instanceof Character) { | |||
// sb.append(((Character) inline).getChar()); | |||
/*} else*/ if (inline instanceof TextArea) { | |||
/*} else*/ | |||
if (inline instanceof TextArea) { | |||
sb.append(((TextArea) inline).getText()); | |||
} else if (inline instanceof InlineParent) { | |||
sb.append(convertToString( | |||
@@ -413,8 +414,8 @@ public abstract class AbstractRenderer | |||
int saveBPPos = currentBPPosition; | |||
int saveSpanBPPos = saveBPPos; | |||
int saveIPPos = currentIPPosition; | |||
for (int count = 0; count < spans.size(); count++) { | |||
span = (Span) spans.get(count); | |||
for (Object span1 : spans) { | |||
span = (Span) span1; | |||
int level = span.getBidiLevel(); | |||
if (level < 0) { | |||
level = 0; | |||
@@ -548,8 +549,7 @@ public abstract class AbstractRenderer | |||
containingBPPosition = currentBPPosition; | |||
containingIPPosition = currentIPPosition; | |||
for (int count = 0; count < blocks.size(); count++) { | |||
Object obj = blocks.get(count); | |||
for (Object obj : blocks) { | |||
if (obj instanceof Block) { | |||
currentIPPosition = contIP; | |||
containingBPPosition = contBP; | |||
@@ -685,8 +685,8 @@ public abstract class AbstractRenderer | |||
} else { | |||
currentIPPosition += line.getStartIndent(); | |||
} | |||
for (int i = 0, l = children.size(); i < l; i++) { | |||
InlineArea inline = (InlineArea) children.get(i); | |||
for (Object aChildren : children) { | |||
InlineArea inline = (InlineArea) aChildren; | |||
renderInlineArea(inline); | |||
} | |||
currentBPPosition = saveBP; | |||
@@ -755,8 +755,8 @@ public abstract class AbstractRenderer | |||
List children = text.getChildAreas(); | |||
int saveIP = currentIPPosition; | |||
int saveBP = currentBPPosition; | |||
for (int i = 0, l = children.size(); i < l; i++) { | |||
InlineArea inline = (InlineArea) children.get(i); | |||
for (Object aChildren : children) { | |||
InlineArea inline = (InlineArea) aChildren; | |||
renderInlineArea(inline); | |||
} | |||
currentIPPosition = saveIP + text.getAllocIPD(); | |||
@@ -798,8 +798,8 @@ public abstract class AbstractRenderer | |||
int ipAdjust; | |||
if ((ip instanceof FilledArea) && ((level & 1) != 0)) { | |||
int ipdChildren = 0; | |||
for (int i = 0, l = children.size(); i < l; i++) { | |||
InlineArea inline = (InlineArea) children.get(i); | |||
for (Object aChildren : children) { | |||
InlineArea inline = (InlineArea) aChildren; | |||
ipdChildren += inline.getAllocIPD(); | |||
} | |||
ipAdjust = ip.getAllocIPD() - ipdChildren; | |||
@@ -817,8 +817,8 @@ public abstract class AbstractRenderer | |||
} | |||
currentBPPosition += ip.getBlockProgressionOffset(); | |||
// render children inlines | |||
for (int i = 0, l = children.size(); i < l; i++) { | |||
InlineArea inline = (InlineArea) children.get(i); | |||
for (Object aChildren : children) { | |||
InlineArea inline = (InlineArea) aChildren; | |||
renderInlineArea(inline); | |||
} | |||
currentIPPosition = saveIP + ip.getAllocIPD(); |
@@ -61,8 +61,8 @@ public abstract class AbstractRendererMaker { | |||
*/ | |||
public boolean isMimeTypeSupported(String mimeType) { | |||
String[] mimes = getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
if (mimes[i].equals(mimeType)) { | |||
for (String mime : mimes) { | |||
if (mime.equals(mimeType)) { | |||
return true; | |||
} | |||
} |
@@ -142,8 +142,8 @@ public class ImageHandlerRegistry { | |||
for (ImageHandler handler : this.handlerList) { | |||
if (handler.isCompatible(context, null)) { | |||
ImageFlavor[] f = handler.getSupportedImageFlavors(); | |||
for (int i = 0; i < f.length; i++) { | |||
flavors.add(f[i]); | |||
for (ImageFlavor aF : f) { | |||
flavors.add(aF); | |||
} | |||
} | |||
} |
@@ -85,13 +85,13 @@ public class RendererFactory { | |||
*/ | |||
public void addRendererMaker(AbstractRendererMaker maker) { | |||
String[] mimes = maker.getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
for (String mime : mimes) { | |||
//This overrides any renderer previously set for a MIME type | |||
if (rendererMakerMapping.get(mimes[i]) != null) { | |||
log.trace("Overriding renderer for " + mimes[i] | |||
if (rendererMakerMapping.get(mime) != null) { | |||
log.trace("Overriding renderer for " + mime | |||
+ " with " + maker.getClass().getName()); | |||
} | |||
rendererMakerMapping.put(mimes[i], maker); | |||
rendererMakerMapping.put(mime, maker); | |||
} | |||
} | |||
@@ -102,13 +102,13 @@ public class RendererFactory { | |||
*/ | |||
public void addFOEventHandlerMaker(AbstractFOEventHandlerMaker maker) { | |||
String[] mimes = maker.getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
for (String mime : mimes) { | |||
//This overrides any event handler previously set for a MIME type | |||
if (eventHandlerMakerMapping.get(mimes[i]) != null) { | |||
log.trace("Overriding FOEventHandler for " + mimes[i] | |||
if (eventHandlerMakerMapping.get(mime) != null) { | |||
log.trace("Overriding FOEventHandler for " + mime | |||
+ " with " + maker.getClass().getName()); | |||
} | |||
eventHandlerMakerMapping.put(mimes[i], maker); | |||
eventHandlerMakerMapping.put(mime, maker); | |||
} | |||
} | |||
@@ -119,13 +119,13 @@ public class RendererFactory { | |||
*/ | |||
public void addDocumentHandlerMaker(AbstractIFDocumentHandlerMaker maker) { | |||
String[] mimes = maker.getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
for (String mime : mimes) { | |||
//This overrides any renderer previously set for a MIME type | |||
if (documentHandlerMakerMapping.get(mimes[i]) != null) { | |||
log.trace("Overriding document handler for " + mimes[i] | |||
if (documentHandlerMakerMapping.get(mime) != null) { | |||
log.trace("Overriding document handler for " + mime | |||
+ " with " + maker.getClass().getName()); | |||
} | |||
documentHandlerMakerMapping.put(mimes[i], maker); | |||
documentHandlerMakerMapping.put(mime, maker); | |||
} | |||
} | |||
@@ -57,10 +57,10 @@ public class XMLHandlerConfigurator extends AbstractRendererConfigurator { | |||
Configuration handlerConfig = null; | |||
Configuration[] children = cfg.getChildren("xml-handler"); | |||
for (int i = 0; i < children.length; ++i) { | |||
for (Configuration aChildren : children) { | |||
try { | |||
if (children[i].getAttribute("namespace").equals(namespace)) { | |||
handlerConfig = children[i]; | |||
if (aChildren.getAttribute("namespace").equals(namespace)) { | |||
handlerConfig = aChildren; | |||
break; | |||
} | |||
} catch (ConfigurationException e) { |
@@ -130,9 +130,9 @@ public class XMLHandlerRegistry { | |||
private XMLHandler getXMLHandler(Renderer renderer, List<XMLHandler> lst) { | |||
XMLHandler handler; | |||
if (lst != null) { | |||
for (int i = 0, c = lst.size(); i < c; i++) { | |||
for (XMLHandler aLst : lst) { | |||
//TODO Maybe add priorities later | |||
handler = lst.get(i); | |||
handler = aLst; | |||
if (handler.supportsRenderer(renderer)) { | |||
return handler; | |||
} |
@@ -358,8 +358,7 @@ public final class AFPRendererConfig implements RendererConfig { | |||
if (defaultResourceLevelCfg != null) { | |||
AFPResourceLevelDefaults defaults = new AFPResourceLevelDefaults(); | |||
String[] types = defaultResourceLevelCfg.getAttributeNames(); | |||
for (int i = 0, c = types.length; i < c; i++) { | |||
String type = types[i]; | |||
for (String type : types) { | |||
try { | |||
String level = defaultResourceLevelCfg.getAttribute(type); | |||
defaults.setDefaultResourceLevel(type, AFPResourceLevel.valueOf(level)); |
@@ -50,8 +50,8 @@ public abstract class AbstractIFDocumentHandlerMaker { | |||
*/ | |||
public boolean isMimeTypeSupported(String mimeType) { | |||
String[] mimes = getSupportedMimeTypes(); | |||
for (int i = 0; i < mimes.length; i++) { | |||
if (mimes[i].equals(mimeType)) { | |||
for (String mime : mimes) { | |||
if (mime.equals(mimeType)) { | |||
return true; | |||
} | |||
} |
@@ -113,8 +113,8 @@ public abstract class AbstractIFPainter<T extends IFDocumentHandler> implements | |||
private AffineTransform combine(AffineTransform[] transforms) { | |||
AffineTransform at = new AffineTransform(); | |||
for (int i = 0, c = transforms.length; i < c; i++) { | |||
at.concatenate(transforms[i]); | |||
for (AffineTransform transform : transforms) { | |||
at.concatenate(transform); | |||
} | |||
return at; | |||
} |
@@ -610,9 +610,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
private void processExtensionAttachments(AreaTreeObject area) throws IFException { | |||
if (area.hasExtensionAttachments()) { | |||
for (Iterator iter = area.getExtensionAttachments().iterator(); | |||
iter.hasNext();) { | |||
ExtensionAttachment attachment = (ExtensionAttachment) iter.next(); | |||
for (ExtensionAttachment attachment : area.getExtensionAttachments()) { | |||
this.documentHandler.handleExtensionObject(attachment); | |||
} | |||
} | |||
@@ -688,15 +686,15 @@ public class IFRenderer extends AbstractPathOrientedRenderer { | |||
/** {@inheritDoc} */ | |||
protected void restoreStateStackAfterBreakOut(List breakOutList) { | |||
log.debug("Block.FIXED --> restoring context after break-out"); | |||
for (int i = 0, c = breakOutList.size(); i < c; i++) { | |||
for (Object aBreakOutList : breakOutList) { | |||
graphicContextStack.push(graphicContext); | |||
this.graphicContext = (IFGraphicContext)breakOutList.get(i); | |||
this.graphicContext = (IFGraphicContext) aBreakOutList; | |||
//Handle groups | |||
IFGraphicContext.Group[] groups = graphicContext.getGroups(); | |||
for (int j = 0, jc = groups.length; j < jc; j++) { | |||
for (IFGraphicContext.Group group : groups) { | |||
try { | |||
groups[j].start(painter); | |||
group.start(painter); | |||
} catch (IFException ife) { | |||
handleIFException(ife); | |||
} |
@@ -307,8 +307,8 @@ public final class IFUtil { | |||
if (dp == null) { | |||
return true; | |||
} else { | |||
for (int i = 0, n = dp.length; i < n; i++) { | |||
if (!isPAIdentity(dp[i])) { | |||
for (int[] aDp : dp) { | |||
if (!isPAIdentity(aDp)) { | |||
return false; | |||
} | |||
} | |||
@@ -330,8 +330,7 @@ public final class IFUtil { | |||
if (dp == null) { | |||
return false; | |||
} else { | |||
for (int i = 0, n = dp.length; i < n; i++) { | |||
int[] pa = dp[i]; | |||
for (int[] pa : dp) { | |||
if ((pa != null) && (pa[0] != pa[2])) { | |||
return false; | |||
} |
@@ -77,8 +77,7 @@ public class InstalledFontCollection implements FontCollection { | |||
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); | |||
java.awt.Font[] fonts = env.getAllFonts(); | |||
for (int i = 0; i < fonts.length; i++) { | |||
java.awt.Font f = fonts[i]; | |||
for (java.awt.Font f : fonts) { | |||
if (HARDCODED_FONT_NAMES.contains(f.getName())) { | |||
continue; //skip | |||
} |
@@ -108,8 +108,8 @@ public class PCLGenerator { | |||
public PCLGenerator(OutputStream out, int maxResolution) { | |||
this(out); | |||
boolean found = false; | |||
for (int i = 0; i < PCL_RESOLUTIONS.length; i++) { | |||
if (PCL_RESOLUTIONS[i] == maxResolution) { | |||
for (int pclResolutions : PCL_RESOLUTIONS) { | |||
if (pclResolutions == maxResolution) { | |||
found = true; | |||
break; | |||
} |
@@ -293,8 +293,8 @@ public class PSImageHandlerSVG implements ImageHandler { | |||
if (curNode.getAttributes().getNamedItem("style") != null) { | |||
String[] stylePairs = curNode.getAttributes().getNamedItem("style").getNodeValue() | |||
.split(";"); | |||
for (int styleAtt = 0; styleAtt < stylePairs.length; styleAtt++) { | |||
String[] style = stylePairs[styleAtt].split(":"); | |||
for (String stylePair : stylePairs) { | |||
String[] style = stylePair.split(":"); | |||
if (style[0].equalsIgnoreCase("stop-opacity")) { | |||
if (Double.parseDouble(style[1]) < 1) { | |||
return true; |
@@ -1757,9 +1757,9 @@ public class RTFHandler extends FOEventHandler { | |||
//Calculation for column-widths which are not set | |||
prepareTable(table); | |||
for (Iterator it = table.getColumns().iterator(); it.hasNext();) { | |||
recurseFONode((FONode) it.next()); | |||
} | |||
for (Object o : table.getColumns()) { | |||
recurseFONode((FONode) o); | |||
} | |||
} else { | |||
//TODO Implement implicit column setup handling! | |||
RTFEventProducer eventProducer = RTFEventProducer.Provider.get( |
@@ -191,8 +191,8 @@ public final class RtfColorTable { | |||
int len = colorTable.size(); | |||
for (int i = 0; i < len; i++) { | |||
int identifier = (Integer) colorTable.get(i); | |||
for (Object aColorTable : colorTable) { | |||
int identifier = (Integer) aColorTable; | |||
header.newLine(); | |||
header.write("\\red" + determineColorLevel(identifier, RED)); |
@@ -28,7 +28,6 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; | |||
import java.io.IOException; | |||
import java.io.Writer; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
@@ -113,16 +112,16 @@ public class RtfContainer extends RtfElement { | |||
} | |||
private int findChildren(RtfElement aChild, int iStart) { | |||
for (Iterator it = this.getChildren().iterator(); it.hasNext();) { | |||
final RtfElement e = (RtfElement)it.next(); | |||
if (aChild == e) { | |||
return iStart; | |||
} else if (e instanceof RtfContainer) { | |||
int iFound = ((RtfContainer)e).findChildren(aChild, (iStart + 1)); | |||
if (iFound != -1) { | |||
return iFound; | |||
} | |||
} | |||
for (Object o : this.getChildren()) { | |||
final RtfElement e = (RtfElement) o; | |||
if (aChild == e) { | |||
return iStart; | |||
} else if (e instanceof RtfContainer) { | |||
int iFound = ((RtfContainer) e).findChildren(aChild, (iStart + 1)); | |||
if (iFound != -1) { | |||
return iFound; | |||
} | |||
} | |||
} | |||
return -1; | |||
} | |||
@@ -157,8 +156,8 @@ public class RtfContainer extends RtfElement { | |||
*/ | |||
protected void writeRtfContent() | |||
throws IOException { | |||
for (Iterator it = children.iterator(); it.hasNext();) { | |||
final RtfElement e = (RtfElement)it.next(); | |||
for (Object aChildren : children) { | |||
final RtfElement e = (RtfElement) aChildren; | |||
e.writeRtf(); | |||
} | |||
} | |||
@@ -171,12 +170,12 @@ public class RtfContainer extends RtfElement { | |||
/** true if this (recursively) contains at least one RtfText object */ | |||
boolean containsText() { | |||
boolean result = false; | |||
for (Iterator it = children.iterator(); it.hasNext();) { | |||
final RtfElement e = (RtfElement)it.next(); | |||
for (Object aChildren : children) { | |||
final RtfElement e = (RtfElement) aChildren; | |||
if (e instanceof RtfText) { | |||
result = !e.isEmpty(); | |||
} else if (e instanceof RtfContainer) { | |||
if (((RtfContainer)e).containsText()) { | |||
if (((RtfContainer) e).containsText()) { | |||
result = true; | |||
} | |||
} | |||
@@ -191,8 +190,8 @@ public class RtfContainer extends RtfElement { | |||
void dump(Writer w, int indent) | |||
throws IOException { | |||
super.dump(w, indent); | |||
for (Iterator it = children.iterator(); it.hasNext();) { | |||
final RtfElement e = (RtfElement)it.next(); | |||
for (Object aChildren : children) { | |||
final RtfElement e = (RtfElement) aChildren; | |||
e.dump(w, indent + 1); | |||
} | |||
} | |||
@@ -222,8 +221,8 @@ public class RtfContainer extends RtfElement { | |||
*/ | |||
public boolean isEmpty() { | |||
boolean result = true; | |||
for (Iterator it = children.iterator(); it.hasNext();) { | |||
final RtfElement e = (RtfElement)it.next(); | |||
for (Object aChildren : children) { | |||
final RtfElement e = (RtfElement) aChildren; | |||
if (!e.isEmpty()) { | |||
result = false; | |||
break; |
@@ -190,8 +190,7 @@ public abstract class RtfElement { | |||
if (nameList != null) { | |||
// process only given attribute names | |||
for (int i = 0; i < nameList.length; i++) { | |||
final String name = nameList[i]; | |||
for (final String name : nameList) { | |||
if (attr.isSet(name)) { | |||
writeOneAttribute(name, attr.getValue(name)); | |||
} |
@@ -405,8 +405,8 @@ public class RtfExternalGraphic extends RtfElement { | |||
writeSizeInfo(); | |||
writeAttributes(getRtfAttributes(), null); | |||
for (int i = 0; i < imagedata.length; i++) { | |||
int iData = imagedata [i]; | |||
for (byte anImagedata : imagedata) { | |||
int iData = anImagedata; | |||
// Make positive byte | |||
if (iData < 0) { |