]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Last of string->int conversions (more structural improvements still can be
authorGlen Mazza <gmazza@apache.org>
Wed, 7 Jan 2004 21:10:38 +0000 (21:10 +0000)
committerGlen Mazza <gmazza@apache.org>
Wed, 7 Jan 2004 21:10:38 +0000 (21:10 +0000)
done in PropertyList from Finn's patch, however).  Made Constants values
inherent to CompoundDatatype class.

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

src/codegen/properties.xsl
src/java/org/apache/fop/datatypes/CompoundDatatype.java
src/java/org/apache/fop/datatypes/CondLength.java
src/java/org/apache/fop/datatypes/Keep.java
src/java/org/apache/fop/datatypes/LengthPair.java
src/java/org/apache/fop/fo/Property.java
src/java/org/apache/fop/fo/PropertyList.java

index 2adb422cecce67fd58caa85ca101f831cea6a970..5a4970963fbe144c1c3ef96b9fb1a13cd50fa728 100644 (file)
@@ -576,8 +576,7 @@ public class </xsl:text>
         return baseProp;
     }
 
-    public Property getSubpropValue(Property baseProp, String subpropName) {
-        int subpropId = org.apache.fop.fo.properties.FOPropertyMapping.getSubPropertyId(subpropName);
+    public Property getSubpropValue(Property baseProp, int subpropId) {
         </xsl:text>
         <xsl:value-of select="datatype"/>
         <xsl:text> val = baseProp.get</xsl:text>
index 097b966d41b86bd605e539975227e10edaf54b78..14e32b711022988bae2ed65a2b4468564cba2fcb 100644 (file)
 package org.apache.fop.datatypes;
 
 import org.apache.fop.fo.Property;
+import org.apache.fop.fo.Constants;
 
 /**
  * This interface is used as a base for compound datatypes.
  */
-public interface CompoundDatatype {
+public interface CompoundDatatype extends Constants {
     
     /**
      * Sets a component of the compound datatype.
index 75c37e6f79be77307c2cd66370b13f8421d36ed3..18ca33d2bb8930598f795c783fdd0e2a41f8b112 100644 (file)
@@ -67,9 +67,9 @@ public class CondLength implements CompoundDatatype {
      */
     public void setComponent(int cmpId, Property cmpnValue,
                              boolean bIsDefault) {
-        if (cmpId == Constants.CP_LENGTH) {
+        if (cmpId == CP_LENGTH) {
             length = cmpnValue;
-        } else if (cmpId == Constants.CP_CONDITIONALITY) {
+        } else if (cmpId == CP_CONDITIONALITY) {
             conditionality = cmpnValue;
         }
     }
@@ -78,9 +78,9 @@ public class CondLength implements CompoundDatatype {
      * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
      */
     public Property getComponent(int cmpId) {
-        if (cmpId == Constants.CP_LENGTH) {
+        if (cmpId == CP_LENGTH) {
             return length;
-        } else if (cmpId == Constants.CP_CONDITIONALITY) {
+        } else if (cmpId == CP_CONDITIONALITY) {
             return conditionality;
         } else {
             return null;
index 9089c5d46c72092debd3e16a8a9a0794e832f855..3c68ad5e66e151ea9f49d14176f3decc9560e141 100644 (file)
@@ -73,11 +73,11 @@ public class Keep implements CompoundDatatype {
      */
     public void setComponent(int cmpId, Property cmpnValue,
                              boolean bIsDefault) {
-        if (cmpId == Constants.CP_WITHIN_LINE) {
+        if (cmpId == CP_WITHIN_LINE) {
             setWithinLine(cmpnValue, bIsDefault);
-        } else if (cmpId == Constants.CP_WITHIN_COLUMN) {
+        } else if (cmpId == CP_WITHIN_COLUMN) {
             setWithinColumn(cmpnValue, bIsDefault);
-        } else if (cmpId == Constants.CP_WITHIN_PAGE) {
+        } else if (cmpId == CP_WITHIN_PAGE) {
             setWithinPage(cmpnValue, bIsDefault);
         }
     }
@@ -86,11 +86,11 @@ public class Keep implements CompoundDatatype {
      * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
      */
     public Property getComponent(int cmpId) {
-        if (cmpId == Constants.CP_WITHIN_LINE) {
+        if (cmpId == CP_WITHIN_LINE) {
             return getWithinLine();
-        } else if (cmpId == Constants.CP_WITHIN_COLUMN) {
+        } else if (cmpId == CP_WITHIN_COLUMN) {
             return getWithinColumn();
-        } else if (cmpId == Constants.CP_WITHIN_PAGE) {
+        } else if (cmpId == CP_WITHIN_PAGE) {
             return getWithinPage();
         } else {
             return null;
index 21863d2a15bc221af590b08daeb9aa8dd05a9478..ac2de9c8b84d95ff481f8ee13bd50201ffdefe9c 100644 (file)
@@ -68,9 +68,9 @@ public class LengthPair implements CompoundDatatype {
      */
     public void setComponent(int cmpId, Property cmpnValue,
                              boolean bIsDefault) {
-        if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) {
+        if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
             bpd = cmpnValue;
-        } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) {
+        } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
             ipd = cmpnValue;
         }
     }
@@ -79,9 +79,9 @@ public class LengthPair implements CompoundDatatype {
      * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
      */
     public Property getComponent(int cmpId) {
-        if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) {
+        if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
             return getBPD();
-        } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) {
+        } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
             return getIPD();
         } else {
             return null;    // SHOULDN'T HAPPEN
index 0fd2ba732552cfdcf89b22947470c379fb46ca94..febf164a060e36b32e5751968232a49648041d74 100644 (file)
@@ -155,7 +155,7 @@ public class Property {
          * property.
          * @param p A property value for a compound property type such as
          * SpaceProperty.
-         * @param subprop The name of the component whose value is to be
+         * @param subprop The Constants ID of the component whose value is to be
          * returned.
          * NOTE: this is only to ease porting when calls are made to
          * PropertyList.get() using a component name of a compound property,
@@ -165,7 +165,7 @@ public class Property {
          * compound properties.
          * @return the Property containing the subproperty
          */
-        public Property getSubpropValue(Property p, String subprop) {
+        public Property getSubpropValue(Property p, int subpropId) {
             return null;
         }
 
index cfb8396c4085503e7550e968cf767673933b43bd..8c69f0e880bef3fb9f7adc17437ee44f7b281dbb 100644 (file)
@@ -521,8 +521,8 @@ public class PropertyList extends HashMap {
         /* If the baseProperty has already been created, return it
          * e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
          */
-        int propId = FOPropertyMapping.getPropertyId(basePropName);
-        Property baseProperty = getExplicitBaseProp(propId);
+
+        Property baseProperty = (Property) super.get(basePropName);
 
         if (baseProperty != null) {
             return baseProperty;
@@ -588,13 +588,10 @@ public class PropertyList extends HashMap {
      */
     private Property getSubpropValue(Property p, int propId) {
 
-        String subpropName = FOPropertyMapping.getPropertyName(propId &
-            Constants.COMPOUND_MASK);
-
         Property.Maker maker = findMaker(propId & Constants.PROPERTY_MASK);
 
         if (maker != null) {
-            return maker.getSubpropValue(p, subpropName);
+            return maker.getSubpropValue(p, propId & Constants.COMPOUND_MASK);
         } else {
             return null;
         }