]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
static boolean array inheritableProperty[] added, to reduce processing costs
authorGlen Mazza <gmazza@apache.org>
Tue, 13 Jan 2004 23:28:31 +0000 (23:28 +0000)
committerGlen Mazza <gmazza@apache.org>
Tue, 13 Jan 2004 23:28:31 +0000 (23:28 +0000)
of lookups to see if a property is inheritable.  Work based on Finn Bock's patch.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197158 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/PropertyList.java

index 343481dedf384ed6e674083db0845d5efcd86c1d..b0935d42d1541093f84bab561c1ba395e7e21044 100644 (file)
@@ -69,6 +69,7 @@ public class PropertyList extends HashMap {
     // writing-mode values
     private byte[] wmtable = null;
     private int writingMode;
+    private static boolean[] inheritableProperty;
 
     // absolute directions and dimensions
     /** constant for direction "left" */
@@ -678,14 +679,16 @@ public class PropertyList extends HashMap {
      * @return isInherited value from the requested Property.Maker
      */
     private boolean isInherited(int propId) {
-        boolean b = true;
-
-        Property.Maker propertyMaker = findMaker(propId);
-        if (propertyMaker != null) {
-            b = propertyMaker.isInherited();
+        if (inheritableProperty == null) {
+            inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1];
+            Property.Maker maker = null;
+            for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) {
+                maker = findMaker(prop);
+                inheritableProperty[prop] = (maker != null && maker.isInherited());
+            }    
         }
-        
-        return b;
+
+        return inheritableProperty[propId];
     }    
 
     /**