]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
changed a few more vector and hastable
authorKeiron Liddle <keiron@apache.org>
Wed, 14 Nov 2001 13:45:45 +0000 (13:45 +0000)
committerKeiron Liddle <keiron@apache.org>
Wed, 14 Nov 2001 13:45:45 +0000 (13:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194566 13f79535-47bb-0310-9956-ffa450edef68

30 files changed:
src/org/apache/fop/fo/FObj.java
src/org/apache/fop/fo/FObjMixed.java
src/org/apache/fop/fo/PropertyList.java
src/org/apache/fop/fo/expr/PropertyParser.java
src/org/apache/fop/fo/flow/BasicLink.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/BlockContainer.java
src/org/apache/fop/fo/flow/ExternalGraphic.java
src/org/apache/fop/fo/flow/Flow.java
src/org/apache/fop/fo/flow/Footnote.java
src/org/apache/fop/fo/flow/FootnoteBody.java
src/org/apache/fop/fo/flow/InstreamForeignObject.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/ListItemBody.java
src/org/apache/fop/fo/flow/ListItemLabel.java
src/org/apache/fop/fo/flow/Marker.java
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableBody.java
src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableRow.java
src/org/apache/fop/fo/pagination/LayoutMasterSet.java
src/org/apache/fop/fo/pagination/PageSequence.java
src/org/apache/fop/fo/pagination/Root.java
src/org/apache/fop/fo/pagination/SimplePageMaster.java
src/org/apache/fop/fonts/PFMFile.java
src/org/apache/fop/fonts/TTFFile.java
src/org/apache/fop/fonts/TTFMtxEntry.java
src/org/apache/fop/fonts/apps/PFMReader.java
src/org/apache/fop/fonts/apps/TTFReader.java

index 325a937c105428090767380e03c54a38bb40880c..326f9674f0af21436193f391a32cbc4ff4f25bd3 100644 (file)
@@ -26,8 +26,8 @@ import org.xml.sax.Attributes;
 
 import java.util.Iterator;
 import java.util.ListIterator;
-import java.util.Vector;
-import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.HashMap;
 
 /**
  * base class for representation of formatting objects and their processing
@@ -54,7 +54,7 @@ public class FObj extends FONode {
      */
     protected int marker = START;
 
-    protected Vector children = new Vector();    // made public for searching for id's
+    protected ArrayList children = new ArrayList();    // made public for searching for id's
 
     protected boolean isInTableCell = false;
 
@@ -70,11 +70,11 @@ public class FObj extends FONode {
     public int areasGenerated = 0;
 
     // markers
-    protected Hashtable markers;
+    protected HashMap markers;
 
     public FObj(FONode parent) {
         super(parent);
-        markers = new Hashtable();
+        markers = new HashMap();
         if (parent instanceof FObj)
             this.areaClass = ((FObj)parent).areaClass;
     }
@@ -127,7 +127,7 @@ public class FObj extends FONode {
     }
 
     protected void addChild(FONode child) {
-        children.addElement(child);
+        children.add(child);
     }
 
     /**
@@ -165,7 +165,7 @@ public class FObj extends FONode {
         idReferences.removeID(((FObj)this).properties.get("id").getString());
         int numChildren = this.children.size();
         for (int i = 0; i < numChildren; i++) {
-            FONode child = (FONode)children.elementAt(i);
+            FONode child = (FONode)children.get(i);
             if ((child instanceof FObj)) {
                 ((FObj)child).removeID(idReferences);
             }
@@ -213,7 +213,7 @@ public class FObj extends FONode {
         this.isInTableCell = true;
         // made recursive by Eric Schaeffer
         for (int i = 0; i < this.children.size(); i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.setIsInTableCell();
@@ -225,7 +225,7 @@ public class FObj extends FONode {
         this.forcedStartOffset = offset; 
         // made recursive by Eric Schaeffer
         for (int i = 0; i < this.children.size(); i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.forceStartOffset(offset);
@@ -237,7 +237,7 @@ public class FObj extends FONode {
         this.forcedWidth = width;
         // made recursive by Eric Schaeffer
         for (int i = 0; i < this.children.size(); i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.forceWidth(width);
@@ -249,7 +249,7 @@ public class FObj extends FONode {
         this.marker = START;
         int numChildren = this.children.size();
         for (int i = 0; i < numChildren; i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.resetMarker();
@@ -272,7 +272,7 @@ public class FObj extends FONode {
     public void setLinkSet(LinkSet linkSet) {
         this.linkSet = linkSet;
         for (int i = 0; i < this.children.size(); i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.setLinkSet(linkSet);
@@ -288,11 +288,11 @@ public class FObj extends FONode {
      * At the start of a new span area layout may be partway through a
      * nested FO, and balancing requires rollback to this known point.
      * The snapshot records exactly where layout is at.
-     * @param snapshot a Vector of markers (Integer)
-     * @returns the updated Vector of markers (Integers)
+     * @param snapshot a ArrayList of markers (Integer)
+     * @returns the updated ArrayList of markers (Integers)
      */
-    public Vector getMarkerSnapshot(Vector snapshot) {
-        snapshot.addElement(new Integer(this.marker));
+    public ArrayList getMarkerSnapshot(ArrayList snapshot) {
+        snapshot.add(new Integer(this.marker));
 
         // terminate if no kids or child not yet accessed
         if (this.marker < 0)
@@ -300,18 +300,18 @@ public class FObj extends FONode {
         else if (children.isEmpty())
             return snapshot;
         else
-            return ((FObj)children.elementAt(this.marker)).getMarkerSnapshot(snapshot);
+            return ((FObj)children.get(this.marker)).getMarkerSnapshot(snapshot);
     }
 
     /**
      * When balancing occurs, the flow layout() method restarts at the
      * point specified by the current marker snapshot, which is retrieved
      * and restored using this method.
-     * @param snapshot the Vector of saved markers (Integers)
+     * @param snapshot the ArrayList of saved markers (Integers)
      */
-    public void rollback(Vector snapshot) {
-        this.marker = ((Integer)snapshot.elementAt(0)).intValue();
-        snapshot.removeElementAt(0);
+    public void rollback(ArrayList snapshot) {
+        this.marker = ((Integer)snapshot.get(0)).intValue();
+        snapshot.remove(0);
 
         if (this.marker == START) {
             // make sure all the children of this FO are also reset
@@ -327,13 +327,13 @@ public class FObj extends FONode {
         }
 
         for (int i = this.marker + 1; i < numChildren; i++) {
-            Object obj = this.children.elementAt(i);
+            Object obj = this.children.get(i);
             if(obj instanceof FObj) {
                 FObj child = (FObj)obj;
                 child.resetMarker();
             }
         }
-        ((FObj)children.elementAt(this.marker)).rollback(snapshot);
+        ((FObj)children.get(this.marker)).rollback(snapshot);
     }
 
 
@@ -353,8 +353,8 @@ public class FObj extends FONode {
         return !markers.isEmpty();
     }
 
-    public Vector getMarkers() {
-        return new Vector(markers.values());
+    public ArrayList getMarkers() {
+        return new ArrayList(markers.values());
     }
 }
 
index 5a535be8461035ad83b526fc86342477bc8121dc..cb7b4b3fff39b2dac151894d232538a0df10003d 100644 (file)
@@ -83,7 +83,7 @@ public class FObjMixed extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             Status status;
             if ((status = fo.layout(area)).isIncomplete()) {
                 this.marker = i;
index f6cd8747fd5fc6d97839e3181ddd35543e2fbc01..cb8d89d818970e39b2330745db949e99b8a1cdd9 100644 (file)
@@ -7,12 +7,12 @@
 
 package org.apache.fop.fo;
 
-import java.util.Hashtable;
+import java.util.HashMap;
 import org.apache.fop.messaging.MessageHandler;
 import org.apache.fop.fo.properties.WritingMode;
 import org.apache.fop.apps.FOPException;
 
-public class PropertyList extends Hashtable {
+public class PropertyList extends HashMap {
 
     private byte[] wmtable = null;    // writing-mode values
     public static final int LEFT = 0;
@@ -38,7 +38,7 @@ public class PropertyList extends Hashtable {
         "inline-progression-dimension"
     };
 
-    static private final Hashtable wmtables = new Hashtable(4);
+    static private final HashMap wmtables = new HashMap(4);
     {
         wmtables.put(new Integer(WritingMode.LR_TB),    /* lr-tb */
         new byte[] {
index f41cfc43ad0299667b047b641c895af4990180ec..aa113834a0671194e9bafdb8c64fc6d7d2a4aa4f 100644 (file)
@@ -15,7 +15,7 @@ import org.apache.fop.fo.StringProperty;
 import org.apache.fop.fo.ColorTypeProperty;
 import org.apache.fop.datatypes.*;
 
-import java.util.Hashtable;
+import java.util.HashMap;
 
 /**
  * Class to parse XSL FO property expression.
@@ -27,10 +27,10 @@ public class PropertyParser extends PropertyTokenizer {
 
     static private final String RELUNIT = "em";
     static private final Numeric negOne = new Numeric(new Double(-1.0));
-    static final private Hashtable functionTable = new Hashtable();
+    static final private HashMap functionTable = new HashMap();
 
     static {
-        // Initialize the Hashtable of XSL-defined functions
+        // Initialize the HashMap of XSL-defined functions
         functionTable.put("ceiling", new CeilingFunction());
         functionTable.put("floor", new FloorFunction());
         functionTable.put("round", new RoundFunction());
index 0530385cd8c49f6f67b60d0ffaadb03cfdacea83..5b83443417d0e48c5139a2293e798add47f7d1d7 100644 (file)
@@ -92,7 +92,7 @@ public class BasicLink extends Inline {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             if(fo instanceof FObj)
                 ((FObj)fo).setLinkSet(ls);
 
index 196cf6aa02c3ee94d55a6d79002906faf73a267e..3b43e16cb192c48dc8cfc810c15a64989147dc5c 100644 (file)
@@ -174,13 +174,13 @@ public class Block extends FObjMixed {
 
             int numChildren = this.children.size();
             for (int i = 0; i < numChildren; i++) {
-                FONode fo = (FONode)children.elementAt(i);
+                FONode fo = (FONode)children.get(i);
                 if (fo instanceof FOText) {
                     if (((FOText)fo).willCreateArea()) {
                         //fo.setWidows(blockWidows);
                         break;
                     } else {
-                        children.removeElementAt(i);
+                        children.remove(i);
                         numChildren = this.children.size();
                         i--;
                     }
@@ -191,7 +191,7 @@ public class Block extends FObjMixed {
             }
 
             for (int i = numChildren - 1; i >= 0; i--) {
-                FONode fo = (FONode)children.elementAt(i);
+                FONode fo = (FONode)children.get(i);
                 if (fo instanceof FOText) {
                     if (((FOText)fo).willCreateArea()) {
                         //fo.setOrphans(blockOrphans);
@@ -230,8 +230,8 @@ public class Block extends FObjMixed {
         blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            blockArea.addMarkers(this.getMarkers());
+        //if (this.hasMarkers())
+            //blockArea.addMarkers(this.getMarkers());
 
         blockArea.setParent(area);    // BasicLink needs it
         blockArea.setPage(area.getPage());
@@ -247,7 +247,7 @@ public class Block extends FObjMixed {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             Status status;
             if ((status = fo.layout(blockArea)).isIncomplete()) {
                 this.marker = i;
index 40150620993ee78129192790e07ead20c0f47e3c..e96a45f857d7ff9e9ebeb8154396659770dddf6d 100644 (file)
@@ -15,9 +15,6 @@ import org.apache.fop.layout.*;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.*;
 
-// Java
-import java.util.Hashtable;
-import java.util.Enumeration;
 
 import org.xml.sax.Attributes;
 
@@ -120,7 +117,7 @@ public class BlockContainer extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FObj fo = (FObj)children.elementAt(i);
+            FObj fo = (FObj)children.get(i);
             Status status;
             if ((status = fo.layout(areaContainer)).isIncomplete()) {
                 /*
index 2f36956a1904d854dd9fdc296254261eb4af1ca5..dac5ca9f927393e39f6f2f0434a69aac3e0753a4 100644 (file)
@@ -15,8 +15,6 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.image.*;
 
 // Java
-import java.util.Enumeration;
-import java.util.Hashtable;
 import java.net.URL;
 import java.net.MalformedURLException;
 
index 2fb72bfaede51cf55244bdc9a900300f37ba3d0e..56ad56fabee14e9f31cca89f9d6861e48a968b6f 100644 (file)
@@ -18,9 +18,7 @@ import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.FlowLayoutManager;
 
 // Java
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
+import java.util.ArrayList;
 
 import org.xml.sax.Attributes;
 
@@ -37,9 +35,9 @@ public class Flow extends FObj {
     private Area area;
 
     /**
-     * Vector to store snapshot
+     * ArrayList to store snapshot
      */
-    private Vector markerSnapshot;
+    private ArrayList markerSnapshot;
 
     /**
      * flow-name attribute
@@ -118,14 +116,14 @@ public class Flow extends FObj {
         BodyAreaContainer bac = (BodyAreaContainer)area;
 
         boolean prevChildMustKeepWithNext = false;
-        Vector pageMarker = this.getMarkerSnapshot(new Vector());
+        ArrayList pageMarker = this.getMarkerSnapshot(new ArrayList());
 
         int numChildren = this.children.size();
         if (numChildren == 0) {
             throw new FOPException("fo:flow must contain block-level children");
         }
         for (int i = this.marker; i < numChildren; i++) {
-            FObj fo = (FObj)children.elementAt(i);
+            FObj fo = (FObj)children.get(i);
 
             if (bac.isBalancingRequired(fo)) {
                 // reset the the just-done span area in preparation
@@ -143,7 +141,7 @@ public class Flow extends FObj {
             currentArea.setIDReferences(bac.getIDReferences());
             if (bac.isNewSpanArea()) {
                 this.marker = i;
-                markerSnapshot = this.getMarkerSnapshot(new Vector());
+                markerSnapshot = this.getMarkerSnapshot(new ArrayList());
             }
            // Set current content width for percent-based lengths in children
            setContentWidth(currentArea.getContentWidth());
@@ -163,7 +161,7 @@ public class Flow extends FObj {
             if (_status.isIncomplete()) {
                 if ((prevChildMustKeepWithNext) && (_status.laidOutNone())) {
                     this.marker = i - 1;
-                    FObj prevChild = (FObj)children.elementAt(this.marker);
+                    FObj prevChild = (FObj)children.get(this.marker);
                     prevChild.removeAreas();
                     prevChild.resetMarker();
                     prevChild.removeID(area.getIDReferences());
index 913b4060e70f366b79d611c88cc756cd38cce304..a9a450a40f7106f5674b977a00d942eb5cb60a3b 100644 (file)
@@ -15,8 +15,7 @@ import org.apache.fop.fo.properties.*;
 import org.apache.fop.messaging.*;
 
 // Java
-import java.util.Enumeration;
-import java.util.Vector;
+import java.util.ArrayList;
 
 public class Footnote extends FObj {
 
@@ -33,7 +32,7 @@ public class Footnote extends FObj {
         }
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             if (fo instanceof Inline) {
                 inline = fo;
                 Status status = fo.layout(area);
@@ -85,7 +84,7 @@ public class Footnote extends FObj {
                 // bac.setMaxHeight(bac.getMaxHeight() - footArea.getHeight() + oldHeight);
                 if (bac.getFootnoteState() == 0) {
                     Area ar = bac.getMainReferenceArea();
-                    decreaseMaxHeight(ar, footArea.getHeight() - oldHeight);
+                    //decreaseMaxHeight(ar, footArea.getHeight() - oldHeight);
                     footArea.setYPosition(basePos + footArea.getHeight());
                 }
             }
@@ -95,16 +94,16 @@ public class Footnote extends FObj {
         return true;
     }
 
-    protected static void decreaseMaxHeight(Area ar, int change) {
+/*    protected static void decreaseMaxHeight(Area ar, int change) {
         ar.setMaxHeight(ar.getMaxHeight() - change);
-        Vector childs = ar.getChildren();
-        for (Enumeration en = childs.elements(); en.hasMoreElements(); ) {
-            Object obj = en.nextElement();
+        ArrayList childs = ar.getChildren();
+        for (Iterator en = childs.iterator(); en.hasNext(); ) {
+            Object obj = en.next();
             if (obj instanceof Area) {
                 Area childArea = (Area)obj;
                 decreaseMaxHeight(childArea, change);
             }
         }
     }
-
+*/
 }
index 9f78a13268fb3611e9be17ec666c9bd92611426d..ac9e4629e3a23a0838720bedf5007da38e06f810 100644 (file)
@@ -16,7 +16,7 @@ import org.apache.fop.fo.properties.*;
 import org.apache.fop.layout.*;
 
 // Java
-import java.util.Enumeration;
+import java.util.Iterator;
 
 public class FootnoteBody extends FObj {
 
@@ -54,7 +54,7 @@ public class FootnoteBody extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             Status status;
             if ((status = fo.layout(blockArea)).isIncomplete()) {
                 this.resetMarker();
index 2f1da66258901ef39f28b8587fab83a4b2128505..8103c66e512df75926b80e0195ab39fba736d068 100644 (file)
@@ -161,7 +161,7 @@ public class InstreamForeignObject extends FObj {
                 }
                 /* layout foreign object */
                 if (this.children.size() > 0) {
-                    FONode fo = (FONode)children.elementAt(0);
+                    FONode fo = (FONode)children.get(0);
                     Status status;
                     if ((status =
                             fo.layout(this.areaCurrent)).isIncomplete()) {
index 8c8d65d60bdbc3c713d901479159186b6889c8ba..fc631a128e28e5bc90d6be673db6d966e5044924 100644 (file)
@@ -17,7 +17,7 @@ import org.apache.fop.layout.FontState;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Enumeration;
+import java.util.Iterator;
 
 public class ListBlock extends FObj {
 
@@ -115,8 +115,8 @@ public class ListBlock extends FObj {
         blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            blockArea.addMarkers(this.getMarkers());
+        //if (this.hasMarkers())
+            //blockArea.addMarkers(this.getMarkers());
 
 
         blockArea.setPage(area.getPage());
@@ -128,11 +128,11 @@ public class ListBlock extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            if (!(children.elementAt(i) instanceof ListItem)) {
+            if (!(children.get(i) instanceof ListItem)) {
                 log.error("children of list-blocks must be list-items");
                 return new Status(Status.OK);
             }
-            ListItem listItem = (ListItem)children.elementAt(i);
+            ListItem listItem = (ListItem)children.get(i);
             Status status;
             if ((status = listItem.layout(blockArea)).isIncomplete()) {
                 if (status.getCode() == Status.AREA_FULL_NONE && i > 0) {
index 68af21547d4b571111d89f707e17dc184ac6763b..6a0ebbced2abb2821a4336078f9a2deb4209d19b 100644 (file)
@@ -16,7 +16,7 @@ import org.apache.fop.layout.FontState;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Enumeration;
+import java.util.Iterator;
 
 public class ListItem extends FObj {
 
@@ -100,8 +100,8 @@ public class ListItem extends FObj {
         this.blockArea.addLineagePair(this, this.areasGenerated);
 
         // markers
-        if (this.hasMarkers())
-            this.blockArea.addMarkers(this.getMarkers());
+        //if (this.hasMarkers())
+            //this.blockArea.addMarkers(this.getMarkers());
 
         blockArea.setPage(area.getPage());
         blockArea.start();
@@ -113,8 +113,8 @@ public class ListItem extends FObj {
         if (numChildren != 2) {
             throw new FOPException("list-item must have exactly two children");
         }
-        ListItemLabel label = (ListItemLabel)children.elementAt(0);
-        ListItemBody body = (ListItemBody)children.elementAt(1);
+        ListItemLabel label = (ListItemLabel)children.get(0);
+        ListItemBody body = (ListItemBody)children.get(1);
 
         Status status;
 
index 7fc5920197577077e86df4f651d941804b5d94ff..3a3daa0c8bded30b67e2eabf81899f7e21130cdd 100644 (file)
@@ -15,7 +15,7 @@ import org.apache.fop.layout.FontState;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Enumeration;
+import java.util.Iterator;
 
 public class ListItemBody extends FObj {
 
@@ -48,7 +48,7 @@ public class ListItemBody extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FObj fo = (FObj)children.elementAt(i);
+            FObj fo = (FObj)children.get(i);
 
             Status status;
             if ((status = fo.layout(area)).isIncomplete()) {
index 9f8bc76eeaca97472da69a2a8dd0c581db5f4235..0134117f5a85fe7fcc66309db8e3591cfce2540f 100644 (file)
@@ -41,7 +41,7 @@ public class ListItemLabel extends FObj {
         String id = this.properties.get("id").getString();
         area.getIDReferences().initializeID(id, area);
 
-        Block block = (Block)children.elementAt(0);
+        Block block = (Block)children.get(0);
 
         /*
          * For calculating the lineage - The fo:list-item-label formatting object
index 5d0a73a683b8f8c725d0b019ceb050fbcf9a03b6..513033732a38324f595a99ee46a2f2cca62b31ba 100644 (file)
@@ -57,7 +57,7 @@ public class Marker extends FObjMixed {
 
         int numChildren = this.children.size();
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
 
             Status status;
             if ((status = fo.layout(area)).isIncomplete()) {
index 38e4a79af26783ef88ffaa548e1122bd87c4f9c9..9e7788d697d33c36683659d023a913278cbe69c0 100644 (file)
@@ -15,8 +15,8 @@ import org.apache.fop.datatypes.*;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 public class Table extends FObj {
 
@@ -34,7 +34,7 @@ public class Table extends FObj {
     boolean omitHeaderAtBreak = false;
     boolean omitFooterAtBreak = false;
 
-    Vector columns = new Vector();
+    ArrayList columns = new ArrayList();
     int bodyCount = 0;
     private boolean bAutoLayout=false;
     private int contentWidth = 0; // Sum of column widths
@@ -187,7 +187,7 @@ public class Table extends FObj {
         layoutColumns(areaContainer);
        
         for (int i = this.marker; i < numChildren; i++) {
-            FONode fo = (FONode)children.elementAt(i);
+            FONode fo = (FONode)children.get(i);
             if (fo instanceof TableHeader) {
                 if (columns.size() == 0) {
                     log.warn("current implementation of tables requires a table-column for each column, indicating column-width");
@@ -337,9 +337,9 @@ public class Table extends FObj {
     }
 
     protected void setupColumnHeights() {
-       Enumeration eCol = columns.elements();
-       while (eCol.hasMoreElements()) {
-           TableColumn c = (TableColumn)eCol.nextElement();
+       Iterator eCol = columns.iterator();
+       while (eCol.hasNext()) {
+           TableColumn c = (TableColumn)eCol.next();
             if ( c != null) {
                 c.setHeight(areaContainer.getContentHeight());
             }
@@ -348,9 +348,9 @@ public class Table extends FObj {
 
     private void findColumns(Area areaContainer) throws FOPException {
        int nextColumnNumber = 1;
-       Enumeration e = children.elements();
-       while (e.hasMoreElements()) {
-            FONode fo = (FONode)e.nextElement();
+       Iterator e = children.iterator();
+       while (e.hasNext()) {
+            FONode fo = (FONode)e.next();
             if (fo instanceof TableColumn) {
                 TableColumn c = (TableColumn)fo;
                 c.doSetup(areaContainer);
@@ -362,14 +362,14 @@ public class Table extends FObj {
 
                 for (int j = 0; j < numColumnsRepeated; j++) {
                     if (currentColumnNumber > columns.size()) {
-                        columns.setSize(currentColumnNumber);
+                        columns.ensureCapacity(currentColumnNumber);
                     }
-                   if (columns.elementAt(currentColumnNumber - 1) != null) {
+                   if (columns.get(currentColumnNumber - 1) != null) {
                        log.warn("More than one column object assigned " +
                                 "to column " +
                                 currentColumnNumber);
                    }
-                    columns.setElementAt(c, currentColumnNumber - 1);
+                    columns.set(currentColumnNumber - 1, c);
                     currentColumnNumber++;
                 }
                nextColumnNumber = currentColumnNumber;
@@ -387,9 +387,9 @@ public class Table extends FObj {
        double dWidthFactor = 0.0;
        double dUnitLength = 0.0;
        double tuMin = 100000.0 ; // Minimum number of proportional units
-       Enumeration eCol = columns.elements();
-       while (eCol.hasMoreElements()) {
-           TableColumn c = (TableColumn)eCol.nextElement();
+       Iterator eCol = columns.iterator();
+       while (eCol.hasNext()) {
+           TableColumn c = (TableColumn)eCol.next();
            if (c == null) {
                log.warn("No table-column specification for column " +
                         nextColumnNumber);
@@ -461,9 +461,9 @@ public class Table extends FObj {
        }
        // Now distribute the extra units onto each column and set offsets
        int offset = 0;
-       eCol = columns.elements();
-       while (eCol.hasMoreElements()) {
-           TableColumn c = (TableColumn)eCol.nextElement();
+       eCol = columns.iterator();
+       while (eCol.hasNext()) {
+           TableColumn c = (TableColumn)eCol.next();
            if (c != null) {
                c.setColumnOffset(offset);
                Length l = c.getColumnWidthAsLength();
@@ -487,9 +487,9 @@ public class Table extends FObj {
     }
 
     private void layoutColumns(Area tableArea) throws FOPException  {
-       Enumeration eCol = columns.elements();
-       while (eCol.hasMoreElements()) {
-           TableColumn c = (TableColumn)eCol.nextElement();
+       Iterator eCol = columns.iterator();
+       while (eCol.hasNext()) {
+           TableColumn c = (TableColumn)eCol.next();
            if (c != null) {
                c.layout(tableArea);
            }
@@ -599,7 +599,7 @@ public class Table extends FObj {
     // * ATTENTION: for now we assume columns are in order in the array!
     // */
     // BorderInfo getColumnBorder(BorderInfo.Side side, int iColNumber) {
-    // TableColumn col = (TableColumn)columns.elementAt(iColNumber);
+    // TableColumn col = (TableColumn)columns.get(iColNumber);
     // return col.getBorderInfo(side);
     // }
 }
index 930f2a76a6d263bdf9a92e1e702ffbae63f69f1c..d487e1a81613812aec86ea7ca6524211ecbab32d 100644 (file)
@@ -15,8 +15,8 @@ import org.apache.fop.layout.*;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 public class TableBody extends FObj {
 
@@ -25,7 +25,7 @@ public class TableBody extends FObj {
     ColorType backgroundColor;
     String id;
 
-    Vector columns;
+    ArrayList columns;
     RowSpanMgr rowSpanMgr;    // manage information about spanning rows
 
     AreaContainer areaContainer;
@@ -35,7 +35,7 @@ public class TableBody extends FObj {
         this.name = "fo:table-body";
     }
 
-    public void setColumns(Vector columns) {
+    public void setColumns(ArrayList columns) {
         this.columns = columns;
     }
 
@@ -131,12 +131,12 @@ public class TableBody extends FObj {
         areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
         areaContainer.setIDReferences(area.getIDReferences());
 
-        Vector keepWith = new Vector();
+        ArrayList keepWith = new ArrayList();
         int numChildren = this.children.size();
         TableRow lastRow = null;
         boolean endKeepGroup = true;
         for (int i = this.marker; i < numChildren; i++) {
-            Object child = children.elementAt(i);
+            Object child = children.get(i);
             if (!(child instanceof TableRow)) {
                 throw new FOPException("Currently only Table Rows are supported in table body, header and footer");
             }
@@ -149,10 +149,10 @@ public class TableBody extends FObj {
                     != KeepValue.KEEP_WITH_AUTO && lastRow != null
                                                 && keepWith.indexOf(lastRow)
                                                    == -1) {
-                keepWith.addElement(lastRow);
+                keepWith.add(lastRow);
             } else {
                 if (endKeepGroup && keepWith.size() > 0) {
-                    keepWith = new Vector();
+                    keepWith = new ArrayList();
                 }
             }
 
@@ -178,9 +178,9 @@ public class TableBody extends FObj {
                         > 0) {    // && status.getCode() == Status.AREA_FULL_NONE
                     // FIXME!!! Handle rows spans!!!
                     row.removeLayout(areaContainer);
-                    for (Enumeration e = keepWith.elements();
-                            e.hasMoreElements(); ) {
-                        TableRow tr = (TableRow)e.nextElement();
+                    for (Iterator e = keepWith.iterator();
+                            e.hasNext(); ) {
+                        TableRow tr = (TableRow)e.next();
                         tr.removeLayout(areaContainer);
                         i--;
                     }
@@ -203,7 +203,7 @@ public class TableBody extends FObj {
                 return status;
             } else if (status.getCode() == Status.KEEP_WITH_NEXT
                        || rowSpanMgr.hasUnfinishedSpans()) {
-                keepWith.addElement(row);
+                keepWith.add(row);
                 endKeepGroup = false;
             } else {
                 endKeepGroup = true;
index 98913d3e850e79b65b70faf065994fff25985c4e..9f99de0f07502ae1ba3152aa31cae57f33564e1e 100644 (file)
@@ -251,7 +251,7 @@ public class TableCell extends FObj {
 
         int numChildren = this.children.size();
         for (int i = this.marker; bDone==false && i < numChildren; i++) {
-            FObj fo = (FObj)children.elementAt(i);
+            FObj fo = (FObj)children.get(i);
             fo.setIsInTableCell();
             fo.forceWidth(width);    // ???
 
index f4b5b75e6b18b9f9be9492a48fe6b8c0ee422c62..658d466ae321521ad942da15de61045b74f40f29 100644 (file)
@@ -15,8 +15,8 @@ import org.apache.fop.layout.*;
 import org.apache.fop.apps.FOPException;
 
 // Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 public class TableRow extends FObj {
 
@@ -33,7 +33,7 @@ public class TableRow extends FObj {
     int widthOfCellsSoFar = 0;
     int largestCellHeight = 0;
     int minHeight = 0;    // force row height
-    Vector columns;
+    ArrayList columns;
 
     AreaContainer areaContainer;
 
@@ -164,7 +164,7 @@ public class TableRow extends FObj {
         super(parent);
     }
 
-    public void setColumns(Vector columns) {
+    public void setColumns(ArrayList columns) {
         this.columns = columns;
     }
 
@@ -292,7 +292,7 @@ public class TableRow extends FObj {
          */
         int offset = 0;       // Offset of each cell from table start edge
         int iColIndex = 0;    // 1-based column index
-        Enumeration eCols = columns.elements();
+        Iterator eCols = columns.iterator();
         /*
          * Ideas: set offset on each column when they are initialized
          * no need to calculate for each row.
@@ -300,10 +300,10 @@ public class TableRow extends FObj {
          * info if borders are "collapsed".
          */
 
-        while (eCols.hasMoreElements()) {
+        while (eCols.hasNext()) {
             TableCell cell;
             ++iColIndex;
-            TableColumn tcol = (TableColumn)eCols.nextElement();
+            TableColumn tcol = (TableColumn)eCols.next();
             int colWidth = tcol.getColumnWidth();
             if (cellArray.getCellType(iColIndex) == CellArray.CELLSTART) {
                 cell = cellArray.getCell(iColIndex);
@@ -471,13 +471,13 @@ public class TableRow extends FObj {
     private void initCellArray() {
         cellArray = new CellArray(rowSpanMgr, columns.size());
         int colNum = 1;
-        Enumeration eCells = children.elements();
-        while (eCells.hasMoreElements()) {
+        Iterator eCells = children.iterator();
+        while (eCells.hasNext()) {
             colNum = cellArray.getNextFreeCell(colNum);
             // If off the end, the rest of the cells had better be
             // explicitly positioned!!! (returns -1)
 
-            TableCell cell = (TableCell)eCells.nextElement();
+            TableCell cell = (TableCell)eCells.next();
             int numCols = cell.getNumColumnsSpanned();
             int numRows = cell.getNumRowsSpanned();
             int cellColNum = cell.getColumnNumber();
@@ -522,7 +522,7 @@ public class TableRow extends FObj {
     private int getCellWidth(int startCol, int numCols) {
         int width = 0;
         for (int count = 0; count < numCols; count++) {
-            width += ((TableColumn)columns.elementAt(startCol + count
+            width += ((TableColumn)columns.get(startCol + count
                                                      - 1)).getColumnWidth();
         }
         return width;
index 82dfd1801ec3ae6a678801f019dcddbe0755eec6..d56e74cb97db175e122ba20198c43aadd8d13deb 100644 (file)
@@ -14,15 +14,16 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.layout.PageMaster;
 
 // Java
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
 
 import org.xml.sax.Attributes;
 
 public class LayoutMasterSet extends FObj {
 
-    private Hashtable simplePageMasters;
-    private Hashtable pageSequenceMasters;
-    private Hashtable allRegions;
+    private HashMap simplePageMasters;
+    private HashMap pageSequenceMasters;
+    private HashMap allRegions;
 
     private Root root;
 
@@ -32,8 +33,8 @@ public class LayoutMasterSet extends FObj {
 
     public void handleAttrs(Attributes attlist) throws FOPException {
         super.handleAttrs(attlist);
-        this.simplePageMasters = new Hashtable();
-        this.pageSequenceMasters = new Hashtable();
+        this.simplePageMasters = new HashMap();
+        this.pageSequenceMasters = new HashMap();
 
         if (parent.getName().equals("fo:root")) {
             this.root = (Root)parent;
@@ -42,7 +43,7 @@ public class LayoutMasterSet extends FObj {
             throw new FOPException("fo:layout-master-set must be child of fo:root, not "
                                    + parent.getName());
         }
-        allRegions = new Hashtable();
+        allRegions = new HashMap();
 
     }
 
@@ -85,24 +86,23 @@ public class LayoutMasterSet extends FObj {
     }
 
     protected void resetPageMasters() {
-        for (Enumeration e = pageSequenceMasters.elements();
-                e.hasMoreElements(); ) {
-            ((PageSequenceMaster)e.nextElement()).reset();
+        for (Iterator e = pageSequenceMasters.values().iterator();
+                e.hasNext(); ) {
+            ((PageSequenceMaster)e.next()).reset();
         }
-
     }
 
     protected void checkRegionNames() throws FOPException {
         // Section 7.33.15 check to see that if a region-name is a
         // duplicate, that it maps to the same region-class.
-        for (Enumeration spm = simplePageMasters.elements();
-                spm.hasMoreElements(); ) {
+        for (Iterator spm = simplePageMasters.values().iterator();
+                spm.hasNext(); ) {
             SimplePageMaster simplePageMaster =
-                (SimplePageMaster)spm.nextElement();
-            Hashtable spmRegions = simplePageMaster.getRegions();
-            for (Enumeration e = spmRegions.elements();
-                    e.hasMoreElements(); ) {
-                Region region = (Region)e.nextElement();
+                (SimplePageMaster)spm.next();
+            HashMap spmRegions = simplePageMaster.getRegions();
+            for (Iterator e = spmRegions.values().iterator();
+                    e.hasNext(); ) {
+                Region region = (Region)e.next();
                 if (allRegions.containsKey(region.getRegionName())) {
                     String localClass =
                         (String)allRegions.get(region.getRegionName());
@@ -128,16 +128,15 @@ public class LayoutMasterSet extends FObj {
      */
     protected boolean regionNameExists(String regionName) {
         boolean result = false;
-        for (Enumeration e = simplePageMasters.elements();
-                e.hasMoreElements(); ) {
+        for (Iterator e = simplePageMasters.values().iterator();
+                e.hasNext(); ) {
             result =
-                ((SimplePageMaster)e.nextElement()).regionNameExists(regionName);
+                ((SimplePageMaster)e.next()).regionNameExists(regionName);
             if (result) {
                 return result;
             }
         }
         return result;
     }
-
-
 }
+
index 1e05cef5c9d97ac82dedfc55aac6b006abe0cd3e..32aa24897072106615e3f8fb91f8a7d94403f58a 100644 (file)
@@ -64,13 +64,13 @@ public class PageSequence extends FObj {
 
     // There doesn't seem to be anything in the spec requiring flows
     // to be in the order given, only that they map to the regions
-    // defined in the page sequence, so all we need is this one hashtable
+    // defined in the page sequence, so all we need is this one hashmap
     // the set of flows includes StaticContent flows also
 
     /**
      * Map of flows to their flow name (flow-name, Flow)
      */
-    private Hashtable _flowMap;
+    private HashMap _flowMap;
 
     /**
      * the "master-reference" attribute
@@ -158,7 +158,7 @@ public class PageSequence extends FObj {
         // best time to run some checks on LayoutMasterSet
         layoutMasterSet.checkRegionNames();
 
-        _flowMap = new Hashtable();
+        _flowMap = new HashMap();
 
         thisIsFirstPage =
             true;    // we are now on the first page of the page sequence
@@ -652,8 +652,8 @@ public class PageSequence extends FObj {
 //     private boolean flowsAreIncomplete() {
 //         boolean isIncomplete = false;
 
-//         for (Enumeration e = _flowMap.elements(); e.hasMoreElements(); ) {
-//             Flow flow = (Flow)e.nextElement();
+//         for (Iterator e = _flowMap.values().iterator(); e.hasNext(); ) {
+//             Flow flow = (Flow)e.next();
 //             if (flow instanceof StaticContent) {
 //                 continue;
 //             }
index 197bb54bc8c4a3a940d09a4a060835807ea5b522..7e501a7e0188d763e71ad10e7cd498907ebf50e7 100644 (file)
@@ -16,8 +16,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.extensions.ExtensionObj;
 
 // Java
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.ArrayList;
 
 /**
  * The fo:root formatting object. Contains page masters, root extensions,
@@ -26,7 +25,7 @@ import java.util.Enumeration;
 public class Root extends FObj {
 
     LayoutMasterSet layoutMasterSet;
-    Vector pageSequences;
+    ArrayList pageSequences;
 
     /**
      * keeps count of page number from over PageSequence instances
@@ -38,7 +37,7 @@ public class Root extends FObj {
 
         // this.properties.get("media-usage");
 
-        pageSequences = new Vector();
+        pageSequences = new ArrayList();
 
         if (parent != null) {
             //throw new FOPException("root must be root element");
@@ -67,7 +66,7 @@ public class Root extends FObj {
         if (currentIndex == -1)
             return null;
         if (currentIndex < (pageSequences.size() - 1)) {
-            return (PageSequence)pageSequences.elementAt(currentIndex + 1);
+            return (PageSequence)pageSequences.get(currentIndex + 1);
         } else {
             return null;
         }
index 3c3931cf96e327ecc0c8a438503dc810cea9c5aa..e759e31cdd51d1be73d610c4014b0544e9e88a86 100644 (file)
@@ -19,8 +19,8 @@ import org.apache.fop.layout.PageMaster;
 import org.apache.fop.apps.FOPException;
 
 import java.awt.Rectangle;
-import java.util.Hashtable;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
 import org.xml.sax.Attributes;
 
 
@@ -29,7 +29,7 @@ public class SimplePageMaster extends FObj {
     /**
      * Page regions (regionClass, Region)
      */
-    private Hashtable _regions;
+    private HashMap _regions;
 
     LayoutMasterSet layoutMasterSet;
     PageMaster pageMaster;
@@ -56,7 +56,7 @@ public class SimplePageMaster extends FObj {
                                    + "of fo:layout-master-set, not "
                                    + parent.getName());
         }
-        _regions = new Hashtable();
+        _regions = new HashMap();
 
     }
 
@@ -88,9 +88,9 @@ public class SimplePageMaster extends FObj {
 
        boolean bHasBody=false;
 
-        for (Enumeration regenum = _regions.elements();
-                regenum.hasMoreElements(); ) {
-            Region r = (Region)regenum.nextElement();
+        for (Iterator regenum = _regions.values().iterator();
+                regenum.hasNext(); ) {
+            Region r = (Region)regenum.next();
            RegionViewport rvp = r.makeRegionViewport(pageRefRect);
            rvp.setRegion(r.makeRegionReferenceArea());
            page.setRegion(r.getRegionAreaClass(), rvp);
@@ -149,14 +149,14 @@ public class SimplePageMaster extends FObj {
         return (Region)_regions.get(regionClass);
     }
 
-    protected Hashtable getRegions() {
+    protected HashMap getRegions() {
         return _regions;
     }
 
     protected boolean regionNameExists(String regionName) {
-        for (Enumeration regenum = _regions.elements();
-                regenum.hasMoreElements(); ) {
-            Region r = (Region)regenum.nextElement();
+        for (Iterator regenum = _regions.values().iterator();
+                regenum.hasNext(); ) {
+            Region r = (Region)regenum.next();
             if (r.getRegionName().equals(regionName)) {
                 return true;
             }
index cf1c7e8d76b423f9ef3093738616af9468c9f849..9dce84478b23c07efa034f0a0865751ed88b474d 100644 (file)
@@ -8,7 +8,7 @@
 package org.apache.fop.fonts;
 
 import java.io.*;
-import java.util.Hashtable;
+import java.util.HashMap;
 
 /**
  * This class represents a PFM file (or parts of it) as a Java object.
@@ -42,9 +42,9 @@ public class PFMFile {
     // Extent table
     private int[] extentTable;
 
-    private Hashtable kerningTab;
+    private HashMap kerningTab;
     public PFMFile() {
-        kerningTab = new Hashtable();
+        kerningTab = new HashMap();
     }
 
     /**
@@ -160,9 +160,9 @@ public class PFMFile {
             String glyph1 = Glyphs.tex8r[g1];
             String glyph2 = Glyphs.tex8r[g2];
 
-            Hashtable adjTab = (Hashtable)kerningTab.get(new Integer(g1));
+            HashMap adjTab = (HashMap)kerningTab.get(new Integer(g1));
             if (adjTab == null)
-                adjTab = new Hashtable();
+                adjTab = new HashMap();
             adjTab.put(new Integer(g2), new Integer(adj));
             kerningTab.put(new Integer(g1), adjTab);
         }
@@ -212,7 +212,7 @@ public class PFMFile {
      * strings with glyphnames as keys, containing hashtables as value.
      * The value hashtable contain a glyph name string key and an Integer value
      */
-    public Hashtable getKerning() {
+    public HashMap getKerning() {
         return kerningTab;
     }
 
index d48a1948eebbd3c4817c8ff29772a3d5fca39294..7404c7c23d1e186f8038f315cb7a261ce1b7abdd 100644 (file)
@@ -7,9 +7,9 @@
 
 package org.apache.fop.fonts;
 import java.io.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.ArrayList;
 
 /**
  * Reads a TrueType file or a TrueType Collection.
@@ -26,11 +26,11 @@ public class TTFFile {
     short firstChar = 0;
     boolean is_embeddable = true;
     boolean hasSerifs = true;
-    Hashtable dirTabs;                             // Table directory
-    Hashtable kerningTab;                          // for CIDs
-    Hashtable ansiKerningTab;                      // For winAnsiEncoding
-    Vector cmaps;
-    Vector unicodeMapping;                         //
+    HashMap dirTabs;                             // Table directory
+    HashMap kerningTab;                          // for CIDs
+    HashMap ansiKerningTab;                      // For winAnsiEncoding
+    ArrayList cmaps;
+    ArrayList unicodeMapping;                         //
 
     int upem;                                      // unitsPerEm from "head" table
     int nhmtx;                                     // Number of horizontal metrics
@@ -65,7 +65,7 @@ public class TTFFile {
     short lastChar = 0;
 
     int ansiWidth[];
-    Hashtable ansiIndex;
+    HashMap ansiIndex;
 
     /**
      * Position inputstream to position indicated
@@ -111,7 +111,7 @@ public class TTFFile {
      */
     private boolean readCMAP(FontFileReader in) throws IOException {
 
-        unicodeMapping = new Vector();
+        unicodeMapping = new ArrayList();
 
         /**
          * Read CMAP table and correct mtx_tab.index
@@ -193,7 +193,7 @@ public class TTFFile {
             int glyphIdArrayOffset = in.getCurrentPos();
 
             // Insert the unicode id for the glyphs in mtx_tab
-            // and fill in the cmaps Vector
+            // and fill in the cmaps ArrayList
 
             for (int i = 0; i < cmap_startCounts.length; i++) {
                 /*
@@ -218,9 +218,9 @@ public class TTFFile {
                             glyphIdx = (in.readTTFUShort() + cmap_deltas[i])
                                        & 0xffff;
 
-                            unicodeMapping.addElement(new UnicodeMapping(glyphIdx,
+                            unicodeMapping.add(new UnicodeMapping(glyphIdx,
                                     j));
-                            mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+                            mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
 
 
                             // Also add winAnsiWidth
@@ -231,13 +231,13 @@ public class TTFFile {
                                 if (d < ansiWidth.length)
                                     ansiWidth[d] = mtx_tab[glyphIdx].wx;
                             } else {
-                                Vector v =
-                                    (Vector)ansiIndex.get(new Integer(j));
+                                ArrayList v =
+                                    (ArrayList)ansiIndex.get(new Integer(j));
                                 if (v != null) {
-                                    for (Enumeration e = v.elements();
-                                            e.hasMoreElements(); ) {
+                                    for (Iterator e = v.listIterator();
+                                            e.hasNext(); ) {
                                         Integer aIdx =
-                                            (Integer)e.nextElement();
+                                            (Integer)e.next();
                                         ansiWidth[aIdx.intValue()] =
                                             mtx_tab[glyphIdx].wx;
                                         /*
@@ -263,16 +263,16 @@ public class TTFFile {
                             glyphIdx = (j + cmap_deltas[i]) & 0xffff;
 
                             if (glyphIdx < mtx_tab.length)
-                                mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+                                mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
                             else
                                 System.out.println("Glyph " + glyphIdx
                                                    + " out of range: "
                                                    + mtx_tab.length);
 
-                            unicodeMapping.addElement(new UnicodeMapping(glyphIdx,
+                            unicodeMapping.add(new UnicodeMapping(glyphIdx,
                                     j));
                             if (glyphIdx < mtx_tab.length)
-                                mtx_tab[glyphIdx].unicodeIndex.addElement(new Integer(j));
+                                mtx_tab[glyphIdx].unicodeIndex.add(new Integer(j));
                             else
                                 System.out.println("Glyph " + glyphIdx
                                                    + " out of range: "
@@ -289,13 +289,13 @@ public class TTFFile {
                                 if (d < ansiWidth.length)
                                     ansiWidth[d] = mtx_tab[glyphIdx].wx;
                             } else {
-                                Vector v =
-                                    (Vector)ansiIndex.get(new Integer(j));
+                                ArrayList v =
+                                    (ArrayList)ansiIndex.get(new Integer(j));
                                 if (v != null) {
-                                    for (Enumeration e = v.elements();
-                                            e.hasMoreElements(); ) {
+                                    for (Iterator e = v.listIterator();
+                                            e.hasNext(); ) {
                                         Integer aIdx =
-                                            (Integer)e.nextElement();
+                                            (Integer)e.next();
                                         ansiWidth[aIdx.intValue()] =
                                             mtx_tab[glyphIdx].wx;
                                     }
@@ -357,17 +357,17 @@ public class TTFFile {
         // Create an index hash to the ansiWidth
         // Can't just index the winAnsiEncoding when inserting widths
         // same char (eg bullet) is repeated more than one place
-        ansiIndex = new Hashtable();
+        ansiIndex = new HashMap();
         for (int i = 32; i < Glyphs.winAnsiEncoding.length; i++) {
             Integer ansi = new Integer(i);
             Integer uni = new Integer((int)Glyphs.winAnsiEncoding[i]);
 
-            Vector v = (Vector)ansiIndex.get(uni);
+            ArrayList v = (ArrayList)ansiIndex.get(uni);
             if (v == null) {
-                v = new Vector();
+                v = new ArrayList();
                 ansiIndex.put(uni, v);
             }
-            v.addElement(ansi);
+            v.add(ansi);
         }
     }
 
@@ -408,22 +408,22 @@ public class TTFFile {
     }
 
     private void createCMaps() {
-        cmaps = new Vector();
+        cmaps = new ArrayList();
         TTFCmapEntry tce = new TTFCmapEntry();
 
-        Enumeration e = unicodeMapping.elements();
-        UnicodeMapping um = (UnicodeMapping)e.nextElement();
+        Iterator e = unicodeMapping.listIterator();
+        UnicodeMapping um = (UnicodeMapping)e.next();
         UnicodeMapping lastMapping = um;
 
         tce.unicodeStart = um.uIdx;
         tce.glyphStartIndex = um.gIdx;
 
-        while (e.hasMoreElements()) {
-            um = (UnicodeMapping)e.nextElement();
+        while (e.hasNext()) {
+            um = (UnicodeMapping)e.next();
             if (((lastMapping.uIdx + 1) != um.uIdx)
                     || ((lastMapping.gIdx + 1) != um.gIdx)) {
                 tce.unicodeEnd = lastMapping.uIdx;
-                cmaps.addElement(tce);
+                cmaps.add(tce);
 
                 tce = new TTFCmapEntry();
                 tce.unicodeStart = um.uIdx;
@@ -433,7 +433,7 @@ public class TTFFile {
         }
 
         tce.unicodeEnd = um.uIdx;
-        cmaps.addElement(tce);
+        cmaps.add(tce);
     }
 
     public void printStuff() {
@@ -573,11 +573,11 @@ public class TTFFile {
         return (int)get_ttf_funit(ansiWidth[idx]);
     }
 
-    public Hashtable getKerning() {
+    public HashMap getKerning() {
         return kerningTab;
     }
 
-    public Hashtable getAnsiKerning() {
+    public HashMap getAnsiKerning() {
         return ansiKerningTab;
     }
 
@@ -588,7 +588,7 @@ public class TTFFile {
 
     /**
      * Read Table Directory from the current position in the
-     * FontFileReader and fill the global Hashtable dirTabs
+     * FontFileReader and fill the global HashMap dirTabs
      * with the table name (String) as key and a TTFDirTabEntry
      * as value.
      */
@@ -597,7 +597,7 @@ public class TTFFile {
         int ntabs = in.readTTFUShort();
         in.skip(6);    // 3xTTF_USHORT_SIZE
 
-        dirTabs = new Hashtable();
+        dirTabs = new HashMap();
         TTFDirTabEntry[] pd = new TTFDirTabEntry[ntabs];
         // System.out.println("Reading " + ntabs + " dir tables");
         for (int i = 0; i < ntabs; i++) {
@@ -928,8 +928,8 @@ public class TTFFile {
      */
     private final void readKerning(FontFileReader in) throws IOException {
         // Read kerning
-        kerningTab = new Hashtable();
-        ansiKerningTab = new Hashtable();
+        kerningTab = new HashMap();
+        ansiKerningTab = new HashMap();
         TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("kern");
         if (dirTab != null) {
             seek_tab(in, "kern", 2);
@@ -950,9 +950,9 @@ public class TTFFile {
                     if (kpx != 0) {
                         // CID table
                         Integer iObj = new Integer(i);
-                        Hashtable adjTab = (Hashtable)kerningTab.get(iObj);
+                        HashMap adjTab = (HashMap)kerningTab.get(iObj);
                         if (adjTab == null)
-                            adjTab = new java.util.Hashtable();
+                            adjTab = new HashMap();
                         adjTab.put(new Integer(j),
                                    new Integer((int)get_ttf_funit(kpx)));
                         kerningTab.put(iObj, adjTab);
@@ -963,18 +963,18 @@ public class TTFFile {
 
             // Create winAnsiEncoded kerning table
 
-            for (Enumeration ae = kerningTab.keys(); ae.hasMoreElements(); ) {
-                Integer cidKey = (Integer)ae.nextElement();
-                Hashtable akpx = new Hashtable();
-                Hashtable ckpx = (Hashtable)kerningTab.get(cidKey);
+            for (Iterator ae = kerningTab.keySet().iterator(); ae.hasNext(); ) {
+                Integer cidKey = (Integer)ae.next();
+                HashMap akpx = new HashMap();
+                HashMap ckpx = (HashMap)kerningTab.get(cidKey);
 
-                for (Enumeration aee = ckpx.keys(); aee.hasMoreElements(); ) {
-                    Integer cidKey2 = (Integer)aee.nextElement();
+                for (Iterator aee = ckpx.keySet().iterator(); aee.hasNext(); ) {
+                    Integer cidKey2 = (Integer)aee.next();
                     Integer kern = (Integer)ckpx.get(cidKey2);
 
-                    for (Enumeration uniMap = mtx_tab[cidKey2.intValue()].unicodeIndex.elements();
-                            uniMap.hasMoreElements(); ) {
-                        Integer unicodeKey = (Integer)uniMap.nextElement();
+                    for (Iterator uniMap = mtx_tab[cidKey2.intValue()].unicodeIndex.listIterator();
+                            uniMap.hasNext(); ) {
+                        Integer unicodeKey = (Integer)uniMap.next();
                         Integer[] ansiKeys =
                             unicodeToWinAnsi(unicodeKey.intValue());
                         for (int u = 0; u < ansiKeys.length; u++) {
@@ -984,9 +984,9 @@ public class TTFFile {
                 }
 
                 if (akpx.size() > 0)
-                    for (Enumeration uniMap = mtx_tab[cidKey.intValue()].unicodeIndex.elements();
-                            uniMap.hasMoreElements(); ) {
-                        Integer unicodeKey = (Integer)uniMap.nextElement();
+                    for (Iterator uniMap = mtx_tab[cidKey.intValue()].unicodeIndex.listIterator();
+                            uniMap.hasNext(); ) {
+                        Integer unicodeKey = (Integer)uniMap.next();
                         Integer[] ansiKeys =
                             unicodeToWinAnsi(unicodeKey.intValue());
                         for (int u = 0; u < ansiKeys.length; u++) {
@@ -1000,7 +1000,7 @@ public class TTFFile {
     /**
      * Return a vector with TTFCmapEntry
      */
-    public Vector getCMaps() {
+    public ArrayList getCMaps() {
         return cmaps;
     }
 
@@ -1077,13 +1077,11 @@ public class TTFFile {
      * doesn't matter...
      */
     private Integer[] unicodeToWinAnsi(int unicode) {
-        Vector ret = new Vector();
+        ArrayList ret = new ArrayList();
         for (int i = 32; i < Glyphs.winAnsiEncoding.length; i++)
             if (unicode == Glyphs.winAnsiEncoding[i])
-                ret.addElement(new Integer(i));
-        Integer[] itg = new Integer[ret.size()];
-        ret.copyInto(itg);
-        return itg;
+                ret.add(new Integer(i));
+        return (Integer[])ret.toArray(new Integer[0]);
     }
 
 }
index 286593c04099161a7532db47e2148626c3da8894..67451d447025296324a62c60fa42a2fb4fe16229 100644 (file)
@@ -8,14 +8,14 @@
 package org.apache.fop.fonts;
 
 import java.io.*;
-import java.util.Vector;
+import java.util.ArrayList;
 
 class TTFMtxEntry {
     int wx;
     int lsb;
     String name;
     int index;
-    Vector unicodeIndex;
+    ArrayList unicodeIndex;
     int[] bbox;
     long offset;
     byte found;
@@ -23,7 +23,7 @@ class TTFMtxEntry {
     TTFMtxEntry() {
         name = "";
         found = 0;
-        unicodeIndex = new Vector();
+        unicodeIndex = new ArrayList();
         bbox = new int[4];
     }
 
index 4dba53e944eff96016ea735f3f2cd319325a049f..5bf0f3e79b7b10db2ec8860cdb0f1b64789d847d 100644 (file)
@@ -13,9 +13,9 @@ import org.apache.xerces.dom.*;
 import org.apache.xml.serialize.*;
 import org.apache.xalan.xslt.*;
 import org.apache.fop.fonts.*;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /**
  * A tool which reads PFM files from Adobe Type 1 fonts and creates
@@ -30,14 +30,14 @@ public class PFMReader {
 
 
     /**
-     * Parse commandline arguments. put options in the Hashtable and return
+     * Parse commandline arguments. put options in the HashMap and return
      * arguments in the String array
      * the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
      * returns a String[] with the per.ttf and Perpetua.xml. The hash
      * will have the (key, value) pairs: (-fn, Perpetua) and (-cn, PerpetuaBold)
      */
-    private static String[] parseArguments(Hashtable options, String[] args) {
-        Vector arguments = new Vector();
+    private static String[] parseArguments(HashMap options, String[] args) {
+        ArrayList arguments = new ArrayList();
         for (int i = 0; i < args.length; i++) {
             if (args[i].startsWith("-")) {
                 if ((i + 1) < args.length &&!args[i + 1].startsWith("-")) {
@@ -47,13 +47,11 @@ public class PFMReader {
                     options.put(args[i], "");
                 }
             } else {
-                arguments.addElement(args[i]);
+                arguments.add(args[i]);
             }
         }
 
-        String[] argStrings = new String[arguments.size()];
-        arguments.copyInto(argStrings);
-        return argStrings;
+        return (String[])arguments.toArray(new String[0]);
     }
 
     private final static void displayUsage() {
@@ -92,7 +90,7 @@ public class PFMReader {
         String className = null;
         String fontName = null;
 
-        Hashtable options = new Hashtable();
+        HashMap options = new HashMap();
         String[] arguments = parseArguments(options, args);
 
         PFMReader app = new PFMReader();
@@ -320,17 +318,17 @@ public class PFMReader {
 
 
         // Get kerning
-        for (Enumeration enum = pfm.getKerning().keys();
-                enum.hasMoreElements(); ) {
-            Integer kpx1 = (Integer)enum.nextElement();
+        for (Iterator enum = pfm.getKerning().keySet().iterator();
+                enum.hasNext(); ) {
+            Integer kpx1 = (Integer)enum.next();
             el = doc.createElement("kerning");
             el.setAttribute("kpx1", kpx1.toString());
             root.appendChild(el);
             Element el2 = null;
 
-            Hashtable h2 = (Hashtable)pfm.getKerning().get(kpx1);
-            for (Enumeration enum2 = h2.keys(); enum2.hasMoreElements(); ) {
-                Integer kpx2 = (Integer)enum2.nextElement();
+            HashMap h2 = (HashMap)pfm.getKerning().get(kpx1);
+            for (Iterator enum2 = h2.keySet().iterator(); enum2.hasNext(); ) {
+                Integer kpx2 = (Integer)enum2.next();
                 el2 = doc.createElement("pair");
                 el2.setAttribute("kpx2", kpx2.toString());
                 Integer val = (Integer)h2.get(kpx2);
index 5a7c479192f13fb5f5269d81d5f17454503752a3..d7c7b0a3469ac0dd127347a9d1eb1c612dd204d7 100644 (file)
@@ -12,9 +12,9 @@ import org.apache.xerces.dom.*;
 import org.apache.xml.serialize.*;
 import org.apache.xalan.xslt.*;
 import org.apache.fop.fonts.*;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /**
  * A tool which reads TTF files and generates
@@ -29,14 +29,14 @@ public class TTFReader {
 
 
     /**
-     * Parse commandline arguments. put options in the Hashtable and return
+     * Parse commandline arguments. put options in the HashMap and return
      * arguments in the String array
      * the arguments: -fn Perpetua,Bold -cn PerpetuaBold per.ttf Perpetua.xml
      * returns a String[] with the per.ttf and Perpetua.xml. The hash
      * will have the (key, value) pairs: (-fn, Perpetua) and (-cn, PerpetuaBold)
      */
-    private static String[] parseArguments(Hashtable options, String[] args) {
-        Vector arguments = new Vector();
+    private static String[] parseArguments(HashMap options, String[] args) {
+        ArrayList arguments = new ArrayList();
         for (int i = 0; i < args.length; i++) {
             if (args[i].startsWith("-")) {
                 if ((i + 1) < args.length &&!args[i + 1].startsWith("-")) {
@@ -46,13 +46,11 @@ public class TTFReader {
                     options.put(args[i], "");
                 }
             } else {
-                arguments.addElement(args[i]);
+                arguments.add(args[i]);
             }
         }
 
-        String[] argStrings = new String[arguments.size()];
-        arguments.copyInto(argStrings);
-        return argStrings;
+        return (String[])arguments.toArray(new String[0]);;
     }
 
 
@@ -106,7 +104,7 @@ public class TTFReader {
         String ttcName = null;
         boolean isCid = true;
 
-        Hashtable options = new Hashtable();
+        HashMap options = new HashMap();
         String[] arguments = parseArguments(options, args);
 
         TTFReader app = new TTFReader();
@@ -317,9 +315,9 @@ public class TTFReader {
 
             el = doc.createElement("bfranges");
             mel.appendChild(el);
-            for (Enumeration e = ttf.getCMaps().elements();
-                    e.hasMoreElements(); ) {
-                TTFCmapEntry ce = (TTFCmapEntry)e.nextElement();
+            for (Iterator e = ttf.getCMaps().listIterator();
+                    e.hasNext(); ) {
+                TTFCmapEntry ce = (TTFCmapEntry)e.next();
                 Element el2 = doc.createElement("bf");
                 el.appendChild(el2);
                 el2.setAttribute("us", String.valueOf(ce.unicodeStart));
@@ -368,28 +366,28 @@ public class TTFReader {
         }
 
         // Get kerning
-        Enumeration enum;
+        Iterator enum;
         if (isCid)
-            enum = ttf.getKerning().keys();
+            enum = ttf.getKerning().keySet().iterator();
         else
-            enum = ttf.getAnsiKerning().keys();
+            enum = ttf.getAnsiKerning().keySet().iterator();
 
-        while (enum.hasMoreElements()) {
-            Integer kpx1 = (Integer)enum.nextElement();
+        while (enum.hasNext()) {
+            Integer kpx1 = (Integer)enum.next();
 
             el = doc.createElement("kerning");
             el.setAttribute("kpx1", kpx1.toString());
             root.appendChild(el);
             Element el2 = null;
 
-            Hashtable h2;
+            HashMap h2;
             if (isCid)
-                h2 = (Hashtable)ttf.getKerning().get(kpx1);
+                h2 = (HashMap)ttf.getKerning().get(kpx1);
             else
-                h2 = (Hashtable)ttf.getAnsiKerning().get(kpx1);
+                h2 = (HashMap)ttf.getAnsiKerning().get(kpx1);
 
-            for (Enumeration enum2 = h2.keys(); enum2.hasMoreElements(); ) {
-                Integer kpx2 = (Integer)enum2.nextElement();
+            for (Iterator enum2 = h2.keySet().iterator(); enum2.hasNext(); ) {
+                Integer kpx2 = (Integer)enum2.next();
                 if (isCid || kpx2.intValue() < 256) {
                     el2 = doc.createElement("pair");
                     el2.setAttribute("kpx2", kpx2.toString());