]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Changed sparsePropsMap from HashMap to int[].
authorPeter Bernard West <pbwest@apache.org>
Tue, 3 Dec 2002 07:47:44 +0000 (07:47 +0000)
committerPeter Bernard West <pbwest@apache.org>
Tue, 3 Dec 2002 07:47:44 +0000 (07:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195727 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java
src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java
src/org/apache/fop/fo/pagination/FoRegionBeforeAfter.java
src/org/apache/fop/fo/pagination/FoRegionBody.java
src/org/apache/fop/fo/pagination/FoRegionStartEnd.java
src/org/apache/fop/fo/pagination/FoSimplePageMaster.java

index 5df54ffc22985f884d71fbc79435742ed0bea3bd..48a5e99fea90f2e6f8a4aa269bbc61c04ac092a8 100644 (file)
@@ -1,12 +1,14 @@
 package org.apache.fop.fo.pagination;
 
 import java.util.Collection;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.PropNames;
 import org.apache.fop.fo.FObjectNames;
 import org.apache.fop.fo.FOTree;
 import org.apache.fop.fo.FONode;
@@ -45,7 +47,7 @@ public class FoLayoutMasterSet extends FONode {
         position in the <i>sparsePropsSet</i> array.  See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    private static final HashMap sparsePropsMap;
+    private static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -59,7 +61,8 @@ public class FoLayoutMasterSet extends FONode {
         // applicableProps is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap(0);
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = 0;
         sparseIndices = new int[] {};
     }
index dbf29d4c35b221996bc0d2fbdcedbae21019ffac..858fc18aff42b1100b19a6d3bb557813a07e90ce 100644 (file)
@@ -9,6 +9,7 @@
 
 package org.apache.fop.fo.pagination;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.BitSet;
 import java.util.NoSuchElementException;
@@ -47,7 +48,7 @@ public class FoPageSequenceMaster extends FONode {
         position in the <i>sparsePropsSet</i> array.  See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    private static final HashMap sparsePropsMap;
+    private static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -61,16 +62,16 @@ public class FoPageSequenceMaster extends FONode {
         // applicableProps is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap(1);
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = 1;
         sparseIndices = new int[] { PropNames.MASTER_NAME };
-        sparsePropsMap.put
-            (Ints.consts.get(PropNames.MASTER_NAME), Ints.consts.get(0));
+        sparsePropsMap[PropNames.MASTER_NAME] = 0;
     }
 
     /** Constant values for FoSinglePageMasterReference.
         See {@link #sparsePropsMap sparsePropsMap}. */
-    private static final HashMap s_p_m_r_PropsMap;
+    private static final int[] s_p_m_r_PropsMap;
 
     /** See {@link #sparseIndices sparseIndices}. */
     private static final int[] s_p_m_r_Indices;
@@ -82,16 +83,15 @@ public class FoPageSequenceMaster extends FONode {
         // applicableProps is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        s_p_m_r_PropsMap = new HashMap(1);
+        s_p_m_r_PropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(s_p_m_r_PropsMap, -1);
         s_p_m_r_numProps = 1;
         s_p_m_r_Indices = new int[] { PropNames.MASTER_REFERENCE };
-        s_p_m_r_PropsMap.put
-            (Ints.consts.get(PropNames.MASTER_REFERENCE),
-                                                Ints.consts.get(0));
+        s_p_m_r_PropsMap[PropNames.MASTER_REFERENCE] = 0;
     }
 
     /** See {@link #sparsePropsMap sparsePropsMap}. */
-    private static final HashMap r_p_m_r_PropsMap;
+    private static final int[] r_p_m_r_PropsMap;
 
     /** See {@link #sparseIndices sparseIndices}. */
     private static final int[] r_p_m_r_Indices;
@@ -109,7 +109,8 @@ public class FoPageSequenceMaster extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        r_p_m_r_PropsMap = new HashMap();
+        r_p_m_r_PropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(r_p_m_r_PropsMap, -1);
         r_p_m_r_numProps = propsets.cardinality();
         r_p_m_r_Indices = new int[r_p_m_r_numProps];
         int propx = 0;
@@ -117,13 +118,12 @@ public class FoPageSequenceMaster extends FONode {
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             r_p_m_r_Indices[propx] = next;
-            r_p_m_r_PropsMap.put
-                        (Ints.consts.get(next), Ints.consts.get(propx++));
+            r_p_m_r_PropsMap[next] = propx++;
         }
     }
 
     /** See {@link #sparsePropsMap sparsePropsMap}.  */
-    private static final HashMap r_p_m_a_PropsMap;
+    private static final int[] r_p_m_a_PropsMap;
 
     /** See {@link #sparseIndices sparseIndices}.  */
     private static final int[] r_p_m_a_Indices;
@@ -132,16 +132,15 @@ public class FoPageSequenceMaster extends FONode {
     private static final int r_p_m_a_numProps;
 
     static {
-        r_p_m_a_PropsMap = new HashMap(1);
+        r_p_m_a_PropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(r_p_m_a_PropsMap, -1);
         r_p_m_a_numProps = 1;
         r_p_m_a_Indices = new int[] { PropNames.MAXIMUM_REPEATS };
-        r_p_m_a_PropsMap.put
-            (Ints.consts.get(PropNames.MAXIMUM_REPEATS),
-                                                Ints.consts.get(0));
+        r_p_m_a_PropsMap[PropNames.MAXIMUM_REPEATS] = 0;
     }
 
     /** See {@link #sparsePropsMap sparsePropsMap}. */
-    private static final HashMap c_p_m_r_PropsMap;
+    private static final int[] c_p_m_r_PropsMap;
 
     /** See {@link #sparseIndices sparseIndices}. */
     private static final int[] c_p_m_r_Indices;
@@ -161,7 +160,8 @@ public class FoPageSequenceMaster extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        c_p_m_r_PropsMap = new HashMap();
+        c_p_m_r_PropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(c_p_m_r_PropsMap, -1);
         c_p_m_r_numProps = propsets.cardinality();
         c_p_m_r_Indices = new int[c_p_m_r_numProps];
         int propx = 0;
@@ -169,8 +169,7 @@ public class FoPageSequenceMaster extends FONode {
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             c_p_m_r_Indices[propx] = next;
-            c_p_m_r_PropsMap.put
-                    (Ints.consts.get(next), Ints.consts.get(propx++));
+            c_p_m_r_PropsMap[next] = propx++;
         }
     }
 
index 8b696bd122406f56856876708aea7dec40df3c48..3fcb7d327a428a1e310d51bde294b1f0b349a847 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.datastructs.TreeException;
 import org.apache.fop.datatypes.Ints;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.BitSet;
 
@@ -38,7 +39,7 @@ public class FoRegionBeforeAfter extends FONode {
         position in the <i>sparsePropsSet</i> array. See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    protected static final HashMap sparsePropsMap;
+    protected static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -66,7 +67,8 @@ public class FoRegionBeforeAfter extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap();
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = propsets.cardinality();
         sparseIndices = new int[numProps];
         int propx = 0;
@@ -74,8 +76,7 @@ public class FoRegionBeforeAfter extends FONode {
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             sparseIndices[propx] = next;
-            sparsePropsMap.put
-                        (Ints.consts.get(next), Ints.consts.get(propx++));
+            sparsePropsMap[next] = propx++;
         }
     }
 
index 8e2038d9d71300b1e3fcb7e0f35de2a7dd52c6dc..9b8f9529dadaa78518037e17a02d1adfb1fbfa20 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.fop.datastructs.TreeException;
 import org.apache.fop.datatypes.PropertyValue;
 import org.apache.fop.datatypes.Ints;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.BitSet;
 
@@ -38,7 +39,7 @@ public class FoRegionBody extends FONode {
         position in the <i>sparsePropsSet</i> array. See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    private static final HashMap sparsePropsMap;
+    private static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -67,7 +68,8 @@ public class FoRegionBody extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap();
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = propsets.cardinality();
         sparseIndices = new int[numProps];
         int propx = 0;
@@ -75,8 +77,7 @@ public class FoRegionBody extends FONode {
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             sparseIndices[propx] = next;
-            sparsePropsMap.put
-                        (Ints.consts.get(next), Ints.consts.get(propx++));
+            sparsePropsMap[next] = propx++;
         }
     }
 
index 9af5e3c28e3d9c7ba43ef680cc03e37b5f83268f..207055b2f784e56ee7e87e9522e65b72b17bf342 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.datastructs.TreeException;
 import org.apache.fop.datatypes.Ints;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.BitSet;
 
@@ -38,7 +39,7 @@ public class FoRegionStartEnd extends FONode {
         position in the <i>sparsePropsSet</i> array. See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    protected static final HashMap sparsePropsMap;
+    protected static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -66,15 +67,15 @@ public class FoRegionStartEnd extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap();
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = propsets.cardinality();
         sparseIndices = new int[numProps];
         for (int next = propsets.nextSetBit(0);
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             sparseIndices[propx] = next;
-            sparsePropsMap.put
-                        (Ints.consts.get(next), Ints.consts.get(propx++));
+            sparsePropsMap[next] = propx++;
         }
     }
 
index 74f046650870764903a5041fc9e48616cbafafb5..8153a31d049c39baa4d9f0598b9db8671bd5a346 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.fop.datatypes.PropertyValue;
 import org.apache.fop.datatypes.NCName;
 import org.apache.fop.datatypes.Ints;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.BitSet;
 
@@ -41,7 +42,7 @@ public class FoSimplePageMaster extends FONode {
         position in the <i>sparsePropsSet</i> array.  See
         {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}.
      */
-    private static final HashMap sparsePropsMap;
+    private static final int[] sparsePropsMap;
 
     /** An <tt>int</tt> array of of the applicable property indices, in
         property index order. */
@@ -64,7 +65,8 @@ public class FoSimplePageMaster extends FONode {
         // sparsePropsSet is a HashMap containing the indicies of the
         // sparsePropsSet array, indexed by the FO index of the FO slot
         // in sparsePropsSet.
-        sparsePropsMap = new HashMap();
+        sparsePropsMap = new int[PropNames.LAST_PROPERTY_INDEX + 1];
+        Arrays.fill(sparsePropsMap, -1);
         numProps = propsets.cardinality();
         sparseIndices = new int[numProps];
         int propx = 0;
@@ -72,8 +74,7 @@ public class FoSimplePageMaster extends FONode {
                 next >= 0;
                 next = propsets.nextSetBit(next + 1)) {
             sparseIndices[propx] = next;
-            sparsePropsMap.put
-                        (Ints.consts.get(next), Ints.consts.get(propx++));
+            sparsePropsMap[next] = propx++;
         }
     }