From: Peter Bernard West Date: Tue, 3 Dec 2002 07:47:44 +0000 (+0000) Subject: Changed sparsePropsMap from HashMap to int[]. X-Git-Tag: Alt-Design_pre_src-java-org~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4468c4a2a997dc34d26ed95f2caa72061295fb43;p=xmlgraphics-fop.git Changed sparsePropsMap from HashMap to int[]. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195727 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java b/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java index 5df54ffc2..48a5e99fe 100644 --- a/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java +++ b/src/org/apache/fop/fo/pagination/FoLayoutMasterSet.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - private static final HashMap sparsePropsMap; + private static final int[] sparsePropsMap; /** An int 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[] {}; } diff --git a/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java b/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java index dbf29d4c3..858fc18af 100644 --- a/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java +++ b/src/org/apache/fop/fo/pagination/FoPageSequenceMaster.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - private static final HashMap sparsePropsMap; + private static final int[] sparsePropsMap; /** An int 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++; } } diff --git a/src/org/apache/fop/fo/pagination/FoRegionBeforeAfter.java b/src/org/apache/fop/fo/pagination/FoRegionBeforeAfter.java index 8b696bd12..3fcb7d327 100644 --- a/src/org/apache/fop/fo/pagination/FoRegionBeforeAfter.java +++ b/src/org/apache/fop/fo/pagination/FoRegionBeforeAfter.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - protected static final HashMap sparsePropsMap; + protected static final int[] sparsePropsMap; /** An int 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++; } } diff --git a/src/org/apache/fop/fo/pagination/FoRegionBody.java b/src/org/apache/fop/fo/pagination/FoRegionBody.java index 8e2038d9d..9b8f9529d 100644 --- a/src/org/apache/fop/fo/pagination/FoRegionBody.java +++ b/src/org/apache/fop/fo/pagination/FoRegionBody.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - private static final HashMap sparsePropsMap; + private static final int[] sparsePropsMap; /** An int 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++; } } diff --git a/src/org/apache/fop/fo/pagination/FoRegionStartEnd.java b/src/org/apache/fop/fo/pagination/FoRegionStartEnd.java index 9af5e3c28..207055b2f 100644 --- a/src/org/apache/fop/fo/pagination/FoRegionStartEnd.java +++ b/src/org/apache/fop/fo/pagination/FoRegionStartEnd.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - protected static final HashMap sparsePropsMap; + protected static final int[] sparsePropsMap; /** An int 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++; } } diff --git a/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java b/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java index 74f046650..8153a31d0 100644 --- a/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/FoSimplePageMaster.java @@ -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 sparsePropsSet array. See {@link org.apache.fop.fo.FONode#sparsePropsSet FONode.sparsePropsSet}. */ - private static final HashMap sparsePropsMap; + private static final int[] sparsePropsMap; /** An int 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++; } }