From 15fc41dbf8c67d95677e91c529563980f35d67aa Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sat, 10 Jan 2004 20:40:07 +0000 Subject: [PATCH] switch from Property.getPropName() to Property.getPropId(); comments added to PropertySets.java to clarify makeSparseIndices() method. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197156 13f79535-47bb-0310-9956-ffa450edef68 --- src/codegen/properties.xsl | 2 +- .../datatypes/ToBeImplementedProperty.java | 2 +- src/java/org/apache/fop/fo/Property.java | 2 +- src/java/org/apache/fop/fo/PropertySets.java | 20 ++++++++++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 1c3a6fd98..c2e00f1a5 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -883,7 +883,7 @@ public class (listprop); p = shparser.getValueForProperty( - getPropName(), this, propertyList); + getPropId(), this, propertyList); } } diff --git a/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java b/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java index 97717ca06..73997c228 100644 --- a/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java +++ b/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java @@ -69,7 +69,7 @@ public class ToBeImplementedProperty extends Property { } ToBeImplementedProperty val = - new ToBeImplementedProperty(getPropName()); + new ToBeImplementedProperty(getPropId()); return val; } } diff --git a/src/java/org/apache/fop/fo/Property.java b/src/java/org/apache/fop/fo/Property.java index 700615e67..bc8946c83 100644 --- a/src/java/org/apache/fop/fo/Property.java +++ b/src/java/org/apache/fop/fo/Property.java @@ -81,7 +81,7 @@ public class Property { /** * @return the name of the property for this Maker */ - protected int getPropName() { + protected int getPropId() { return propId; } diff --git a/src/java/org/apache/fop/fo/PropertySets.java b/src/java/org/apache/fop/fo/PropertySets.java index bdcb1f06d..8eb39adfb 100644 --- a/src/java/org/apache/fop/fo/PropertySets.java +++ b/src/java/org/apache/fop/fo/PropertySets.java @@ -1267,13 +1267,27 @@ public class PropertySets { } + /* These arrays, one for each formatting object, define the properties that + * are valid for an FO and its children. The first element, indices[0], + * will be used in PropertyList to define the size of the Property[] array + * for the FObj (= the number of properties valid for the element + 1.) + * Each other element of this array has a value of 0 if not supported by the FO, + * 1-based index otherwise. This array will be used as a pointer to the Property[] + * array in PropertyList holding the valid properties for the FO. + * i.e., fo.propList.values[indices[propId]] will refer to the correct Property + * element if the property is valid for the FO, values[indices[invalPropId]] = + * values[0] = NULL otherwise. + */ private static short[] makeSparseIndices(BitSet set) { - short[] indices = new short[Constants.PROPERTY_COUNT]; + short[] indices = new short[Constants.PROPERTY_COUNT +1]; + indices[0] = (short) (set.cardinality() + 1); - int j = 1; + + int propIndex = 1; for (int i = set.nextSetBit(0); i >= 0; i = set.nextSetBit(i+1)) { - indices[i] = (short) j++; + indices[i] = (short) propIndex++; } + return indices; } -- 2.39.5