You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by pb...@apache.org on 2002/08/27 17:33:04 UTC

cvs commit: xml-fop/src/org/apache/fop/fo FOTree.java PropertyConsts.java

pbwest      2002/08/27 08:33:04

  Modified:    src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FOTree.java
                        PropertyConsts.java
  Log:
  Changes to handling of MAPPED_NUMERIC
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +16 -41    xml-fop/src/org/apache/fop/fo/Attic/FOTree.java
  
  Index: FOTree.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/FOTree.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- FOTree.java	19 Aug 2002 16:08:22 -0000	1.1.2.6
  +++ FOTree.java	27 Aug 2002 15:33:04 -0000	1.1.2.7
  @@ -82,10 +82,21 @@
       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
  @@ -141,27 +152,6 @@
               }
           }
   
  -        // 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());
  -                }
  -            }
  -        }
       }
   
       /**
  @@ -193,21 +183,6 @@
           int property = value.getProperty();
           propertyStacks[property].addLast
                   (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];
       }
   
       /**
  
  
  
  1.1.2.7   +27 -5     xml-fop/src/org/apache/fop/fo/Attic/PropertyConsts.java
  
  Index: PropertyConsts.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/PropertyConsts.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- PropertyConsts.java	19 Aug 2002 16:20:54 -0000	1.1.2.6
  +++ PropertyConsts.java	27 Aug 2002 15:33:04 -0000	1.1.2.7
  @@ -27,6 +27,7 @@
   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;
  @@ -145,6 +146,26 @@
           }
       }
   
  +    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
  @@ -542,10 +563,11 @@
                                           ("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(
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org