git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1761026 13f79535-47bb-0310-9956-ffa450edef68pull/3/head
@@ -140,7 +140,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder | |||
sb.append('='); | |||
sb.append(coords[i]); | |||
} | |||
return getName() + "{" + sb.toString() + "}"; | |||
return getName() + "{" + sb + "}"; | |||
} | |||
/** |
@@ -125,9 +125,7 @@ public class WordArea extends InlineArea { | |||
if (this.levels != null) { | |||
int n = end - start; | |||
int[] levels = new int [ n ]; | |||
for (int i = 0; i < n; i++) { | |||
levels[i] = this.levels [ start + i ]; | |||
} | |||
System.arraycopy(this.levels, start + 0, levels, 0, n); | |||
return levels; | |||
} else { | |||
return null; |
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.fonts; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -340,9 +341,7 @@ public class GlyphPositioningTable extends GlyphTable { | |||
public List getEntries() { | |||
if (values != null) { | |||
List entries = new ArrayList(values.length); | |||
for (Value value : values) { | |||
entries.add(value); | |||
} | |||
Collections.addAll(entries, values); | |||
return entries; | |||
} else { | |||
return null; |
@@ -20,6 +20,7 @@ | |||
package org.apache.fop.complexscripts.fonts; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -506,9 +507,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
/** {@inheritDoc} */ | |||
public List getEntries() { | |||
List entries = new ArrayList(gaa.length); | |||
for (int[] aGaa : gaa) { | |||
entries.add(aGaa); | |||
} | |||
Collections.addAll(entries, gaa); | |||
return entries; | |||
} | |||
/** {@inheritDoc} */ | |||
@@ -638,9 +637,7 @@ public class GlyphSubstitutionTable extends GlyphTable { | |||
/** {@inheritDoc} */ | |||
public List getEntries() { | |||
List entries = new ArrayList(ligatureSets.length); | |||
for (LigatureSet ligatureSet : ligatureSets) { | |||
entries.add(ligatureSet); | |||
} | |||
Collections.addAll(entries, ligatureSets); | |||
return entries; | |||
} | |||
/** {@inheritDoc} */ |
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.scripts; | |||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.InvocationTargetException; | |||
import java.util.Collections; | |||
import java.util.HashMap; | |||
import java.util.HashSet; | |||
import java.util.Map; | |||
@@ -241,9 +242,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { | |||
}; | |||
static { | |||
basicShapingFeatures = new HashSet<String>(); | |||
for (String s : BASIC_SHAPING_FEATURE_STRINGS) { | |||
basicShapingFeatures.add(s); | |||
} | |||
Collections.addAll(basicShapingFeatures, BASIC_SHAPING_FEATURE_STRINGS); | |||
} | |||
private boolean isBasicShapingUse(GlyphTable.UseSpec us) { | |||
assert us != null; | |||
@@ -265,9 +264,7 @@ public class IndicScriptProcessor extends DefaultScriptProcessor { | |||
}; | |||
static { | |||
presentationFeatures = new HashSet<String>(); | |||
for (String s : PRESENTATION_FEATURE_STRINGS) { | |||
presentationFeatures.add(s); | |||
} | |||
Collections.addAll(presentationFeatures, PRESENTATION_FEATURE_STRINGS); | |||
} | |||
private boolean isPresentationUse(GlyphTable.UseSpec us) { | |||
assert us != null; |
@@ -21,6 +21,7 @@ package org.apache.fop.complexscripts.util; | |||
import java.nio.IntBuffer; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
// CSOFF: LineLengthCheck | |||
@@ -459,19 +460,13 @@ public class GlyphSequence implements Cloneable { | |||
if (na > 0) { | |||
List gl = new ArrayList(na); | |||
if (baa != null) { | |||
for (CharAssociation aBaa : baa) { | |||
gl.add(aBaa); | |||
} | |||
Collections.addAll(gl, baa); | |||
} | |||
if (iaa != null) { | |||
for (CharAssociation anIaa : iaa) { | |||
gl.add(anIaa); | |||
} | |||
Collections.addAll(gl, iaa); | |||
} | |||
if (laa != null) { | |||
for (CharAssociation aLaa : laa) { | |||
gl.add(aLaa); | |||
} | |||
Collections.addAll(gl, laa); | |||
} | |||
return gl; | |||
} else { |
@@ -20,6 +20,7 @@ | |||
package org.apache.fop.complexscripts.util; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
// CSOFF: LineLengthCheck | |||
@@ -478,9 +479,7 @@ public class NumberConverter { | |||
*/ | |||
private static void appendScalars(List<Integer> scalars, Integer[] sa) { | |||
for (Integer s : sa) { | |||
scalars.add(s); | |||
} | |||
Collections.addAll(scalars, sa); | |||
} | |||
private static String scalarsToString(List<Integer> scalars) { |
@@ -801,9 +801,7 @@ public class FOText extends FONode implements CharSequence, TextFragment { | |||
assert start <= end; | |||
int n = end - start; | |||
int[] bidiLevels = new int [ n ]; | |||
for (int i = 0; i < n; i++) { | |||
bidiLevels[i] = this.bidiLevels [ start + i ]; | |||
} | |||
System.arraycopy(this.bidiLevels, start + 0, bidiLevels, 0, n); | |||
return bidiLevels; | |||
} else { | |||
return null; |
@@ -530,9 +530,7 @@ public abstract class CustomFont extends Typeface | |||
*/ | |||
public void setCMap(CMapSegment[] cmap) { | |||
this.cmap.clear(); | |||
for (CMapSegment c : cmap) { | |||
this.cmap.add(c); | |||
} | |||
Collections.addAll(this.cmap, cmap); | |||
} | |||
/** |
@@ -428,7 +428,7 @@ public class FontInfo { | |||
} | |||
throw new IllegalStateException( | |||
"fontLookup must return an array with at least one " | |||
+ "FontTriplet on the last call. Lookup: " + sb.toString()); | |||
+ "FontTriplet on the last call. Lookup: " + sb); | |||
} | |||
FontTriplet[] fontTriplets = new FontTriplet[matchedTriplets.size()]; |
@@ -334,13 +334,14 @@ public class OTFSubSetFile extends OTFFile { | |||
gidToSID = new LinkedHashMap<Integer, Integer>(); | |||
for (int gid : subsetGlyphs.keySet()) { | |||
for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) { | |||
int gid = subsetGlyph.getKey(); | |||
int sid = cffReader.getSIDFromGID(charsetOffset, gid); | |||
//Check whether the SID falls into the standard string set | |||
if (sid < NUM_STANDARD_STRINGS) { | |||
gidToSID.put(subsetGlyphs.get(gid), sid); | |||
gidToSID.put(subsetGlyph.getValue(), sid); | |||
if (mbFont != null) { | |||
mbFont.mapUsedGlyphName(subsetGlyphs.get(gid), | |||
mbFont.mapUsedGlyphName(subsetGlyph.getValue(), | |||
CFFStandardString.getName(sid)); | |||
} | |||
} else { | |||
@@ -348,16 +349,16 @@ public class OTFSubSetFile extends OTFFile { | |||
//index is 0 based, should use < not <= | |||
if (index < cffReader.getStringIndex().getNumObjects()) { | |||
if (mbFont != null) { | |||
mbFont.mapUsedGlyphName(subsetGlyphs.get(gid), | |||
mbFont.mapUsedGlyphName(subsetGlyph.getValue(), | |||
new String(cffReader.getStringIndex().getValue(index))); | |||
} | |||
gidToSID.put(subsetGlyphs.get(gid), stringIndexData.size() + 391); | |||
gidToSID.put(subsetGlyph.getValue(), stringIndexData.size() + 391); | |||
stringIndexData.add(cffReader.getStringIndex().getValue(index)); | |||
} else { | |||
if (mbFont != null) { | |||
mbFont.mapUsedGlyphName(subsetGlyphs.get(gid), ".notdef"); | |||
mbFont.mapUsedGlyphName(subsetGlyph.getValue(), ".notdef"); | |||
} | |||
gidToSID.put(subsetGlyphs.get(gid), index); | |||
gidToSID.put(subsetGlyph.getValue(), index); | |||
} | |||
} | |||
} | |||
@@ -410,7 +411,8 @@ public class OTFSubSetFile extends OTFFile { | |||
foundLocalUniques.add(new ArrayList<Integer>()); | |||
} | |||
Map<Integer, Integer> gidHintMaskLengths = new HashMap<Integer, Integer>(); | |||
for (int gid : subsetGlyphs.keySet()) { | |||
for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) { | |||
int gid = subsetGlyph.getKey(); | |||
int group = subsetGroups.get(gid); | |||
localIndexSubr = cffReader.getFDFonts().get(group).getLocalSubrData(); | |||
localUniques = foundLocalUniques.get(uniqueGroups.indexOf(subsetGroups.get(gid))); | |||
@@ -418,7 +420,7 @@ public class OTFSubSetFile extends OTFFile { | |||
FDIndexReference newFDReference = new FDIndexReference( | |||
uniqueGroups.indexOf(subsetGroups.get(gid)), subsetGroups.get(gid)); | |||
subsetFDSelect.put(subsetGlyphs.get(gid), newFDReference); | |||
subsetFDSelect.put(subsetGlyph.getValue(), newFDReference); | |||
byte[] data = charStringsIndex.getValue(gid); | |||
preScanForSubsetIndexSize(data); | |||
gidHintMaskLengths.put(gid, type2Parser.getMaskLength()); | |||
@@ -439,13 +441,15 @@ public class OTFSubSetFile extends OTFFile { | |||
for (Integer uniqueGroup : uniqueGroups) { | |||
foundLocalUniquesB.add(new ArrayList<Integer>()); | |||
} | |||
for (Integer gid : subsetGlyphs.keySet()) { | |||
for (Entry<Integer, Integer> subsetGlyph : subsetGlyphs.entrySet()) { | |||
int gid = subsetGlyph.getKey(); | |||
int value = subsetGlyph.getValue(); | |||
int group = subsetGroups.get(gid); | |||
localIndexSubr = cffReader.getFDFonts().get(group).getLocalSubrData(); | |||
localUniques = foundLocalUniquesB.get(subsetFDSelect.get(subsetGlyphs.get(gid)).getNewFDIndex()); | |||
localUniques = foundLocalUniquesB.get(subsetFDSelect.get(value).getNewFDIndex()); | |||
byte[] data = charStringsIndex.getValue(gid); | |||
subsetLocalIndexSubr = fdSubrs.get(subsetFDSelect.get(subsetGlyphs.get(gid)).getNewFDIndex()); | |||
subsetLocalSubrCount = foundLocalUniques.get(subsetFDSelect.get(subsetGlyphs.get(gid)) | |||
subsetLocalIndexSubr = fdSubrs.get(subsetFDSelect.get(value).getNewFDIndex()); | |||
subsetLocalSubrCount = foundLocalUniques.get(subsetFDSelect.get(value) | |||
.getNewFDIndex()).size(); | |||
type2Parser = new Type2Parser(); | |||
type2Parser.setMaskLength(gidHintMaskLengths.get(gid)); | |||
@@ -457,15 +461,15 @@ public class OTFSubSetFile extends OTFFile { | |||
protected void writeFDSelect() { | |||
writeByte(0); //Format | |||
for (Integer gid : subsetFDSelect.keySet()) { | |||
writeByte(subsetFDSelect.get(gid).getNewFDIndex()); | |||
for (FDIndexReference e : subsetFDSelect.values()) { | |||
writeByte(e.getNewFDIndex()); | |||
} | |||
} | |||
protected List<Integer> getUsedFDFonts() { | |||
List<Integer> uniqueNewRefs = new ArrayList<Integer>(); | |||
for (int gid : subsetFDSelect.keySet()) { | |||
int fdIndex = subsetFDSelect.get(gid).getOldFDIndex(); | |||
for (FDIndexReference e : subsetFDSelect.values()) { | |||
int fdIndex = e.getOldFDIndex(); | |||
if (!uniqueNewRefs.contains(fdIndex)) { | |||
uniqueNewRefs.add(fdIndex); | |||
} | |||
@@ -1023,11 +1027,11 @@ public class OTFSubSetFile extends OTFFile { | |||
private void writeCharsetTable(boolean cidFont) throws IOException { | |||
writeByte(0); | |||
for (int gid : gidToSID.keySet()) { | |||
if (cidFont && gid == 0) { | |||
for (Entry<Integer, Integer> entry : gidToSID.entrySet()) { | |||
if (cidFont && entry.getKey() == 0) { | |||
continue; | |||
} | |||
writeCard16((cidFont) ? gid : gidToSID.get(gid)); | |||
writeCard16((cidFont) ? entry.getKey() : entry.getValue()); | |||
} | |||
} | |||
@@ -23,6 +23,7 @@ import java.awt.geom.RectangularShape; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.net.URISyntaxException; | |||
import java.util.Collections; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
import java.util.Set; | |||
@@ -215,9 +216,7 @@ public class Type1FontLoader extends FontLoader { | |||
private Set<String> toGlyphSet(String[] glyphNames) { | |||
Set<String> glyphSet = new java.util.HashSet<String>(); | |||
for (String name : glyphNames) { | |||
glyphSet.add(name); | |||
} | |||
Collections.addAll(glyphSet, glyphNames); | |||
return glyphSet; | |||
} | |||
@@ -84,7 +84,7 @@ public class WhitespaceManagementPenalty extends KnuthPenalty { | |||
String str = super.toString(); | |||
StringBuffer buffer = new StringBuffer(64); | |||
buffer.append(" number of variants = " + variantList.size()); | |||
return str + buffer.toString(); | |||
return str + buffer; | |||
} | |||
} |
@@ -1326,7 +1326,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager | |||
} | |||
} | |||
if (log.isTraceEnabled()) { | |||
log.trace(" Word to hyphenate: " + sbChars.toString()); | |||
log.trace(" Word to hyphenate: " + sbChars); | |||
} | |||
// find hyphenation points | |||
HyphContext hc = getHyphenContext(sbChars); |
@@ -22,6 +22,7 @@ package org.apache.fop.pdf; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Set; | |||
@@ -119,9 +120,7 @@ public class PDFArray extends PDFObject { | |||
/* generic creation of PDF object */ | |||
super(parent); | |||
for (Object value : values) { | |||
this.values.add(value); | |||
} | |||
Collections.addAll(this.values, values); | |||
} | |||
/** |
@@ -278,9 +278,9 @@ public class PDFFilterList { | |||
} | |||
if (filterCount > 0) { | |||
if (filterCount > 1) { | |||
return "/Filter [ " + sb.toString() + "]"; | |||
return "/Filter [ " + sb + "]"; | |||
} else { | |||
return "/Filter " + sb.toString(); | |||
return "/Filter " + sb; | |||
} | |||
} else { | |||
return ""; |
@@ -308,8 +308,8 @@ public class PDFResources extends PDFDictionary { | |||
if (!properties.isEmpty()) { | |||
PDFDictionary dict = new PDFDictionary(this); | |||
for (String name : properties.keySet()) { | |||
dict.put(name, properties.get(name)); | |||
for (Map.Entry<String, PDFReference> stringPDFReferenceEntry : properties.entrySet()) { | |||
dict.put(stringPDFReferenceEntry.getKey(), stringPDFReferenceEntry.getValue()); | |||
} | |||
put("Properties", dict); | |||
} |
@@ -19,6 +19,7 @@ | |||
package org.apache.fop.render; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
@@ -142,9 +143,7 @@ public class ImageHandlerRegistry { | |||
for (ImageHandler handler : this.handlerList) { | |||
if (handler.isCompatible(context, null)) { | |||
ImageFlavor[] f = handler.getSupportedImageFlavors(); | |||
for (ImageFlavor aF : f) { | |||
flavors.add(aF); | |||
} | |||
Collections.addAll(flavors, f); | |||
} | |||
} | |||
return flavors.toArray(new ImageFlavor[flavors.size()]); |
@@ -375,9 +375,7 @@ public final class IFUtil { | |||
int[] paSrc = dp [ i + offset ]; | |||
if (paSrc != null) { | |||
int[] paDst = new int [ 4 ]; | |||
for (int k = 0; k < 4; k++) { | |||
paDst [ k ] = paSrc [ k ]; | |||
} | |||
System.arraycopy(paSrc, 0, paDst, 0, 4); | |||
dpNew [ i ] = paDst; | |||
} | |||
} |
@@ -605,8 +605,8 @@ public class PCLTTFFontReader extends PCLFontReader { | |||
private ByteArrayOutputStream updateOffsets(ByteArrayOutputStream baos, Map<Integer, byte[]> offsets) | |||
throws IOException { | |||
byte[] softFont = baos.toByteArray(); | |||
for (int offset : offsets.keySet()) { | |||
PCLByteWriterUtil.updateDataAtLocation(softFont, offsets.get(offset), offset); | |||
for (Entry<Integer, byte[]> integerEntry : offsets.entrySet()) { | |||
PCLByteWriterUtil.updateDataAtLocation(softFont, integerEntry.getValue(), integerEntry.getKey()); | |||
} | |||
baos = new ByteArrayOutputStream(); | |||
baos.write(softFont); |
@@ -798,7 +798,7 @@ public final class ColorUtil { | |||
} | |||
} | |||
sb.append(")"); | |||
return functionName + sb.toString(); | |||
return functionName + sb; | |||
} | |||
private static String toCIELabFunctionCall(ColorWithAlternatives color) { |
@@ -94,8 +94,8 @@ public final class AFPRendererConfBuilder extends RendererConfBuilder { | |||
public AFPRendererConfBuilder setDefaultResourceLevels(Map<String, String> levels) { | |||
Element e = createElement(DEFAULT_RESOURCE_LEVELS.getName()); | |||
for (String key : levels.keySet()) { | |||
e.setAttribute(key, levels.get(key)); | |||
for (Map.Entry<String, String> stringStringEntry : levels.entrySet()) { | |||
e.setAttribute(stringStringEntry.getKey(), stringStringEntry.getValue()); | |||
} | |||
return this; | |||
} |
@@ -2804,11 +2804,11 @@ public class TTXFile { | |||
} | |||
} | |||
GlyphCoverageTable[] gca = new GlyphCoverageTable [ mi + 1 ]; | |||
for (String k : keys) { | |||
if (k.startsWith(prefix)) { | |||
int i = Integer.parseInt(k.substring(prefixLength)); | |||
for (Map.Entry<String, GlyphCoverageTable> stringGlyphCoverageTableEntry : coverages.entrySet()) { | |||
if (stringGlyphCoverageTableEntry.getKey().startsWith(prefix)) { | |||
int i = Integer.parseInt(stringGlyphCoverageTableEntry.getKey().substring(prefixLength)); | |||
if (i >= 0) { | |||
gca [ i ] = coverages.get(k); | |||
gca [ i ] = stringGlyphCoverageTableEntry.getValue(); | |||
} | |||
} | |||
} | |||
@@ -2915,11 +2915,11 @@ public class TTXFile { | |||
} | |||
private Map<GlyphTable.LookupSpec, List<String>> extractLookups() { | |||
Map<GlyphTable.LookupSpec, List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec, List<String>>(); | |||
for (String st : scripts.keySet()) { | |||
Map<String, List<String>> lm = scripts.get(st); | |||
for (Map.Entry<String, Map<String, List<String>>> stringMapEntry : scripts.entrySet()) { | |||
Map<String, List<String>> lm = stringMapEntry.getValue(); | |||
if (lm != null) { | |||
for (String lt : lm.keySet()) { | |||
List<String> fids = lm.get(lt); | |||
for (Map.Entry<String, List<String>> stringListEntry : lm.entrySet()) { | |||
List<String> fids = stringListEntry.getValue(); | |||
if (fids != null) { | |||
for (String fid : fids) { | |||
if (fid != null) { | |||
@@ -2929,7 +2929,7 @@ public class TTXFile { | |||
String ft = (String) fa[0]; | |||
List<String> lids = (List<String>) fa[1]; | |||
if ((lids != null) && (lids.size() > 0)) { | |||
GlyphTable.LookupSpec ls = new GlyphTable.LookupSpec(st, lt, ft); | |||
GlyphTable.LookupSpec ls = new GlyphTable.LookupSpec(stringMapEntry.getKey(), stringListEntry.getKey(), ft); | |||
lookups.put(ls, lids); | |||
} | |||
} |
@@ -91,8 +91,8 @@ public class CIDFullTestCase { | |||
@Test | |||
public void testGetGlyphs() { | |||
Map<Integer, Integer> fontGlyphs = cidFull.getGlyphs(); | |||
for (Integer key : fontGlyphs.keySet()) { | |||
assertEquals(fontGlyphs.get(key), glyphs.get(key)); | |||
for (Map.Entry<Integer, Integer> integerIntegerEntry : fontGlyphs.entrySet()) { | |||
assertEquals(integerIntegerEntry.getValue(), glyphs.get(integerIntegerEntry.getKey())); | |||
} | |||
assertTrue(fontGlyphs.size() == glyphs.size()); | |||
} |
@@ -64,7 +64,7 @@ public class CrossReferenceTableTestCase extends CrossReferenceObjectTest { | |||
.append("\n0000000000 65535 f \n"); | |||
for (Long objectReference : offsets) { | |||
final String padding = "0000000000"; | |||
String s = String.valueOf(objectReference).toString(); | |||
String s = String.valueOf(objectReference); | |||
String loc = padding.substring(s.length()) + s; | |||
expected.append(loc).append(" 00000 n \n"); | |||
} |