protected LinkedList[] propertyStacks;
/**
- * A <tt>HashMap</tt> of arrays of <tt>Numeric[]</tt> keyed on the
- * index of properties which support MAPPED_NUMERIC data types.
+ * An FONode identifier. This is available to be incremented for
+ * each FONode created. The only requirement is that active FONodes
+ * have a unique identifier. An accessor function is defined, but the
+ * responsibility for calling it rests with FONode.
*/
- private HashMap mappedNumericArrays = new HashMap();
+ private int nodeID = 0;
+
+ /**
+ * Get the next node identifier. There is no need to synchronize this
+ * as FONodes are created within a single thread.
+ * @return the next node identifier
+ */
+ public int nextNodeID() {
+ return ++nodeID;
+ }
/**
* @param xmlevents the buffer from which <tt>XMLEvent</tt>s from the
}
}
- // Initialise the Numeric arrays for properties with
- // MAPPED_NUMERIC datatypes
- for (int i = 0; i <= PropNames.LAST_PROPERTY_INDEX; i++ ) {
- if ((PropertyConsts.dataTypes.get(i)
- & Properties.MAPPED_NUMERIC) != 0) {
- try {
- Numeric[] numarray =
- (Numeric[])
- ((Method) (
- PropertyConsts.mappedNumMethods
- .get(Ints.consts.get(i))
- ))
- .invoke(null, null);
- mappedNumericArrays.put(Ints.consts.get(i),numarray);
- } catch (IllegalAccessException e) {
- throw new PropertyException(e.getMessage());
- } catch (InvocationTargetException e) {
- throw new PropertyException(e.getMessage());
- }
- }
- }
}
/**
(new PropertyTriplet(property, value));
}
- /**
- * @param property <tt>int</t> property index
- * @param enumIndex <tt>int</t> enumerated value index into array
- * of mapped <tt>Numeric</tt> values
- * @return <tt>Numeric</tt> corresponding to the <tt>MAPPED_NUMERIC</tt>
- * enumeration token for this property
- */
- public Numeric getMappedNumArrayValue(int property, int enumIndex)
- {
- return
- ((Numeric[])
- (mappedNumericArrays.get(Ints.consts.get(property)))
- )[enumIndex];
- }
-
/**
* @return a <tt>TextDecorations</tt> object containing the current
* text decorations
import org.apache.fop.fo.PropNames;
import org.apache.fop.fo.Properties;
import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.datatypes.Numeric;
import org.apache.fop.datatypes.Ints;
import org.apache.fop.datastructs.ROIntArray;
import org.apache.fop.datastructs.ROStringArray;
}
}
+ public static Numeric getMappedNumeric(int property, int enum)
+ throws PropertyException
+ {
+ Method method;
+ if ((method =
+ (Method)(mappednummethods.get(Ints.consts.get(property))))
+ == null)
+ throw new PropertyException("No mappedLength method in "
+ + classes[property].getName());
+ try {
+ return (Numeric)
+ (method.invoke
+ (null, new Object[] {Ints.consts.get(enum)}));
+ } catch (IllegalAccessException iae) {
+ throw new PropertyException(iae.getMessage());
+ } catch (InvocationTargetException ite) {
+ throw new PropertyException(ite.getMessage());
+ }
+ }
+
/**
* @param property String name of the FO property
* @return int type of inheritance for this property
("refineParsing", new Class[]
{org.apache.fop.fo.FOTree.class,
PropertyValue.class});
- if ((datatypes[i] & Properties.MAPPED_NUMERIC) != 0)
+ if ((datatypes[i] & Properties.MAPPED_LENGTH) != 0)
mappednummethods.put(Ints.consts.get(i),
classes[i].getMethod
- ("getMappedNumArray", new Class[] {}));
+ ("getMappedLength", new Class[]
+ {Integer.class}));
}
catch (NoSuchFieldException e) {
throw new RuntimeException(