package org.apache.fop.configuration;
-import java.util.Vector;
-import java.util.Hashtable;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
import org.apache.fop.messaging.MessageHandler;
/**
/**
* stores the configuration information
*/
- private static Hashtable standardConfiguration = new Hashtable(30);
- ;
- private static Hashtable pdfConfiguration = new Hashtable(20);
- private static Hashtable awtConfiguration = new Hashtable(20);
+ private static HashMap standardConfiguration = new HashMap(30);
+ private static HashMap pdfConfiguration = new HashMap(20);
+ private static HashMap awtConfiguration = new HashMap(20);
/**
- * contains a Hashtable of existing Hashtables
+ * contains a HashMap of existing HashMaps
*/
- private static Hashtable configuration = new Hashtable(3);
+ private static HashMap configuration = new HashMap(3);
/**
- * loads the configuration types into the configuration Hashtable
+ * loads the configuration types into the configuration HashMap
*/
static {
configuration.put("standard", standardConfiguration);
configuration.put("awt", awtConfiguration);
}
- public static Hashtable getConfiguration() {
+ public static HashMap getConfiguration() {
return configuration;
}
}
}
- ;
-
/**
* convenience methods to access strings values in the configuration
* @param key a string containing the key value for the configuration value
}
}
- ;
-
/**
* convenience methods to access int values in the configuration
* @param key a string containing the key value for the configuration value
}
}
- ;
-
/**
* convenience methods to access boolean values in the configuration
* @param key a string containing the key value for the configuration value
}
}
- ;
-
/**
* convenience methods to access list values in the configuration
* @param key a string containing the key value for the configuration value
* role detemines the configuration target
- * @return Vector a Vector containing the values
+ * @return ArrayList a ArrayList containing the values
* null if the key is not defined.
*/
- public static Vector getListValue(String key, int role) {
+ public static ArrayList getListValue(String key, int role) {
Object obj = Configuration.getValue(key, role);
- if (obj instanceof Vector) {
- return (Vector)obj;
+ if (obj instanceof ArrayList) {
+ return (ArrayList)obj;
} else {
return null;
}
}
- ;
-
/**
- * convenience methods to access map/hashtable values in the configuration
+ * convenience methods to access hashmap values in the configuration
* @param key a string containing the key value for the configuration value
* role detemines the configuration target
- * @return Hashtable a Hashtable containing the values
+ * @return HashMap a HashMap containing the values
* null if the key is not defined.
*/
- public static Hashtable getHashtableValue(String key, int role) {
+ public static HashMap getHashMapValue(String key, int role) {
Object obj = Configuration.getValue(key, role);
- if (obj instanceof Hashtable) {
- return (Hashtable)obj;
+ if (obj instanceof HashMap) {
+ return (HashMap)obj;
} else {
return null;
}
}
- ;
-
-
/**
* convenience method which retrieves some configuration information
* from the standard configuration
* convenience methods to access list values in the standard configuration
*
* @param key a string containing the key value for the configuration value
- * @return Vector a Vector containing the values
+ * @return ArrayList a ArrayList containing the values
* null if the key is not defined.
*/
- public static Vector getListValue(String key) {
+ public static ArrayList getListValue(String key) {
return Configuration.getListValue(key, Configuration.STANDARD);
}
/**
- * convenience methods to access map/hashtable values in the standard configuration
+ * convenience methods to access hashmap values in the standard configuration
*
* @param key a string containing the key value for the configuration value
- * @return Hashtable a Hashtable containing the values
+ * @return HashMap a HashMap containing the values
* null if the key is not defined.
*/
- public static Hashtable getHashtableValue(String key) {
- return Configuration.getHashtableValue(key, Configuration.STANDARD);
+ public static HashMap getHashMapValue(String key) {
+ return Configuration.getHashMapValue(key, Configuration.STANDARD);
}
* method to access fonts values in the standard configuration
*
* @param key a string containing the key value for the configuration value
- * @return Hashtable a Hashtable containing the values
+ * @return HashMap a HashMap containing the values
* null if the key is not defined.
*/
- public static Vector getFonts() {
- return (Vector)Configuration.getValue("fonts",
+ public static ArrayList getFonts() {
+ return (ArrayList)Configuration.getValue("fonts",
Configuration.STANDARD);
}
* initializes this configuration
* @param config contains the configuration information
*/
- public static void setup(int role, Hashtable config) {
+ public static void setup(int role, HashMap config) {
switch (role) {
case Configuration.STANDARD:
standardConfiguration = config;
}
/**
- * adds information to the configuration map/hashtable in key,value form
+ * adds information to the configuration hashmap in key,value form
* @param key a string containing the key value for the configuration value
* value the configuration information
* role detemines the configuration target
- * @param value an Object containing the value; can be a String, a Vector or a Hashtable
+ * @param value an Object containing the value; can be a String, a ArrayList or a HashMap
*/
public static void put(String key, Object value, int role) {
switch (role) {
;
/**
- * adds information to the standard configuration map/hashtable in key,value form
+ * adds information to the standard configuration hashmap in key,value form
* @param key a string containing the key value for the configuration value
* value the configuration information
* role detemines the configuration target
- * @param value an Object containing the value; can be a String, a Vector or a Hashtable
+ * @param value an Object containing the value; can be a String, a ArrayList or a HashMap
*/
public static void put(String key, Object value) {
public static void dumpConfiguration() {
String key;
Object value;
- Vector list;
- Hashtable map, configuration;
- Enumeration enum;
+ ArrayList list;
+ HashMap map, configuration;
String tmp;
System.out.println("Dumping configuration: ");
- Hashtable[] configs = {
+ HashMap[] configs = {
standardConfiguration, pdfConfiguration, awtConfiguration
};
for (int i = 0; i < configs.length; i++) {
MessageHandler.logln("----------------------");
configuration = configs[i];
- Enumeration enumeration = configuration.keys();
- while (enumeration.hasMoreElements()) {
- key = (String)enumeration.nextElement();
+ Iterator iterator = configuration.keySet().iterator();
+ while (iterator.hasNext()) {
+ key = (String)iterator.next();
MessageHandler.logln("key: " + key);
value = configuration.get(key);
if (value instanceof String) {
MessageHandler.logln(" value: " + value);
- } else if (value instanceof Vector) {
- list = (Vector)value;
- enum = list.elements();
+ } else if (value instanceof ArrayList) {
+ list = (ArrayList)value;
MessageHandler.log(" values: ");
- while (enum.hasMoreElements()) {
- MessageHandler.log(enum.nextElement() + " - ");
+ for (int count = 0; count < list.size(); count++) {
+ MessageHandler.log(list.get(count) + " - ");
}
MessageHandler.logln("");
- } else if (value instanceof Hashtable) {
- map = (Hashtable)value;
- enum = map.keys();
+ } else if (value instanceof HashMap) {
+ map = (HashMap)value;
+ Iterator iter = map.keySet().iterator();
MessageHandler.log(" values: ");
- while (enum.hasMoreElements()) {
- tmp = (String)enum.nextElement();
+ while (iter.hasNext()) {
+ tmp = (String)iter.next();
MessageHandler.log(" " + tmp + ":" + map.get(tmp));
}
MessageHandler.logln("");
import org.xml.sax.Locator;
// java
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.HashMap;
+import java.util.ArrayList;
// fop
import org.apache.fop.messaging.MessageHandler;
-
/**
* SAX2 Handler which retrieves the configuration information and stores them in Configuration.
* Normally this class doesn't need to be accessed directly.
private int datatype = -1;
// store the result configuration
- private static Hashtable configuration;
- private static Hashtable activeConfiguration;
+ private static HashMap configuration;
+ private static HashMap activeConfiguration;
// stores key for new config entry
private String key = "";
- private Vector keyStack = new Vector();
+ private ArrayList keyStack = new ArrayList();
// stores string value
private String value = "";
private String subkey = "";
// stores list value
- private Vector list = new Vector(15);
+ private ArrayList list = new ArrayList(15);
// stores hashtable value
- private Hashtable map = new Hashtable(15);
+ private HashMap map = new HashMap(15);
/**
* locator for line number information
private String role = "standard";
// stores fonts
- private Vector fontList = null;
+ private ArrayList fontList = null;
// stores information on one font
private FontInfo fontInfo = null;
// information on a font
private String fontName, metricsFile, embedFile, kerningAsString;
private boolean kerning;
- private Vector fontTriplets;
+ private ArrayList fontTriplets;
// information on a font triplet
private String fontTripletName, weight, style;
}
} else if (localName.equals("configuration")) {}
else if (localName.equals("fonts")) { // list of fonts starts
- fontList = new Vector(10);
+ fontList = new ArrayList(10);
} else if (localName.equals("font")) {
kerningAsString = attributes.getValue("kerning");
if (kerningAsString.equalsIgnoreCase("yes")) {
metricsFile = attributes.getValue("metrics-file");
embedFile = attributes.getValue("embed-file");
fontName = attributes.getValue("name");
- fontTriplets = new Vector(5);
+ fontTriplets = new ArrayList(5);
} else if (localName.equals("font-triplet")) {
fontTripletName = attributes.getValue("name");
weight = attributes.getValue("weight");
style = attributes.getValue("style");
fontTriplet = new FontTriplet(fontTripletName, weight, style);
- fontTriplets.addElement(fontTriplet);
+ fontTriplets.add(fontTriplet);
} else {
// to make sure that user knows about false tag
MessageHandler.errorln("Unknown tag in configuration file: "
status = OUT;
role = "standard";
if (keyStack.size() > 0) {
- keyStack.removeElementAt(keyStack.size() - 1);
+ keyStack.remove(keyStack.size() - 1);
}
if (keyStack.size() > 0) {
- key = (String)keyStack.elementAt(keyStack.size() - 1);
+ key = (String)keyStack.get(keyStack.size() - 1);
} else {
key = "";
}
map.put(subkey, value);
status -= IN_SUBENTRY;
if (keyStack.size() > 0) {
- keyStack.removeElementAt(keyStack.size() - 1);
+ keyStack.remove(keyStack.size() - 1);
}
if (keyStack.size() > 0) {
- key = (String)keyStack.elementAt(keyStack.size() - 1);
+ key = (String)keyStack.get(keyStack.size() - 1);
} else {
key = "";
}
value = "";
} else if (localName.equals("key")) {
status -= IN_KEY;
- keyStack.addElement(key);
+ keyStack.add(key);
} else if (localName.equals("list")) {
status -= IN_LIST;
value = "";
} else if (localName.equals("font")) {
fontInfo = new FontInfo(fontName, metricsFile, kerning,
fontTriplets, embedFile);
- fontList.addElement(fontInfo);
+ fontList.add(fontInfo);
fontTriplets = null;
metricsFile = null;
embedFile = null;
datatype = STRING;
break;
case IN_LIST + IN_VALUE:
- list.addElement(text);
+ list.add(text);
datatype = LIST;
break;
case IN_LIST + IN_SUBENTRY + IN_VALUE:
* @param value a string containing the value for the configuration
*/
private void store(String role, String key, Object value) {
- activeConfiguration = (Hashtable)configuration.get(role);
+ activeConfiguration = (HashMap)configuration.get(role);
if (activeConfiguration != null) {
activeConfiguration.put(key, value);
} else {
package org.apache.fop.configuration;
-import java.util.Vector;
+import java.util.ArrayList;
/**
* FontInfo contains meta information on fonts (where is the metrics file etc.)
public class FontInfo {
private String metricsFile, embedFile, name;
private boolean kerning;
- private Vector fontTriplets;
+ private ArrayList fontTriplets;
public FontInfo(String name, String metricsFile, boolean kerning,
- Vector fontTriplets, String embedFile) {
+ ArrayList fontTriplets, String embedFile) {
this.name = name;
this.metricsFile = metricsFile;
this.embedFile = embedFile;
return kerning;
}
- public Vector getFontTriplets() {
+ public ArrayList getFontTriplets() {
return fontTriplets;
}
import org.w3c.dom.*;
import org.xml.sax.Attributes;
+import javax.xml.parsers.DocumentBuilderFactory;
import java.util.*;
element = null;
try {
- // DOMImplementation impl = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
- // String ns = GraphElementMapping.URI;
- // doc = impl.createDocument(ns, "graph", null);
- doc =
- javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Element el = doc.createElement("graph");
+ DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+ doc = fact.newDocumentBuilder().newDocument();
+ Element el = doc.createElement(tagName);
doc.appendChild(el);
element = doc.getDocumentElement();
package org.apache.fop.layout;
-import java.util.Hashtable;
+import java.util.HashMap;
import org.apache.fop.messaging.MessageHandler;
import java.util.Enumeration;
import org.apache.fop.apps.FOPException;
public class FontInfo {
- Hashtable usedFonts;
- Hashtable triplets; // look up a font-triplet to find a font-name
- Hashtable fonts; // look up a font-name to get a font (that implements FontMetric at least)
+ HashMap usedFonts;
+ HashMap triplets; // look up a font-triplet to find a font-name
+ HashMap fonts; // look up a font-name to get a font (that implements FontMetric at least)
public FontInfo() {
- this.triplets = new Hashtable();
- this.fonts = new Hashtable();
- this.usedFonts = new Hashtable();
+ this.triplets = new HashMap();
+ this.fonts = new HashMap();
+ this.usedFonts = new HashMap();
}
public void addFontProperties(String name, String family, String style,
return family + "," + style + "," + weight;
}
- public Hashtable getFonts() {
+ public HashMap getFonts() {
return this.fonts;
}
- public Hashtable getUsedFonts() {
+ public HashMap getUsedFonts() {
return this.usedFonts;
}
package org.apache.fop.pdf;
// Java
-import java.util.Vector;
+import java.util.ArrayList;
import java.io.IOException;
import java.io.PrintWriter;
}
- public Vector getVector() { // return a vector representation of the color
+ public ArrayList getVector() { // return a vector representation of the color
// in the appropriate colorspace.
- Vector theColorVector = new Vector();
+ ArrayList theColorVector = new ArrayList();
if (this.colorSpace.getColorSpace() == ColorSpace.DEVICE_RGB) { // RGB
- theColorVector.addElement(new Double(this.red));
- theColorVector.addElement(new Double(this.green));
- theColorVector.addElement(new Double(this.blue));
+ theColorVector.add(new Double(this.red));
+ theColorVector.add(new Double(this.green));
+ theColorVector.add(new Double(this.blue));
} else if (this.colorSpace.getColorSpace()
== ColorSpace.DEVICE_CMYK) { // CMYK
- theColorVector.addElement(new Double(this.cyan));
- theColorVector.addElement(new Double(this.magenta));
- theColorVector.addElement(new Double(this.yellow));
- theColorVector.addElement(new Double(this.black));
+ theColorVector.add(new Double(this.cyan));
+ theColorVector.add(new Double(this.magenta));
+ theColorVector.add(new Double(this.yellow));
+ theColorVector.add(new Double(this.black));
} else { // GRAY
- theColorVector.addElement(new Double(this.black));
+ theColorVector.add(new Double(this.black));
}
return (theColorVector);
}
// Java
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Enumeration;
import java.awt.Rectangle;
/**
* the character position of each object
*/
- protected Vector location = new Vector();
+ protected ArrayList location = new ArrayList();
/** List of objects to write in the trailer */
- private Vector trailerObjects = new Vector();
+ private ArrayList trailerObjects = new ArrayList();
/**
* the counter for object numbering
/**
* the objects themselves
*/
- protected Vector objects = new Vector();
+ protected ArrayList objects = new ArrayList();
/**
* character position of xref table
/**
* the XObjects
*/
- protected Vector xObjects = new Vector();
+ protected ArrayList xObjects = new ArrayList();
/**
* the XObjects Map.
/**
* the objects themselves
*/
- protected Vector pendingLinks = null;
+ protected ArrayList pendingLinks = null;
/**
* creates an empty PDF document <p>
PDFInfo pdfInfo = new PDFInfo(++this.objectcount);
// set the default producer
pdfInfo.setProducer(org.apache.fop.apps.Version.getVersion());
- this.objects.addElement(pdfInfo);
+ this.objects.add(pdfInfo);
return pdfInfo;
}
/**
* Make a Type 0 sampled function
*
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector objects of Double objects.
+ * @param theRange ArrayList objects of Double objects.
* This is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theSize A Vector object of Integer objects.
+ * @param theSize A ArrayList object of Integer objects.
* This is the number of samples in each input dimension.
* I can't imagine there being more or less than two input dimensions,
* so maybe this should be an array of length 2.
* This attribute is optional.
*
* See page 265 in the PDF 1.3 spec.
- * @param theEncode Vector objects of Double objects.
+ * @param theEncode ArrayList objects of Double objects.
* This is the linear mapping of input values intop the domain
* of the function's sample table. Default is hard to represent in
* ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
* This attribute is optional.
*
* See page 265 in the PDF 1.3 spec.
- * @param theDecode Vector objects of Double objects.
+ * @param theDecode ArrayList objects of Double objects.
* This is a linear mapping of sample values into the range.
* The default is just the range.
*
* @param theFunctionType This is the type of function (0,2,3, or 4).
* It should be 0 as this is the constructor for sampled functions.
*/
- public PDFFunction makeFunction(int theFunctionType, Vector theDomain,
- Vector theRange, Vector theSize,
+ public PDFFunction makeFunction(int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theSize,
int theBitsPerSample, int theOrder,
- Vector theEncode, Vector theDecode,
+ ArrayList theEncode, ArrayList theDecode,
StringBuffer theFunctionDataStream,
- Vector theFilter) { // Type 0 function
+ ArrayList theFilter) { // Type 0 function
PDFFunction function = new PDFFunction(++this.objectcount,
theFunctionType, theDomain,
theRange, theSize,
theFunctionDataStream,
theFilter);
- this.objects.addElement(function);
+ this.objects.add(function);
return (function);
}
* make a type Exponential interpolation function
* (for shading usually)
*
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector of Doubles that is the Range of the function.
+ * @param theRange ArrayList of Doubles that is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
* @param theCZero This is a vector of Double objects which defines the function result
* when x=0.
* PDF Spec page 268
* @param theFunctionType The type of the function, which should be 2.
*/
- public PDFFunction makeFunction(int theFunctionType, Vector theDomain,
- Vector theRange, Vector theCZero,
- Vector theCOne,
+ public PDFFunction makeFunction(int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theCZero,
+ ArrayList theCOne,
double theInterpolationExponentN) { // type 2
PDFFunction function = new PDFFunction(++this.objectcount,
theFunctionType, theDomain,
theRange, theCZero, theCOne,
theInterpolationExponentN);
- this.objects.addElement(function);
+ this.objects.add(function);
return (function);
}
/**
* Make a Type 3 Stitching function
*
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector objects of Double objects.
+ * @param theRange ArrayList objects of Double objects.
* This is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theFunctions A Vector of the PDFFunction objects that the stitching function stitches.
+ * @param theFunctions A ArrayList of the PDFFunction objects that the stitching function stitches.
*
* This attributed is required.
* It is described on page 269 of the PDF spec.
*
* This attributed is required.
* It's described on page 269 of the PDF 1.3 spec.
- * @param theEncode Vector objects of Double objects.
+ * @param theEncode ArrayList objects of Double objects.
* This is the linear mapping of input values intop the domain
* of the function's sample table. Default is hard to represent in
* ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
* @param theFunctionType This is the function type. It should be 3,
* for a stitching function.
*/
- public PDFFunction makeFunction(int theFunctionType, Vector theDomain,
- Vector theRange, Vector theFunctions,
- Vector theBounds,
- Vector theEncode) { // Type 3
+ public PDFFunction makeFunction(int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theFunctions,
+ ArrayList theBounds,
+ ArrayList theEncode) { // Type 3
PDFFunction function = new PDFFunction(++this.objectcount,
theFunctionType, theDomain,
theRange, theFunctions,
theBounds, theEncode);
- this.objects.addElement(function);
+ this.objects.add(function);
return (function);
}
* @param theFunctionDataStream
*/
public PDFFunction makeFunction(int theNumber, int theFunctionType,
- Vector theDomain, Vector theRange,
+ ArrayList theDomain, ArrayList theRange,
StringBuffer theFunctionDataStream) { // Type 4
PDFFunction function = new PDFFunction(++this.objectcount,
theFunctionType, theDomain,
theRange,
theFunctionDataStream);
- this.objects.addElement(function);
+ this.objects.add(function);
return (function);
}
* @param theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Whether or not to anti-alias.
* @param theDomain Optional vector of Doubles specifying the domain.
- * @param theMatrix Vector of Doubles specifying the matrix.
+ * @param theMatrix ArrayList of Doubles specifying the matrix.
* If it's a pattern, then the matrix maps it to pattern space.
* If it's a shading, then it maps it to current user space.
* It's optional, the default is the identity matrix
*/
public PDFShading makeShading(int theShadingType,
ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
- boolean theAntiAlias, Vector theDomain,
- Vector theMatrix,
+ ArrayList theBackground, ArrayList theBBox,
+ boolean theAntiAlias, ArrayList theDomain,
+ ArrayList theMatrix,
PDFFunction theFunction) { // make Shading of Type 1
String theShadingName = new String("Sh" + (++this.shadingCount));
theColorSpace, theBackground,
theBBox, theAntiAlias, theDomain,
theMatrix, theFunction);
- this.objects.addElement(shading);
+ this.objects.add(shading);
// add this shading to resources
this.resources.addShading(shading);
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Default is false
- * @param theCoords Vector of four (type 2) or 6 (type 3) Double
- * @param theDomain Vector of Doubles specifying the domain
+ * @param theCoords ArrayList of four (type 2) or 6 (type 3) Double
+ * @param theDomain ArrayList of Doubles specifying the domain
* @param theFunction the Stitching (PDFfunction type 3) function, even if it's stitching a single function
- * @param theExtend Vector of Booleans of whether to extend teh start and end colors past the start and end points
+ * @param theExtend ArrayList of Booleans of whether to extend teh start and end colors past the start and end points
* The default is [false, false]
*/
public PDFShading makeShading(int theShadingType,
ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
- boolean theAntiAlias, Vector theCoords,
- Vector theDomain, PDFFunction theFunction,
- Vector theExtend) { // make Shading of Type 2 or 3
+ ArrayList theBackground, ArrayList theBBox,
+ boolean theAntiAlias, ArrayList theCoords,
+ ArrayList theDomain, PDFFunction theFunction,
+ ArrayList theExtend) { // make Shading of Type 2 or 3
String theShadingName = new String("Sh" + (++this.shadingCount));
PDFShading shading = new PDFShading(++this.objectcount,
this.resources.addShading(shading);
- this.objects.addElement(shading);
+ this.objects.add(shading);
return (shading);
}
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theBitsPerCoordinate 1,2,4,8,12,16,24 or 32.
* @param theBitsPerComponent 1,2,4,8,12, and 16
* @param theBitsPerFlag 2,4,8.
- * @param theDecode Vector of Doubles see PDF 1.3 spec pages 303 to 312.
+ * @param theDecode ArrayList of Doubles see PDF 1.3 spec pages 303 to 312.
* @param theFunction the PDFFunction
*/
public PDFShading makeShading(int theShadingType,
ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
+ ArrayList theBackground, ArrayList theBBox,
boolean theAntiAlias,
int theBitsPerCoordinate,
int theBitsPerComponent,
- int theBitsPerFlag, Vector theDecode,
+ int theBitsPerFlag, ArrayList theDecode,
PDFFunction theFunction) { // make Shading of type 4,6 or 7
String theShadingName = new String("Sh" + (++this.shadingCount));
this.resources.addShading(shading);
- this.objects.addElement(shading);
+ this.objects.add(shading);
return (shading);
}
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Default is false
* @param theBitsPerCoordinate 1,2,4,8,12,16, 24, or 32
* @param theBitsPerComponent 1,2,4,8,12,24,32
- * @param theDecode Vector of Doubles. See page 305 in PDF 1.3 spec.
+ * @param theDecode ArrayList of Doubles. See page 305 in PDF 1.3 spec.
* @param theVerticesPerRow number of vertices in each "row" of the lattice.
* @param theFunction The PDFFunction that's mapped on to this shape
*/
public PDFShading makeShading(int theShadingType,
ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
+ ArrayList theBackground, ArrayList theBBox,
boolean theAntiAlias,
int theBitsPerCoordinate,
- int theBitsPerComponent, Vector theDecode,
+ int theBitsPerComponent, ArrayList theDecode,
int theVerticesPerRow,
PDFFunction theFunction) { // make shading of Type 5
String theShadingName = new String("Sh" + (++this.shadingCount));
this.resources.addShading(shading);
- this.objects.addElement(shading);
+ this.objects.add(shading);
return (shading);
}
* @param theResources the resources associated with this pattern
* @param thePaintType 1 or 2, colored or uncolored.
* @param theTilingType 1, 2, or 3, constant spacing, no distortion, or faster tiling
- * @param theBBox Vector of Doubles: The pattern cell bounding box
+ * @param theBBox ArrayList of Doubles: The pattern cell bounding box
* @param theXStep horizontal spacing
* @param theYStep vertical spacing
- * @param theMatrix Optional Vector of Doubles transformation matrix
+ * @param theMatrix Optional ArrayList of Doubles transformation matrix
* @param theXUID Optional vector of Integers that uniquely identify the pattern
* @param thePatternDataStream The stream of pattern data to be tiled.
*/
public PDFPattern makePattern(int thePatternType, // 1
PDFResources theResources, int thePaintType, int theTilingType,
- Vector theBBox, double theXStep, double theYStep, Vector theMatrix,
- Vector theXUID, StringBuffer thePatternDataStream) {
+ ArrayList theBBox, double theXStep, double theYStep, ArrayList theMatrix,
+ ArrayList theXUID, StringBuffer thePatternDataStream) {
String thePatternName = new String("Pa" + (++this.patternCount));
// int theNumber, String thePatternName,
// PDFResources theResources
thePatternDataStream);
this.resources.addPattern(pattern);
- this.objects.addElement(pattern);
+ this.objects.add(pattern);
return (pattern);
}
* @param theShading the PDF Shading object that comprises this pattern
* @param theXUID optional:the extended unique Identifier if used.
* @param theExtGState optional: the extended graphics state, if used.
- * @param theMatrix Optional:Vector of Doubles that specify the matrix.
+ * @param theMatrix Optional:ArrayList of Doubles that specify the matrix.
*/
public PDFPattern makePattern(int thePatternType, PDFShading theShading,
- Vector theXUID, StringBuffer theExtGState,
- Vector theMatrix) {
+ ArrayList theXUID, StringBuffer theExtGState,
+ ArrayList theMatrix) {
String thePatternName = new String("Pa" + (++this.patternCount));
PDFPattern pattern = new PDFPattern(++this.objectcount,
theXUID, theExtGState, theMatrix);
this.resources.addPattern(pattern);
- this.objects.addElement(pattern);
+ this.objects.add(pattern);
return (pattern);
}
public PDFPattern createGradient(boolean radial,
ColorSpace theColorspace,
- Vector theColors, Vector theBounds,
- Vector theCoords) {
+ ArrayList theColors, ArrayList theBounds,
+ ArrayList theCoords) {
PDFShading myShad;
PDFFunction myfunky;
PDFFunction myfunc;
- Vector theCzero;
- Vector theCone;
+ ArrayList theCzero;
+ ArrayList theCone;
PDFPattern myPattern;
ColorSpace theColorSpace;
double interpolation = (double)1.000;
- Vector theFunctions = new Vector();
+ ArrayList theFunctions = new ArrayList();
int currentPosition;
int lastPosition = theColors.size() - 1;
for (currentPosition = 0; currentPosition < lastPosition;
currentPosition++) { // for every consecutive color pair
PDFColor currentColor =
- (PDFColor)theColors.elementAt(currentPosition);
- PDFColor nextColor = (PDFColor)theColors.elementAt(currentPosition
+ (PDFColor)theColors.get(currentPosition);
+ PDFColor nextColor = (PDFColor)theColors.get(currentPosition
+ 1);
// colorspace must be consistant
if (this.colorspace.getColorSpace()
myfunc = this.makeFunction(2, null, null, theCzero, theCone,
interpolation);
- theFunctions.addElement(myfunc);
+ theFunctions.add(myfunc);
} // end of for every consecutive color pair
} else { // if the center x, center y, and radius specifiy
// the gradient, then assume the same center x, center y,
// and radius of zero for the other necessary component
- Vector newCoords = new Vector();
- newCoords.addElement(theCoords.elementAt(0));
- newCoords.addElement(theCoords.elementAt(1));
- newCoords.addElement(theCoords.elementAt(2));
- newCoords.addElement(theCoords.elementAt(0));
- newCoords.addElement(theCoords.elementAt(1));
- newCoords.addElement(new Double(0.0));
+ ArrayList newCoords = new ArrayList();
+ newCoords.add(theCoords.get(0));
+ newCoords.add(theCoords.get(1));
+ newCoords.add(theCoords.get(2));
+ newCoords.add(theCoords.get(0));
+ newCoords.add(theCoords.get(1));
+ newCoords.add(new Double(0.0));
myShad = this.makeShading(3, this.colorspace, null, null,
false, newCoords, null, myfunky,
*/
PDFEncoding encoding = new PDFEncoding(++this.objectcount,
encodingName);
- this.objects.addElement(encoding);
+ this.objects.add(encoding);
return encoding;
}
if (descriptor == null) {
PDFFont font = new PDFFont(++this.objectcount, fontname,
PDFFont.TYPE1, basefont, encoding);
- this.objects.addElement(font);
+ this.objects.add(font);
return font;
} else {
byte subtype = PDFFont.TYPE1;
* "Identity",
* 0));
* cmap.addContents();
- * this.objects.addElement(cmap);
+ * this.objects.add(cmap);
*/
font =
(PDFFontNonBase14)PDFFont.createFont(++this.objectcount,
fontname, subtype,
basefont, encoding);
}
- this.objects.addElement(font);
+ this.objects.add(font);
font.setDescriptor(pdfdesc);
cidMetrics.getDefaultWidth(),
cidMetrics.getWidths(), sysInfo,
(PDFCIDFontDescriptor)pdfdesc);
- this.objects.addElement(cidFont);
+ this.objects.add(cidFont);
// ((PDFFontType0)font).setCMAP(cmap);
desc.getStemV(),
desc.getItalicAngle());
}
- this.objects.addElement(font);
+ this.objects.add(font);
// Check if the font is embeddable
if (desc.isEmbeddable()) {
if (stream != null) {
this.objectcount++;
font.setFontFile(desc.getSubType(), stream);
- this.objects.addElement(stream);
+ this.objects.add(stream);
}
}
return font;
public PDFArray makeArray(int[] values) {
PDFArray array = new PDFArray(++this.objectcount, values);
- this.objects.addElement(array);
+ this.objects.add(array);
return array;
}
// else, create a new one
xObject = new PDFXObject(++this.objectcount, ++this.xObjectCount,
img);
- this.objects.addElement(xObject);
- this.xObjects.addElement(xObject);
+ this.objects.add(xObject);
+ this.xObjects.add(xObject);
this.xObjectsMap.put(url, xObject);
return xObjectCount;
}
pagewidth, pageheight);
if(pendingLinks != null) {
- for(Enumeration e = pendingLinks.elements(); e.hasMoreElements(); ) {
- PendingLink pl = (PendingLink)e.nextElement();
+ for(int count = 0; count < pendingLinks.size(); count++) {
+ PendingLink pl = (PendingLink)pendingLinks.get(count);
PDFGoTo gt = new PDFGoTo(++this.objectcount,
page.referencePDF());
gt.setDestination(pl.dest);
}
*/
/* add it to the list of objects */
- this.objects.addElement(page);
+ this.objects.add(page);
/* add the page to the Root */
this.root.addPage(page);
PDFAction action;
PDFLink link = new PDFLink(++this.objectcount, rect);
- this.objects.addElement(link);
+ this.objects.add(link);
if (linkType == LinkSet.EXTERNAL) {
// check destination
if (destination.endsWith(".pdf")) { // FileSpec
PDFFileSpec fileSpec = new PDFFileSpec(++this.objectcount,
destination);
- this.objects.addElement(fileSpec);
+ this.objects.add(fileSpec);
action = new PDFGoToRemote(++this.objectcount, fileSpec);
- this.objects.addElement(action);
+ this.objects.add(action);
link.setAction(action);
} else { // URI
PDFUri uri = new PDFUri(destination);
}
public void addTrailerObject(PDFObject object) {
- this.trailerObjects.addElement(object);
+ this.trailerObjects.add(object);
}
class PendingLink {
public PDFLink makeLinkCurrentPage(Rectangle rect, String dest) {
PDFLink link = new PDFLink(++this.objectcount, rect);
- this.objects.addElement(link);
+ this.objects.add(link);
PendingLink pl = new PendingLink();
pl.link = link;
pl.dest = dest;
if(pendingLinks == null) {
- pendingLinks = new Vector();
+ pendingLinks = new ArrayList();
}
- pendingLinks.addElement(pl);
+ pendingLinks.add(pl);
return link;
}
public PDFLink makeLink(Rectangle rect, String page, String dest) {
PDFLink link = new PDFLink(++this.objectcount, rect);
- this.objects.addElement(link);
+ this.objects.add(link);
PDFGoTo gt = new PDFGoTo(++this.objectcount, page);
gt.setDestination(dest);
*/
private void prepareLocations() {
while(location.size() < objectcount)
- location.addElement(locationPlaceholder);
+ location.add(locationPlaceholder);
}
/**
PDFStream obj = new PDFStream(++this.objectcount);
obj.addDefaultFilters();
- this.objects.addElement(obj);
+ this.objects.add(obj);
return obj;
}
* to the list of objects
*/
PDFAnnotList obj = new PDFAnnotList(++this.objectcount);
- this.objects.addElement(obj);
+ this.objects.add(obj);
return obj;
}
if (parent != null) {
parent.addOutline(obj);
}
- this.objects.addElement(obj);
+ this.objects.add(obj);
return obj;
}
prepareLocations();
- Enumeration en = this.objects.elements();
- while (en.hasMoreElements()) {
+ for (int count = 0; count < this.objects.size(); count++) {
/* retrieve the object with the current number */
- PDFObject object = (PDFObject)en.nextElement();
+ PDFObject object = (PDFObject)this.objects.get(count);
/*
* add the position of this object to the list of object
* locations
*/
- location.setElementAt(
- new Integer(this.position),object.getNumber() - 1);
+ location.set(object.getNumber() - 1,
+ new Integer(this.position));
/*
* output the object and increment the character position
public void outputTrailer(OutputStream stream)
throws IOException {
output(stream);
- Enumeration e = trailerObjects.elements();
- while(e.hasMoreElements()) {
- PDFObject o = (PDFObject) e.nextElement();
- this.location.setElementAt(
- new Integer(this.position), o.getNumber() - 1);
+ for(int count = 0; count < trailerObjects.size(); count++) {
+ PDFObject o = (PDFObject) trailerObjects.get(count);
+ this.location.set(o.getNumber() - 1,
+ new Integer(this.position));
this.position += o.output(stream);
}
/* output the xref table and increment the character position
+ (this.objectcount + 1)
+ "\n0000000000 65535 f \n");
- Enumeration en = this.location.elements();
- while (en.hasMoreElements()) {
- String x = en.nextElement().toString();
+ for (int count = 0; count < this.location.size(); count++) {
+ String x = this.location.get(count).toString();
/* contruct xref entry for object */
String padding = "0000000000";
package org.apache.fop.pdf;
// Java
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.ArrayList;
/**
* class representing an /Encoding object.
/**
* the differences from the base encoding
*/
- protected Hashtable differences;
+ protected HashMap differences;
/**
* create the /Encoding object
/* set fields using paramaters */
this.basename = basename;
- this.differences = new Hashtable();
+ this.differences = new HashMap();
}
/**
* @param code the first index of the sequence to be changed
* @param sequence the sequence of glyph names (as String)
*/
- public void addDifferences(int code, Vector sequence) {
+ public void addDifferences(int code, ArrayList sequence) {
differences.put(new Integer(code), sequence);
}
if (!differences.isEmpty()) {
p.append("\n/Differences [ ");
Object code;
- Enumeration codes = differences.keys();
- while (codes.hasMoreElements()) {
- code = codes.nextElement();
+ Iterator codes = differences.keySet().iterator();
+ while (codes.hasNext()) {
+ code = codes.next();
p.append(" ");
p.append(code);
- Vector sequence = (Vector)differences.get(code);
+ ArrayList sequence = (ArrayList)differences.get(code);
for (int i = 0; i < sequence.size(); i++) {
p.append(" /");
- p.append((String)sequence.elementAt(i));
+ p.append((String)sequence.get(i));
}
}
p.append(" ]");
package org.apache.fop.pdf;
// Java...
-import java.util.Vector;
+import java.util.ArrayList;
/**
* class representing a PDF Function.
/**
* Required: 2 * m Array of Double numbers which are possible inputs to the function
*/
- protected Vector domain = null;
+ protected ArrayList domain = null;
/**
* Required: 2 * n Array of Double numbers which are possible outputs to the function
*/
- protected Vector range = null;
+ protected ArrayList range = null;
/* ********************TYPE 0***************************** */
// FunctionType 0 specific function guts
* Note: This is really more like two seperate integers, sizeDomain, and sizeRange,
* but since they're expressed as an array in PDF, my implementation reflects that.
*/
- protected Vector size = null;
+ protected ArrayList size = null;
/**
* Required for Type 0: Number of Bits used to represent each sample value. Limited to 1,2,4,8,12,16,24, or 32
* Required for Type 3: A 2 * k array of Doubles that, taken in pairs, map each subset of the domain defined by Domain and the Bounds array to the domain of the corresponding function.
* Should be two values per function, usually (0,1), as in [0 1 0 1] for 2 functions.
*/
- protected Vector encode = null;
+ protected ArrayList encode = null;
/**
* Optinoal for Type 0: A 2 * n array of Doubles which provides a linear mapping of sample values to the range. Defaults to Range.
*/
- protected Vector decode = null;
+ protected ArrayList decode = null;
/**
* Optional For Type 0: A stream of sample values
* Required (?) For Type 0: A vector of Strings for the various filters to be used to decode the stream.
* These are how the string is compressed. Flate, LZW, etc.
*/
- protected Vector filter = null;
+ protected ArrayList filter = null;
/* *************************TYPE 2************************** */
/**
* Required For Type 2: An Array of n Doubles defining the function result when x=0. Default is [0].
*/
- protected Vector cZero = null;
+ protected ArrayList cZero = null;
/**
* Required For Type 2: An Array of n Doubles defining the function result when x=1. Default is [1].
*/
- protected Vector cOne = null;
+ protected ArrayList cOne = null;
/**
* Required for Type 2: The interpolation exponent.
/**
* Required for Type 3: An vector of PDFFunctions which form an array of k single input functions making up the stitching function.
*/
- protected Vector functions = null;
+ protected ArrayList functions = null;
/**
* Optional for Type 3: An array of (k-1) Doubles that, in combination with Domain, define the intervals to which each function from the Functions array apply. Bounds elements must be in order of increasing magnitude, and each value must be within the value of Domain.
* This makes each function responsible for an equal amount of the stitching function.
* It makes the gradient even.
*/
- protected Vector bounds = null;
+ protected ArrayList bounds = null;
// See encode above, as it's also part of Type 3 Functions.
/* *************************TYPE 4************************** */
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
*
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector objects of Double objects.
+ * @param theRange ArrayList objects of Double objects.
* This is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theSize A Vector object of Integer objects.
+ * @param theSize A ArrayList object of Integer objects.
* This is the number of samples in each input dimension.
* I can't imagine there being more or less than two input dimensions,
* so maybe this should be an array of length 2.
* This attribute is optional.
*
* See page 265 in the PDF 1.3 spec.
- * @param theEncode Vector objects of Double objects.
+ * @param theEncode ArrayList objects of Double objects.
* This is the linear mapping of input values intop the domain
* of the function's sample table. Default is hard to represent in
* ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
* This attribute is optional.
*
* See page 265 in the PDF 1.3 spec.
- * @param theDecode Vector objects of Double objects.
+ * @param theDecode ArrayList objects of Double objects.
* This is a linear mapping of sample values into the range.
* The default is just the range.
*
* @param theFunctionType This is the type of function (0,2,3, or 4).
* It should be 0 as this is the constructor for sampled functions.
*/
- public PDFFunction(int theNumber, int theFunctionType, Vector theDomain,
- Vector theRange, Vector theSize, int theBitsPerSample,
- int theOrder, Vector theEncode, Vector theDecode,
- StringBuffer theFunctionDataStream, Vector theFilter) {
+ public PDFFunction(int theNumber, int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theSize, int theBitsPerSample,
+ int theOrder, ArrayList theEncode, ArrayList theDecode,
+ StringBuffer theFunctionDataStream, ArrayList theFilter) {
super(theNumber);
this.functionType = 0; // dang well better be 0;
* For optional int parameters, pass the default.
*
* @param theNumber the object's number
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector of Doubles that is the Range of the function.
+ * @param theRange ArrayList of Doubles that is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
* @param theCZero This is a vector of Double objects which defines the function result
* when x=0.
* PDF Spec page 268
* @param theFunctionType The type of the function, which should be 2.
*/
- public PDFFunction(int theNumber, int theFunctionType, Vector theDomain,
- Vector theRange, Vector theCZero, Vector theCOne,
+ public PDFFunction(int theNumber, int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theCZero, ArrayList theCOne,
double theInterpolationExponentN) {
super(theNumber);
* For optional int parameters, pass the default.
*
* @param theNumber the object's number
- * @param theDomain Vector objects of Double objects.
+ * @param theDomain ArrayList objects of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector objects of Double objects.
+ * @param theRange ArrayList objects of Double objects.
* This is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theFunctions A Vector of the PDFFunction objects that the stitching function stitches.
+ * @param theFunctions A ArrayList of the PDFFunction objects that the stitching function stitches.
*
* This attributed is required.
* It is described on page 269 of the PDF spec.
*
* This attributed is required.
* It's described on page 269 of the PDF 1.3 spec.
- * @param theEncode Vector objects of Double objects.
+ * @param theEncode ArrayList objects of Double objects.
* This is the linear mapping of input values intop the domain
* of the function's sample table. Default is hard to represent in
* ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
* @param theFunctionType This is the function type. It should be 3,
* for a stitching function.
*/
- public PDFFunction(int theNumber, int theFunctionType, Vector theDomain,
- Vector theRange, Vector theFunctions,
- Vector theBounds, Vector theEncode) {
+ public PDFFunction(int theNumber, int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, ArrayList theFunctions,
+ ArrayList theBounds, ArrayList theEncode) {
super(theNumber);
this.functionType = 3; // dang well better be 3;
* Use null for an optional object parameter if you choose not to use it.
* For optional int parameters, pass the default.
*
- * @param theDomain Vector object of Double objects.
+ * @param theDomain ArrayList object of Double objects.
* This is the domain of the function.
* See page 264 of the PDF 1.3 Spec.
- * @param theRange Vector object of Double objects.
+ * @param theRange ArrayList object of Double objects.
* This is the Range of the function.
* See page 264 of the PDF 1.3 Spec.
* @param theFunctionDataStream This is a stream of arithmetic, boolean, and stack operators and boolean constants.
* @param theFunctionType The type of function which should be 4, as this is
* a Postscript calculator function
*/
- public PDFFunction(int theNumber, int theFunctionType, Vector theDomain,
- Vector theRange, StringBuffer theFunctionDataStream) {
+ public PDFFunction(int theNumber, int theFunctionType, ArrayList theDomain,
+ ArrayList theRange, StringBuffer theFunctionDataStream) {
super(theNumber);
this.functionType = 4; // dang well better be 4;
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("/Size [ ");
vectorSize = this.size.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.size.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.size.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Encode [ ");
vectorSize = this.encode.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.encode.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.encode.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Range [ ");
vectorSize = this.range.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.range.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt))
+ " ");
}
p.append("/Decode [ ");
vectorSize = this.decode.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.decode.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.decode.get(tempInt))
+ " ");
}
vectorSize = this.filter.size();
p.append("/Filter ");
if (vectorSize == 1) {
- p.append("/" + ((String)this.filter.elementAt(0))
+ p.append("/" + ((String)this.filter.get(0))
+ " \n");
} else {
p.append("[ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append("/" + ((String)this.filter.elementAt(0))
+ p.append("/" + ((String)this.filter.get(0))
+ " ");
}
p.append("] \n");
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("/Range [ ");
vectorSize = this.range.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.range.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt))
+ " ");
}
p.append("/C0 [ ");
vectorSize = this.cZero.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.cZero.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.cZero.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/C1 [ ");
vectorSize = this.cOne.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.cOne.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.cOne.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Range [ ");
vectorSize = this.range.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.range.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt))
+ " ");
}
p.append("/Functions [ ");
numberOfFunctions = this.functions.size();
for (tempInt = 0; tempInt < numberOfFunctions; tempInt++) {
- p.append(((PDFFunction)this.functions.elementAt(tempInt)).referencePDF()
+ p.append(((PDFFunction)this.functions.get(tempInt)).referencePDF()
+ " ");
}
p.append("/Encode [ ");
vectorSize = this.encode.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.encode.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.encode.get(tempInt))
+ " ");
}
vectorSize = this.bounds.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.bounds.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.bounds.get(tempInt))
+ " ");
}
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("/Range [ ");
vectorSize = this.range.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.range.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.range.get(tempInt))
+ " ");
}
package org.apache.fop.pdf;
// Java...
-import java.util.Vector;
+import java.util.ArrayList;
// FOP...
import org.apache.fop.datatypes.ColorSpace;
protected int tilingType = 1;
/**
- * Vector of Doubles representing the Bounding box rectangle
+ * ArrayList of Doubles representing the Bounding box rectangle
*/
- protected Vector bBox = null;
+ protected ArrayList bBox = null;
/**
* Horizontal spacing
protected PDFShading shading = null;
/**
- * Vector of Integers represetning the Extended unique Identifier
+ * ArrayList of Integers represetning the Extended unique Identifier
*/
- protected Vector xUID = null;
+ protected ArrayList xUID = null;
/**
* String representing the extended Graphics state.
null; // eventually, need a PDFExtGSState object... but not now.
/**
- * Vector of Doubles representing the Transformation matrix.
+ * ArrayList of Doubles representing the Transformation matrix.
*/
- protected Vector matrix = null;
+ protected ArrayList matrix = null;
/**
* The stream of a pattern
* @param thePatternType the type of pattern, which is 1 for tiling.
* @param thePaintType 1 or 2, colored or uncolored.
* @param theTilingType 1, 2, or 3, constant spacing, no distortion, or faster tiling
- * @param theBBox Vector of Doubles: The pattern cell bounding box
+ * @param theBBox ArrayList of Doubles: The pattern cell bounding box
* @param theXStep horizontal spacing
* @param theYStep vertical spacing
- * @param theMatrix Optional Vector of Doubles transformation matrix
+ * @param theMatrix Optional ArrayList of Doubles transformation matrix
* @param theXUID Optional vector of Integers that uniquely identify the pattern
* @param thePatternDataStream The stream of pattern data to be tiled.
*/
public PDFPattern(int theNumber, String thePatternName,
PDFResources theResources, int thePatternType, // 1
- int thePaintType, int theTilingType, Vector theBBox, double theXStep,
- double theYStep, Vector theMatrix, Vector theXUID,
+ int thePaintType, int theTilingType, ArrayList theBBox, double theXStep,
+ double theYStep, ArrayList theMatrix, ArrayList theXUID,
StringBuffer thePatternDataStream) {
super(theNumber);
this.patternName = thePatternName;
* @param theShading the PDF Shading object that comprises this pattern
* @param theXUID optional:the extended unique Identifier if used.
* @param theExtGState optional: the extended graphics state, if used.
- * @param theMatrix Optional:Vector of Doubles that specify the matrix.
+ * @param theMatrix Optional:ArrayList of Doubles that specify the matrix.
*/
public PDFPattern(int theNumber, String thePatternName,
int thePatternType, PDFShading theShading,
- Vector theXUID, StringBuffer theExtGState,
- Vector theMatrix) {
+ ArrayList theXUID, StringBuffer theExtGState,
+ ArrayList theMatrix) {
super(theNumber);
this.patternName = thePatternName;
vectorSize = this.bBox.size();
p.append("/BBox [ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.bBox.elementAt(tempInt)));
+ p.append(PDFNumber.doubleOut((Double)this.bBox.get(tempInt)));
p.append(" ");
}
p.append("] \n");
vectorSize = this.matrix.size();
p.append("/Matrix [ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.matrix.elementAt(tempInt)));
+ p.append(PDFNumber.doubleOut((Double)this.matrix.get(tempInt)));
p.append(" ");
}
p.append("] \n");
vectorSize = this.xUID.size();
p.append("/XUID [ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(((Integer)this.xUID.elementAt(tempInt)) + " ");
+ p.append(((Integer)this.xUID.get(tempInt)) + " ");
}
p.append("] \n");
}
vectorSize = this.xUID.size();
p.append("/XUID [ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(((Integer)this.xUID.elementAt(tempInt)) + " ");
+ p.append(((Integer)this.xUID.get(tempInt)) + " ");
}
p.append("] \n");
}
vectorSize = this.matrix.size();
p.append("/Matrix [ ");
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.matrix.elementAt(tempInt)));
+ p.append(PDFNumber.doubleOut((Double)this.matrix.get(tempInt)));
p.append(" ");
}
p.append("] \n");
// Java
import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* class representing a /Resources object.
/**
* /Font objects keyed by their internal name
*/
- protected Hashtable fonts = new Hashtable();
+ protected HashMap fonts = new HashMap();
- protected Vector xObjects = null;
- protected Vector patterns = new Vector();
- protected Vector shadings = new Vector();
+ protected ArrayList xObjects = null;
+ protected ArrayList patterns = new ArrayList();
+ protected ArrayList shadings = new ArrayList();
/**
* create a /Resources object.
}
public void addShading(PDFShading theShading) {
- this.shadings.addElement(theShading);
+ this.shadings.add(theShading);
}
public void addPattern(PDFPattern thePattern) {
- this.patterns.addElement(thePattern);
+ this.patterns.add(thePattern);
}
- public void setXObjects(Vector xObjects) {
+ public void setXObjects(ArrayList xObjects) {
this.xObjects = xObjects;
}
p.append("/Font << ");
/* construct PDF dictionary of font object references */
- Enumeration fontEnumeration = this.fonts.keys();
- while (fontEnumeration.hasMoreElements()) {
- String fontName = (String)fontEnumeration.nextElement();
+ Iterator fontIterator = this.fonts.keySet().iterator();
+ while (fontIterator.hasNext()) {
+ String fontName = (String)fontIterator.next();
p.append("/" + fontName + " "
+ ((PDFFont)this.fonts.get(fontName)).referencePDF()
+ " ");
currentShadingNumber < this.shadings.size();
currentShadingNumber++) {
currentShading =
- ((PDFShading)this.shadings.elementAt(currentShadingNumber));
+ ((PDFShading)this.shadings.get(currentShadingNumber));
p.append("/" + currentShading.getName() + " "
+ currentShading.referencePDF() + " "); // \n ??????
currentPatternNumber < this.patterns.size();
currentPatternNumber++) {
currentPattern =
- ((PDFPattern)this.patterns.elementAt(currentPatternNumber));
+ ((PDFPattern)this.patterns.get(currentPatternNumber));
p.append("/" + currentPattern.getName() + " "
+ currentPattern.referencePDF() + " ");
p = p.append("/XObject <<");
for (int i = 1; i <= this.xObjects.size(); i++) {
p = p.append("/Im" + i + " "
- + ((PDFXObject)this.xObjects.elementAt(i - 1)).referencePDF()
+ + ((PDFXObject)this.xObjects.get(i - 1)).referencePDF()
+ " \n");
}
p = p.append(" >>\n");
package org.apache.fop.pdf;
// Java...
-import java.util.Vector;
+import java.util.ArrayList;
// FOP
import org.apache.fop.datatypes.ColorSpace;
* The background color. Since shading is opaque,
* this is very rarely used.
*/
- protected Vector background = null;
+ protected ArrayList background = null;
/**
- * Optional: A Vector specifying the clipping rectangle
+ * Optional: A ArrayList specifying the clipping rectangle
*/
- protected Vector bBox = null;
+ protected ArrayList bBox = null;
/**
* Optional: A flag whether or not to filter the shading function
* Optional for Type 3: An array of two numbers between which the blend varies between start and end points. Default is 0, 1.
*/
- protected Vector domain = null;
+ protected ArrayList domain = null;
/**
* Optional for Type 1: A transformation matrix
*/
- protected Vector matrix = null;
+ protected ArrayList matrix = null;
/**
* Required for Type 1, 2, and 3:
* Required for Type 3: An Array of six numbers [x0,y0,r0,x1,y1,r1] specifying the centers and radii of
* the starting and ending circles.
*/
- protected Vector coords = null;
+ protected ArrayList coords = null;
/**
* Required for Type 2+3: An Array of two boolean values specifying whether to extend the
* start and end colors past the start and end points,
* respectively. Default is false, false.
*/
- protected Vector extend = null;
+ protected ArrayList extend = null;
/**
* Required for Type 4,5,6, and 7: Specifies the number of bits used to represent each vertex coordinate.
* Each type has a differing number of decode array members, so check the spec.
* Page 303 in PDF Spec 1.3
*/
- protected Vector decode = null;
+ protected ArrayList decode = null;
/**
* Required for Type 4,5,6, and 7: Specifies the number of bits used to represent each color coordinate.
* @param theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Whether or not to anti-alias.
* @param theDomain Optional vector of Doubles specifying the domain.
- * @param theMatrix Vector of Doubles specifying the matrix.
+ * @param theMatrix ArrayList of Doubles specifying the matrix.
* If it's a pattern, then the matrix maps it to pattern space.
* If it's a shading, then it maps it to current user space.
* It's optional, the default is the identity matrix
*/
public PDFShading(int theNumber, String theShadingName,
int theShadingType, ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
- boolean theAntiAlias, Vector theDomain,
- Vector theMatrix, PDFFunction theFunction) {
+ ArrayList theBackground, ArrayList theBBox,
+ boolean theAntiAlias, ArrayList theDomain,
+ ArrayList theMatrix, PDFFunction theFunction) {
super(theNumber);
this.shadingName = theShadingName;
this.shadingType = theShadingType; // 1
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Default is false
- * @param theCoords Vector of four (type 2) or 6 (type 3) Double
- * @param theDomain Vector of Doubles specifying the domain
+ * @param theCoords ArrayList of four (type 2) or 6 (type 3) Double
+ * @param theDomain ArrayList of Doubles specifying the domain
* @param theFunction the Stitching (PDFfunction type 3) function, even if it's stitching a single function
- * @param theExtend Vector of Booleans of whether to extend teh start and end colors past the start and end points
+ * @param theExtend ArrayList of Booleans of whether to extend teh start and end colors past the start and end points
* The default is [false, false]
*/
public PDFShading(int theNumber, String theShadingName,
int theShadingType, ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
- boolean theAntiAlias, Vector theCoords,
- Vector theDomain, PDFFunction theFunction,
- Vector theExtend) {
+ ArrayList theBackground, ArrayList theBBox,
+ boolean theAntiAlias, ArrayList theCoords,
+ ArrayList theDomain, PDFFunction theFunction,
+ ArrayList theExtend) {
super(theNumber);
this.shadingName = theShadingName;
this.shadingType = theShadingType; // 2 or 3
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theBitsPerCoordinate 1,2,4,8,12,16,24 or 32.
* @param theBitsPerComponent 1,2,4,8,12, and 16
* @param theBitsPerFlag 2,4,8.
- * @param theDecode Vector of Doubles see PDF 1.3 spec pages 303 to 312.
+ * @param theDecode ArrayList of Doubles see PDF 1.3 spec pages 303 to 312.
* @param theFunction the PDFFunction
*/
public PDFShading(int theNumber, String theShadingName,
int theShadingType, ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
+ ArrayList theBackground, ArrayList theBBox,
boolean theAntiAlias, int theBitsPerCoordinate,
int theBitsPerComponent, int theBitsPerFlag,
- Vector theDecode, PDFFunction theFunction) {
+ ArrayList theDecode, PDFFunction theFunction) {
super(theNumber);
this.shadingType = theShadingType; // 4,6 or 7
* @param theBackground theBackground An array of color components appropriate to the
* colorspace key specifying a single color value.
* This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox Vector of double's representing a rectangle
+ * @param theBBox ArrayList of double's representing a rectangle
* in the coordinate space that is current at the
* time of shading is imaged. Temporary clipping
* boundary.
* @param theAntiAlias Default is false
* @param theBitsPerCoordinate 1,2,4,8,12,16, 24, or 32
* @param theBitsPerComponent 1,2,4,8,12,24,32
- * @param theDecode Vector of Doubles. See page 305 in PDF 1.3 spec.
+ * @param theDecode ArrayList of Doubles. See page 305 in PDF 1.3 spec.
* @param theVerticesPerRow number of vertices in each "row" of the lattice.
* @param theFunction The PDFFunction that's mapped on to this shape
* @param theNumber the object number of this PDF object.
*/
public PDFShading(int theNumber, String theShadingName,
int theShadingType, ColorSpace theColorSpace,
- Vector theBackground, Vector theBBox,
+ ArrayList theBackground, ArrayList theBBox,
boolean theAntiAlias, int theBitsPerCoordinate,
- int theBitsPerComponent, Vector theDecode,
+ int theBitsPerComponent, ArrayList theDecode,
int theVerticesPerRow, PDFFunction theFunction) {
super(theNumber);
this.shadingName = theShadingName;
p.append("/Background [ ");
vectorSize = this.background.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.background.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.background.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/BBox [ ");
vectorSize = this.bBox.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.bBox.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.bBox.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Matrix [ ");
vectorSize = this.matrix.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.matrix.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.matrix.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Coords [ ");
vectorSize = this.coords.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.coords.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.coords.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Domain [ ");
vectorSize = this.domain.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(PDFNumber.doubleOut((Double)this.domain.elementAt(tempInt))
+ p.append(PDFNumber.doubleOut((Double)this.domain.get(tempInt))
+ " ");
}
p.append("] \n");
p.append("/Extend [ ");
vectorSize = this.extend.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(((Boolean)this.extend.elementAt(tempInt)) + " ");
+ p.append(((Boolean)this.extend.get(tempInt)) + " ");
}
p.append("] \n");
p.append("/Decode [ ");
vectorSize = this.decode.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(((Boolean)this.decode.elementAt(tempInt)) + " ");
+ p.append(((Boolean)this.decode.get(tempInt)) + " ");
}
p.append("] \n");
p.append("/Decode [ ");
vectorSize = this.decode.size();
for (tempInt = 0; tempInt < vectorSize; tempInt++) {
- p.append(((Boolean)this.decode.elementAt(tempInt)) + " ");
+ p.append(((Boolean)this.decode.get(tempInt)) + " ");
}
p.append("] \n");
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.IOException;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Enumeration;
import org.apache.fop.configuration.Configuration;
import org.apache.fop.messaging.MessageHandler;
/**
* the filters that should be applied
*/
- private Vector _filters;
+ private ArrayList _filters;
/**
* create an empty stream object
public PDFStream(int number) {
super(number);
_data = new ByteArrayOutputStream();
- _filters = new Vector();
+ _filters = new ArrayList();
}
/**
*/
public void addFilter(PDFFilter filter) {
if (filter != null) {
- _filters.addElement(filter);
+ _filters.add(filter);
}
}
protected void addDefaultFilters() {
- Vector filters = Configuration.getListValue("stream-filter-list",
+ ArrayList filters = Configuration.getListValue("stream-filter-list",
Configuration.PDF);
if (filters == null) {
// try getting it as a String
}
} else {
for (int i = 0; i < filters.size(); i++) {
- String v = (String)filters.elementAt(i);
+ String v = (String)filters.get(i);
addFilter(v);
}
}
*/
protected String applyFilters() throws IOException {
if (_filters.size() > 0) {
- Vector names = new Vector();
- Vector parms = new Vector();
+ ArrayList names = new ArrayList();
+ ArrayList parms = new ArrayList();
// run the filters
- Enumeration e = _filters.elements();
- while (e.hasMoreElements()) {
- PDFFilter filter = (PDFFilter)e.nextElement();
+ for (int count = 0; count < _filters.size(); count++) {
+ PDFFilter filter = (PDFFilter)_filters.get(count);
// apply the filter encoding if neccessary
if (!filter.isApplied()) {
byte[] tmp = filter.encode(_data.toByteArray());
filter.setApplied(true);
}
// place the names in our local vector in reverse order
- names.insertElementAt(filter.getName(), 0);
- parms.insertElementAt(filter.getDecodeParms(), 0);
+ names.add(0, filter.getName());
+ parms.add(0, filter.getDecodeParms());
}
// now build up the filter entries for the dictionary
}
- private String buildFilterEntries(Vector names) {
+ private String buildFilterEntries(ArrayList names) {
StringBuffer sb = new StringBuffer();
sb.append("/Filter ");
if (names.size() > 1) {
sb.append("[ ");
}
- Enumeration e = names.elements();
- while (e.hasMoreElements()) {
- sb.append((String)e.nextElement());
+ for (int count = 0; count < names.size(); count++) {
+ sb.append((String)names.get(count));
sb.append(" ");
}
if (names.size() > 1) {
return sb.toString();
}
- private String buildDecodeParms(Vector parms) {
+ private String buildDecodeParms(ArrayList parms) {
StringBuffer sb = new StringBuffer();
boolean needParmsEntry = false;
sb.append("/DecodeParms ");
if (parms.size() > 1) {
sb.append("[ ");
}
- Enumeration e = parms.elements();
- while (e.hasMoreElements()) {
- String s = (String)e.nextElement();
+ for (int count = 0; count < parms.size(); count++) {
+ String s = (String)parms.get(count);
if (s != null) {
sb.append(s);
needParmsEntry = true;
package org.apache.fop.pdf;
-import java.util.Vector;
+import java.util.ArrayList;
/**
* class representing a <b>W</b> array for CID fonts.
/**
* the metrics
*/
- private Vector entries;
+ private ArrayList entries;
public PDFWArray() {
- entries = new Vector();
+ entries = new ArrayList();
}
/**
* @param metrics the metrics array.
*/
public void addEntry(int start, int[] metrics) {
- entries.addElement(new Entry(start, metrics));
+ entries.add(new Entry(start, metrics));
}
/**
* @param width the width for all CIDs in the range
*/
public void addEntry(int first, int last, int width) {
- entries.addElement(new int[] {
+ entries.add(new int[] {
first, last, width
});
}
* @param posY the y component for the vertical position vector
*/
public void addEntry(int first, int last, int width, int posX, int posY) {
- entries.addElement(new int[] {
+ entries.add(new int[] {
first, last, width, posX, posY
});
}
p.append("[ ");
int len = entries.size();
for (int i = 0; i < len; i++) {
- Object entry = entries.elementAt(i);
+ Object entry = entries.get(i);
if (entry instanceof int[]) {
int[] line = (int[])entry;
for (int j = 0; j < line.length; j++) {
// import org.apache.fop.pdf.PDFResources;
// Java
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.HashMap;
/**
* sets up the PDF fonts.
public static void addToFontFormat(MIFDocument mifDoc,
FontInfo fontInfo) {
- Hashtable fonts = fontInfo.getFonts();
- Enumeration e = fonts.keys();
- while (e.hasMoreElements()) {
- String f = (String)e.nextElement();
+ HashMap fonts = fontInfo.getFonts();
+ Iterator e = fonts.keySet().iterator();
+ while (e.hasNext()) {
+ String f = (String)e.next();
Font font = (Font)fonts.get(f);
FontDescriptor desc = null;
if (font instanceof FontDescriptor) {
import org.xml.sax.Attributes;
import java.io.IOException;
import java.util.Enumeration;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Hashtable;
import org.apache.fop.pdf.PDFWArray;
import org.apache.fop.pdf.PDFCIDFont;
// private SingleByteFont singleFont = null;
private String text = null;
- private Vector cidWidths = null;
+ private ArrayList cidWidths = null;
private int cidWidthIndex = 0;
private Hashtable currentKerning = null;
- private Vector bfranges = null;
+ private ArrayList bfranges = null;
private void createFont(String path) throws FOPException {
XMLReader parser = ConfigurationReader.createParser();
}
} else if ("cid-widths".equals(localName)) {
cidWidthIndex = getInt(attributes.getValue("start-index"));
- cidWidths = new Vector();
+ cidWidths = new ArrayList();
} else if ("kerning".equals(localName)) {
currentKerning = new Hashtable();
if (isCID)
singleFont.kerning.put(new Integer(attributes.getValue("kpx1")),
currentKerning);
} else if ("bfranges".equals(localName)) {
- bfranges = new Vector();
+ bfranges = new ArrayList();
} else if ("bf".equals(localName)) {
BFEntry entry = new BFEntry();
entry.unicodeStart = getInt(attributes.getValue("us"));
entry.unicodeEnd = getInt(attributes.getValue("ue"));
entry.glyphStartIndex = getInt(attributes.getValue("gi"));
- bfranges.addElement(entry);
+ bfranges.add(entry);
} else if ("wx".equals(localName)) {
- cidWidths.addElement(new Integer(attributes.getValue("w")));
+ cidWidths.add(new Integer(attributes.getValue("w")));
} else if ("widths".equals(localName)) {
singleFont.width = new int[256];
} else if ("char".equals(localName)) {
} else if ("cid-widths".equals(localName)) {
int[] wds = new int[cidWidths.size()];
int j = 0;
- for (Enumeration e = cidWidths.elements();
- e.hasMoreElements(); ) {
- Integer i = (Integer)e.nextElement();
+ for (int count = 0; count < cidWidths.size(); count++) {
+ Integer i = (Integer)cidWidths.get(count);
wds[j++] = i.intValue();
}
multiFont.width = wds;
} else if ("bfranges".equals(localName)) {
- BFEntry[] entries = new BFEntry[bfranges.size()];
- bfranges.copyInto(entries);
- multiFont.bfentries = entries;
+ multiFont.bfentries = (BFEntry[])bfranges.toArray(new BFEntry[0]);
}
}
import org.apache.fop.configuration.FontTriplet;
// Java
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.ArrayList;
/**
* sets up the PDF fonts.
String internalName = null;
FontReader reader = null;
- Vector fontInfos = Configuration.getFonts();
+ ArrayList fontInfos = Configuration.getFonts();
if (fontInfos == null)
return;
- for (Enumeration e = fontInfos.elements(); e.hasMoreElements(); ) {
+ for (int count = 0; count < fontInfos.size(); count++) {
org.apache.fop.configuration.FontInfo configFontInfo =
- (org.apache.fop.configuration.FontInfo)e.nextElement();
+ (org.apache.fop.configuration.FontInfo)fontInfos.get(count);
try {
String metricsFile = configFontInfo.getMetricsFile();
configFontInfo.getKerning());
fontInfo.addMetrics(internalName, font);
- Vector triplets = configFontInfo.getFontTriplets();
- for (Enumeration t = triplets.elements();
- t.hasMoreElements(); ) {
- FontTriplet triplet = (FontTriplet)t.nextElement();
+ ArrayList triplets = configFontInfo.getFontTriplets();
+ for (int c = 0; c < triplets.size(); c++) {
+ FontTriplet triplet = (FontTriplet)triplets.get(c);
fontInfo.addFontProperties(internalName,
triplet.getName(),
* @param fontInfo font info object to get font information from
*/
public static void addToResources(PDFDocument doc, FontInfo fontInfo) {
- Hashtable fonts = fontInfo.getUsedFonts();
- Enumeration e = fonts.keys();
+ HashMap fonts = fontInfo.getUsedFonts();
+ Iterator e = fonts.keySet().iterator();
PDFResources resources = doc.getResources();
- while (e.hasMoreElements()) {
- String f = (String)e.nextElement();
+ while (e.hasNext()) {
+ String f = (String)e.next();
Font font = (Font)fonts.get(f);
FontDescriptor desc = null;
if (font instanceof FontDescriptor) {
import java.io.*;
import java.util.Map;
-import java.util.Vector;
+import java.util.ArrayList;
/**
* This concrete implementation of <tt>AbstractGraphics2D</tt> is a
Point2D p2 = gp.getPoint2();
boolean cyclic = gp.isCyclic();
- Vector theCoords = new Vector();
- theCoords.addElement(new Double(p1.getX()));
- theCoords.addElement(new Double(p1.getY()));
- theCoords.addElement(new Double(p2.getX()));
- theCoords.addElement(new Double(p2.getY()));
+ ArrayList theCoords = new ArrayList();
+ theCoords.add(new Double(p1.getX()));
+ theCoords.add(new Double(p1.getY()));
+ theCoords.add(new Double(p2.getX()));
+ theCoords.add(new Double(p2.getY()));
- Vector theExtend = new Vector();
- theExtend.addElement(new Boolean(true));
- theExtend.addElement(new Boolean(true));
+ ArrayList theExtend = new ArrayList();
+ theExtend.add(new Boolean(true));
+ theExtend.add(new Boolean(true));
- Vector theDomain = new Vector();
- theDomain.addElement(new Double(0));
- theDomain.addElement(new Double(1));
+ ArrayList theDomain = new ArrayList();
+ theDomain.add(new Double(0));
+ theDomain.add(new Double(1));
- Vector theEncode = new Vector();
- theEncode.addElement(new Double(0));
- theEncode.addElement(new Double(1));
- theEncode.addElement(new Double(0));
- theEncode.addElement(new Double(1));
+ ArrayList theEncode = new ArrayList();
+ theEncode.add(new Double(0));
+ theEncode.add(new Double(1));
+ theEncode.add(new Double(0));
+ theEncode.add(new Double(1));
- Vector theBounds = new Vector();
- theBounds.addElement(new Double(0));
- theBounds.addElement(new Double(1));
+ ArrayList theBounds = new ArrayList();
+ theBounds.add(new Double(0));
+ theBounds.add(new Double(1));
- Vector theFunctions = new Vector();
+ ArrayList theFunctions = new ArrayList();
- Vector someColors = new Vector();
+ ArrayList someColors = new ArrayList();
PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
c1.getBlue());
- someColors.addElement(color1);
+ someColors.add(color1);
PDFColor color2 = new PDFColor(c2.getRed(), c2.getGreen(),
c2.getBlue());
- someColors.addElement(color2);
+ someColors.add(color2);
ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
} else if (paint instanceof TexturePaint) {}
import java.util.*;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.HashMap;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.Point;
// write("/gfF1{/Helvetica findfont} bd");
// write("/gfF3{/Helvetica-Bold findfont} bd");
- Hashtable fonts = fontInfo.getFonts();
- Enumeration enum = fonts.keys();
- while (enum.hasMoreElements()) {
- String key = (String)enum.nextElement();
+ HashMap fonts = fontInfo.getFonts();
+ Iterator enum = fonts.keySet().iterator();
+ while (enum.hasNext()) {
+ String key = (String)enum.next();
Font fm = (Font)fonts.get(key);
write("/" + key + " /" + fm.fontName() + " def");
}
write("end def");
write("%%EndResource");
- enum = fonts.keys();
- while (enum.hasMoreElements()) {
- String key = (String)enum.nextElement();
+ enum = fonts.keySet().iterator();
+ while (enum.hasNext()) {
+ String key = (String)enum.next();
Font fm = (Font)fonts.get(key);
write("/" + fm.fontName() + " findfont");
write("dup length dict begin");
// Java
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
/**
* Renderer that renders areas to plain text
import java.io.*;
import java.util.Map;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Hashtable;
/**
Point2D p2 = gp.getPoint2();
boolean cyclic = gp.isCyclic();
- Vector theCoords = new Vector();
- theCoords.addElement(new Double(p1.getX()));
- theCoords.addElement(new Double(p1.getY()));
- theCoords.addElement(new Double(p2.getX()));
- theCoords.addElement(new Double(p2.getY()));
+ ArrayList theCoords = new ArrayList();
+ theCoords.add(new Double(p1.getX()));
+ theCoords.add(new Double(p1.getY()));
+ theCoords.add(new Double(p2.getX()));
+ theCoords.add(new Double(p2.getY()));
- Vector theExtend = new Vector();
- theExtend.addElement(new Boolean(true));
- theExtend.addElement(new Boolean(true));
+ ArrayList theExtend = new ArrayList();
+ theExtend.add(new Boolean(true));
+ theExtend.add(new Boolean(true));
- Vector theDomain = new Vector();
- theDomain.addElement(new Double(0));
- theDomain.addElement(new Double(1));
+ ArrayList theDomain = new ArrayList();
+ theDomain.add(new Double(0));
+ theDomain.add(new Double(1));
- Vector theEncode = new Vector();
- theEncode.addElement(new Double(0));
- theEncode.addElement(new Double(1));
- theEncode.addElement(new Double(0));
- theEncode.addElement(new Double(1));
+ ArrayList theEncode = new ArrayList();
+ theEncode.add(new Double(0));
+ theEncode.add(new Double(1));
+ theEncode.add(new Double(0));
+ theEncode.add(new Double(1));
- Vector theBounds = new Vector();
- theBounds.addElement(new Double(0));
- theBounds.addElement(new Double(1));
+ ArrayList theBounds = new ArrayList();
+ theBounds.add(new Double(0));
+ theBounds.add(new Double(1));
- Vector theFunctions = new Vector();
+ ArrayList theFunctions = new ArrayList();
- Vector someColors = new Vector();
+ ArrayList someColors = new ArrayList();
PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
c1.getBlue());
- someColors.addElement(color1);
+ someColors.add(color1);
PDFColor color2 = new PDFColor(c2.getRed(), c2.getGreen(),
c2.getBlue());
- someColors.addElement(color2);
+ someColors.add(color2);
PDFFunction myfunc = this.pdfDoc.makeFunction(2, theDomain, null,
color1.getVector(), color2.getVector(), 1.0);
// Java
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.Point;
public void setFilenames(String filenames) {
StringTokenizer tokens = new StringTokenizer(filenames, ",");
- Vector filenameListTmp = new Vector(20);
+ ArrayList filenameListTmp = new ArrayList(20);
while (tokens.hasMoreTokens()) {
- filenameListTmp.addElement(tokens.nextToken());
+ filenameListTmp.add(tokens.nextToken());
}
filenameList = new String[filenameListTmp.size()];
- filenameListTmp.copyInto((String[])filenameList);
+ filenameList = (String[])filenameListTmp.toArray(new String[0]);
}
private boolean compareBytes(File oldFile, File newFile) {
private String configFile, outFile;
private String[] filenameList;
private String filenames;
- private Vector files = new Vector();
+ private ArrayList files = new ArrayList();
// sets name of configuration file, which must
// be an xml file conforming to the book.dtd used by xml-site
public void endDocument() throws SAXException {
String line, filename;
BufferedReader in;
- Enumeration iterator = files.elements();
try {
BufferedWriter out =
new BufferedWriter(new FileWriter("compileXMLFiles-tmp.xml"));
out.write("<?xml version=\"1.0\"?>\n"
+ "<!DOCTYPE documentation [\n"
+ "<!ENTITY nbsp \" \">\n" + "]>\n<documentation>");
- while (iterator.hasMoreElements()) {
- filename = (String)iterator.nextElement();
+ for(int count = 0; count < files.size(); count++) {
+ filename = (String)files.get(count);
in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
// kill the lines pointing to the sbk protocol and the xml declaration
String id, label, source;
if (name.equals("document") || name.equals("entry")) {
source = atts.getValue("source");
- files.addElement(source);
+ files.add(source);
}
}
*/
public class Fop extends Task {
File foFile;
- Vector filesets = new Vector();
+ ArrayList filesets = new ArrayList();
File outFile;
File outDir;
String format; //MIME type
* Adds a set of fo files (nested fileset attribute).
*/
public void addFileset(FileSet set) {
- filesets.addElement(set);
+ filesets.add(set);
}
/**
// deal with the filesets
for (int i = 0; i < task.filesets.size(); i++) {
- FileSet fs = (FileSet) task.filesets.elementAt(i);
+ FileSet fs = (FileSet) task.filesets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(task.getProject());
String[] files = ds.getIncludedFiles();
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.ArrayList;
import javax.swing.*;
showIt = new showProgress(error, true);
} else {
StringTokenizer tok = new StringTokenizer(error, " ");
- Vector labels = new Vector();
+ ArrayList labels = new ArrayList();
StringBuffer buffer = new StringBuffer();
String tmp, list[];
labels.add(buffer.toString());
list = new String[labels.size()];
for (int i = 0; i < labels.size(); i++) {
- list[i] = labels.elementAt(i).toString();
+ list[i] = labels.get(i).toString();
}
showIt = new showProgress(list, true);
}