From b152bef94037e9a3c06a632ef7858f556e7213aa Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sat, 3 Jan 2004 13:00:50 +0000 Subject: [PATCH] Adjusted HashMap initial size. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197104 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/fo/PropertyConsts.java | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/java/org/apache/fop/fo/PropertyConsts.java b/src/java/org/apache/fop/fo/PropertyConsts.java index 368b8cb19..cf757a1ef 100644 --- a/src/java/org/apache/fop/fo/PropertyConsts.java +++ b/src/java/org/apache/fop/fo/PropertyConsts.java @@ -137,8 +137,8 @@ public class PropertyConsts { * of a property class. The index value is the index of the property * class name in the classNames[] array. */ - private final HashMap classToIndex - = new HashMap(PropNames.LAST_PROPERTY_INDEX + 1); + private final HashMap classToIndex = new HashMap( + (int)((PropNames.LAST_PROPERTY_INDEX + 1) / 0.75) + 1); /** * An int[] containing the inherited values from the @@ -458,8 +458,6 @@ public class PropertyConsts { Class pclass; Property property; - //System.out.println("setupProperty " + propindex + " " - //+ PropNames.getPropertyName(propindex)); if ((property = properties[propindex]) != null) return property; // Get the property class name @@ -484,38 +482,25 @@ public class PropertyConsts { // Get the class for this property name String name = packageName + ".properties." + cname; try { - //System.out.println("classes["+propindex+"] "+name);//DEBUG pclass = Class.forName(name); classes[propindex] = pclass; // Instantiate the class property = (Property)(pclass.newInstance()); properties[propindex] = property; - //System.out.println - //("property name " - //+ property.getClass().getName()); - //System.out.println - //("property name " + - //properties[propindex].getClass().getName()); // Set inheritance value if ((inherited[propindex] - = pclass.getField("inherited").getInt(null)) + = property.getInherited()) != Property.NO) inheritedprops.set(propindex); // Set datatypes - datatypes[propindex] = pclass.getField("dataTypes").getInt(null); - //System.out.println("datatypes " + datatypes[propindex] + "\n" - //+ Property.listDataTypes(datatypes[propindex])); + datatypes[propindex] = property.getDataTypes(); // Set initialValueTypes - initialValueTypes[propindex] = - pclass.getField("initialValueType").getInt(null); - //System.out.println("initialValueType " - //+ initialValueTypes[propindex]); + initialValueTypes[propindex] = property.getInitialValueType(); - traitMappings[propindex] = - pclass.getField("traitMapping").getInt(null); + traitMappings[propindex] = property.getTraitMapping(); } catch (ClassNotFoundException e) { throw new PropertyException @@ -527,10 +512,6 @@ public class PropertyConsts { throw new PropertyException ("InstantiationException" + e.getMessage()); } - catch (NoSuchFieldException e) { - throw new PropertyException - ("NoSuchFieldException" + e.getMessage()); - } return property; } -- 2.39.5