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 ga...@apache.org on 2012/04/22 22:09:43 UTC

svn commit: r1328963 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/

Author: gadams
Date: Sun Apr 22 20:09:42 2012
New Revision: 1328963

URL: http://svn.apache.org/viewvc?rev=1328963&view=rev
Log:
Snapshot commit - does not build!

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java Sun Apr 22 20:09:42 2012
@@ -27,22 +27,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class AbsFunction extends FunctionBase {
 
-    /**
-     * @return 1 (the number of arguments required for the abs function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    /**
-     * @param args array of arguments to be evaluated, the first of which
-     * should be a numeric value
-     * @param propInfo the PropertyInfo object to be evaluated
-     * @return the absolute value of the input
-     * @throws PropertyException for non-numeric input
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo propInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo propInfo) throws PropertyException {
         Numeric num = args[0].getNumeric();
         if (num == null) {
             throw new PropertyException("Non numeric operand to abs function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java Sun Apr 22 20:09:42 2012
@@ -31,22 +31,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class BodyStartFunction extends FunctionBase {
 
-    /**
-     * @return 0 (there are no arguments for body-start)
-     */
-    public int nbArgs() {
-        return 0;
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 1;
     }
 
-    /**
-     * @param args array of arguments (none are used, but this is required by
-     * the Function interface)
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return numeric object containing the calculated body-start value
-     * @throws PropertyException if called from outside of an fo:list-item
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric distance
             = pInfo.getPropertyList()
               .get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java Sun Apr 22 20:09:42 2012
@@ -30,29 +30,25 @@ import org.apache.fop.fo.properties.Prop
  */
 class CIELabColorFunction extends FunctionBase {
 
-    /**
-     * cie-lab-color() takes 2 times 3 arguments.
-     * {@inheritDoc}
-     */
-    public int nbArgs() {
-        return 2 * 3;
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 6;
     }
 
+    @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new CIELabPercentBase();
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
 
         float red = args[0].getNumber().floatValue();
         float green = args[1].getNumber().floatValue();
         float blue = args[2].getNumber().floatValue();
         /* Verify sRGB replacement arguments */
-        if ((red < 0 || red > 255)
-                || (green < 0 || green > 255)
-                || (blue < 0 || blue > 255)) {
+        if ((red < 0 || red > 255) || (green < 0 || green > 255) || (blue < 0 || blue > 255)) {
             throw new PropertyException("sRGB color values out of range. "
                     + "Arguments to cie-lab-color() must be [0..255] or [0%..100%]");
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java Sun Apr 22 20:09:42 2012
@@ -27,17 +27,13 @@ import org.apache.fop.fo.properties.Prop
  */
 class CMYKcolorFunction extends FunctionBase {
 
-    /**
-     * cmyk takes four arguments.
-     * {@inheritDoc}
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 4;
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         StringBuffer sb = new StringBuffer();
         sb.append("cmyk(" + args[0] + "," + args[1] + "," + args[2] + "," + args[3] + ")");
         FOUserAgent ua = (pInfo == null)

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java Sun Apr 22 20:09:42 2012
@@ -24,12 +24,13 @@ import org.apache.fop.fo.properties.Prop
 
 class CeilingFunction extends FunctionBase {
 
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to ceiling function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java Sun Apr 22 20:09:42 2012
@@ -25,12 +25,13 @@ import org.apache.fop.fo.properties.Prop
 
 class FloorFunction extends FunctionBase {
 
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to floor function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java Sun Apr 22 20:09:42 2012
@@ -29,29 +29,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class FromParentFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum arguments for the from-parent function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     * @param args array of arguments, which should either be empty, or the
-     * first of which should contain an NCName corresponding to property name
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return property containing the computed value
-     * @throws PropertyException if the arguments are incorrect
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         String propName = args[0].getString();
         if (propName == null) {
             throw new PropertyException("Incorrect parameter to from-parent function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java Sun Apr 22 20:09:42 2012
@@ -37,32 +37,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class FromTableColumnFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum arguments for the from-table-column function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     *
-     * @param args array of arguments, which should either be empty, or the
-     * first of which should contain an NCName corresponding to a property name
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return the Property corresponding to the property name specified, or, if
-     * none, for the property for which the expression is being evaluated
-     * @throws PropertyException for incorrect arguments, and (for now) in all
-     * cases, because this function is not implemented
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args,PropertyInfo pInfo) throws PropertyException {
 
         FObj fo = pInfo.getPropertyList().getFObj();
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java Sun Apr 22 20:09:42 2012
@@ -28,11 +28,34 @@ import org.apache.fop.fo.properties.Prop
 public interface Function {
 
     /**
-     * @return the number of arguments that must be passed to this function. For
-     * example, if the function should determine the minimum of two numbers, it
-     * must be passed two arguments, one for each of the two values.
+     * @return the number of required (non-optional) arguments that must be specified
+     * in the argument list
      */
-    int nbArgs();
+    int getRequiredArgsCount();
+
+    /**
+     * @return the number of non-required (optional) arguments that may be specified
+     * in the argument list, which, if specified, must follow the required arguments
+     */
+    int getOptionalArgsCount();
+
+    /**
+     * @param index of optional argument
+     * @param pi property information instance that applies to property being evaluated
+     * @return the default property value for the optional argument at INDEX, where
+     * INDEX is with respect to optional arguments; i.e., the first optional argument
+     * position is index 0; if no default for a given index, then null is returned
+     * @throws PropertyException if index is greater than or equal to optional args count
+     */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException;
+
+    /**
+     * Determine if function allows variable arguments. If it does, then they must appear
+     * after required and optional arguments, and all optional arguments must be specified.
+     * @return true if function permits additional variable number of arguments after
+     * required and (completely specified) optional arguments
+     */
+    boolean hasVariableArgs();
 
     /**
      * @return the basis for percentage calculations
@@ -42,16 +65,10 @@ public interface Function {
     /**
      * Evaluate the function
      * @param args an array of Properties that should be evaluated
-     * @param propInfo the PropertyInfo
+     * @param pi property information instance that applies to property being evaluated
      * @return the Property satisfying the function
      * @throws PropertyException for problems when evaluating the function
      */
-    Property eval(Property[] args,
-                  PropertyInfo propInfo) throws PropertyException;
+    Property eval(Property[] args, PropertyInfo pi) throws PropertyException;
 
-    /**
-     * @return if it is allowed to fill up the property list with
-     * the property name if only one arg is missing.
-     */
-    boolean padArgsWithPropertyName();
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java Sun Apr 22 20:09:42 2012
@@ -26,17 +26,37 @@ import org.apache.fop.datatypes.PercentB
  */
 public abstract class FunctionBase implements Function {
 
-    /**
-     * @return null (by default, functions have no percent-based arguments)
-     */
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) new PropertyException {
+        if ( index >= getOptionalArgsCount() ) {
+            PropertyException e = new PropertyException ( new IndexOutOfBoundException ( "illegal optional argument index" ) );
+            e.setPropertyInfo ( pi );
+            throw e;
+        } else {
+            return null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public int hasVariableArgs() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return null;
     }
 
     /**
-     * @return false (by default don't pad arglist with property-name)
+     * @param pi property information instance that applies to property being evaluated
+     * @return string property whose value is name of property being evaluated
      */
-    public boolean padArgsWithPropertyName() {
-        return false;
+    protected final Property getPropertyName ( PropertyInfo pi ) {
+        return StringProperty.getInstance ( pi.getPropertMaker().getName() );
     }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Sun Apr 22 20:09:42 2012
@@ -31,24 +31,25 @@ import org.apache.fop.util.ColorUtil;
  */
 class ICCColorFunction extends FunctionBase {
 
-    /**
-     * rgb-icc takes a variable number of arguments.
-     * At least 4 should be passed - returns -4
-     * {@inheritDoc}
-     */
-    public int nbArgs() {
-        return -4;
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 4;
     }
 
+    @Override
     /** {@inheritDoc} */
+    public int hasVariableArgs() {
+        return true;
+    }
+
     @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new ICCPercentBase();
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
         Declarations decls = (pInfo.getFO() != null
@@ -86,9 +87,7 @@ class ICCColorFunction extends FunctionB
         green = args[1].getNumber().floatValue();
         blue = args[2].getNumber().floatValue();
         /* Verify rgb replacement arguments */
-        if ((red < 0 || red > 255)
-                || (green < 0 || green > 255)
-                || (blue < 0 || blue > 255)) {
+        if ((red < 0 || red > 255) || (green < 0 || green > 255) || (blue < 0 || blue > 255)) {
             throw new PropertyException("Color values out of range. "
                     + "Arguments to rgb-icc() must be [0..255] or [0%..100%]");
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java Sun Apr 22 20:09:42 2012
@@ -28,30 +28,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class InheritedPropFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum number of arguments for the inherited-property-value
-     * function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     *
-     * @param args arguments to be evaluated
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return Property satisfying the inherited-property-value
-     * @throws PropertyException for invalid parameter
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         String propName = args[0].getString();
         if (propName == null) {
             throw new PropertyException("Incorrect parameter to inherited-property-value function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java Sun Apr 22 20:09:42 2012
@@ -34,23 +34,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class LabelEndFunction extends FunctionBase {
 
-    /**
-     * @return 0 (the number of arguments required for the label-end function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 0;
     }
 
-    /**
-     *
-     * @param args array of arguments for the function (none are needed, but
-     * required for the Function interface)
-     * @param pInfo PropertyInfo object for the function
-     * @return the calculated label-end value for the list
-     * @throws PropertyException if called from outside of an fo:list-item
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
 
         Length distance = pInfo.getPropertyList().get(
                 Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getLength();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java Sun Apr 22 20:09:42 2012
@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class MaxFunction extends FunctionBase {
 
-    /**
-     * @return 2 (the number of arguments required for the max function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 2;
     }
 
-    /**
-     * Handle "numerics" if no proportional/percent parts
-     * @param args array of arguments to be processed
-     * @param pInfo PropertyInfo to be processed
-     * @return the maximum of the two args elements passed
-     * @throws PropertyException for invalid operands
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric n1 = args[0].getNumeric();
         Numeric n2 = args[1].getNumeric();
         if (n1 == null || n2 == null) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java Sun Apr 22 20:09:42 2012
@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class MinFunction extends FunctionBase {
 
-    /**
-     * @return 2 (the number of arguments required for the min function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 2;
     }
 
-    /**
-     * Handle "numerics" if no proportional/percent parts
-     * @param args array of arguments to be processed
-     * @param pInfo PropertyInfo to be processed
-     * @return the minimum of the two args elements passed
-     * @throws PropertyException for invalid operands
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric n1 = args[0].getNumeric();
         Numeric n2 = args[1].getNumeric();
         if (n1 == null || n2 == null) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java Sun Apr 22 20:09:42 2012
@@ -31,11 +31,8 @@ import org.apache.fop.fo.properties.Prop
  */
 class NamedColorFunction extends FunctionBase {
 
-    /**
-     * rgb-named-color() takes a 5 arguments.
-     * {@inheritDoc}
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 5;
     }
 
@@ -46,8 +43,7 @@ class NamedColorFunction extends Functio
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
         String colorName = args[4].getString();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java Sun Apr 22 20:09:42 2012
@@ -28,30 +28,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class NearestSpecPropFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum number of arguments for from-nearest-specified-value
-     * function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     *
-     * @param args array of arguments for the function
-     * @param pInfo PropertyInfo for the function
-     * @return Property containing the nearest-specified-value
-     * @throws PropertyException for invalid arguments to the function
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         String propName = args[0].getString();
         if (propName == null) {
             throw new PropertyException(

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java Sun Apr 22 20:09:42 2012
@@ -32,32 +32,19 @@ import org.apache.fop.fo.properties.Tabl
  */
 public class PPColWidthFunction extends FunctionBase {
 
-    /**
-     * @return 1 (the number of arguments for the proportional-column-width
-     * function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    /**
-     * @return the {@link PercentBase} for the proportional-column-width()
-     *         function
-     */
+    @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new PPColWidthPercentBase();
     }
-    /**
-     *
-     * @param args array of arguments for this function
-     * @param pInfo PropertyInfo for this function
-     * @return numeric Property containing the units of proportional measure
-     * for this column
-     * @throws PropertyException for non-numeric operand, or if the parent
-     * element is not a table-column
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number d = args[0].getNumber();
         if (d == null) {
             throw new PropertyException("Non numeric operand to "

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java Sun Apr 22 20:09:42 2012
@@ -59,13 +59,11 @@ public final class PropertyParser extend
         FUNCTION_TABLE.put("rgb", new RGBColorFunction());
         FUNCTION_TABLE.put("system-color", new SystemColorFunction());
         FUNCTION_TABLE.put("from-table-column", new FromTableColumnFunction());
-        FUNCTION_TABLE.put("inherited-property-value",
-                          new InheritedPropFunction());
+        FUNCTION_TABLE.put("inherited-property-value", new InheritedPropFunction());
+        FUNCTION_TABLE.put("from-nearest-specified-value", new NearestSpecPropFunction());
+        FUNCTION_TABLE.put("from-page-master-region", new FromPageMasterRegionFunction());
         FUNCTION_TABLE.put("from-parent", new FromParentFunction());
-        FUNCTION_TABLE.put("from-nearest-specified-value",
-                          new NearestSpecPropFunction());
-        FUNCTION_TABLE.put("proportional-column-width",
-                          new PPColWidthFunction());
+        FUNCTION_TABLE.put("proportional-column-width", new PPColWidthFunction());
         FUNCTION_TABLE.put("label-end", new LabelEndFunction());
         FUNCTION_TABLE.put("body-start", new BodyStartFunction());
         FUNCTION_TABLE.put("rgb-icc", new ICCColorFunction());
@@ -379,7 +377,6 @@ public final class PropertyParser extend
             next();
         } else {
             while (true) {
-
                 prop = parseAdditiveExpr();
                 if (i < nbArgs) {
                     args[i++] = prop;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java Sun Apr 22 20:09:42 2012
@@ -67,7 +67,7 @@ class PropertyTokenizer {
     }
 
     /**
-     * Return the next token in the expression string.
+     * Parse the next token in the expression string.
      * This sets the following package visible variables:
      * currentToken  An enumerated value identifying the recognized token
      * currentTokenValue  A String containing the token contents

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java Sun Apr 22 20:09:42 2012
@@ -30,22 +30,18 @@ import org.apache.fop.fo.properties.Prop
 class RGBColorFunction extends FunctionBase {
 
     /** {@inheritDoc} */
-    public int nbArgs() {
+    public int getRequiredArgsCount() {
         return 3;
     }
 
-    /**
-     * @return an object which implements the PercentBase interface.
-     * Percents in arguments to this function are interpreted relative
-     * to 255.
-     */
+    @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new RGBPercentBase();
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
       return ColorProperty.getInstance(pInfo.getUserAgent(),
                                        "rgb(" + args[0] + ","
                                        + args[1] + "," + args[2] + ")");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java Sun Apr 22 20:09:42 2012
@@ -24,12 +24,14 @@ import org.apache.fop.fo.properties.Numb
 import org.apache.fop.fo.properties.Property;
 
 class RoundFunction extends FunctionBase {
-    public int nbArgs() {
+
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to round function");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java?rev=1328963&r1=1328962&r2=1328963&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java Sun Apr 22 20:09:42 2012
@@ -29,13 +29,12 @@ import org.apache.fop.fo.properties.Prop
 class SystemColorFunction extends FunctionBase {
 
     /** {@inheritDoc} */
-    public int nbArgs() {
+    public int getRequiredArgsCount() {
         return 1;
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         FOUserAgent ua = (pInfo == null)
                 ? null
                 : (pInfo.getFO() == null ? null : pInfo.getFO().getUserAgent());



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


Re: svn commit: r1328963 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/

Posted by Vincent Hennebert <vh...@gmail.com>.
On 24/04/12 16:26, Glenn Adams wrote:
> On Tue, Apr 24, 2012 at 9:12 AM, Vincent Hennebert <vh...@gmail.com>wrote:
> 
>> On 22/04/12 21:09, gadams@apache.org wrote:
>>> Author: gadams
>>> Date: Sun Apr 22 20:09:42 2012
>>> New Revision: 1328963
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1328963&view=rev
>>> Log:
>>> Snapshot commit - does not build!
>>
>> What does that mean? Could you briefly describe the purpose of this
>> commit?
>>
> 
> This was a side effect of failing to perform a rebase on a local merge
> prior to an svn commit.
> 
> 
>> Also, I’d suggest not to bother about /** {@inheritDoc} */ any more, now
>> that Checkstyle rules about Javadocs have been removed. This is just
>> noise really.
>>
> 
> I was thinking to fix warnings from javadoc builds prior to doing a release.

You don’t have to use @inheritDoc for that. You can just leave the
method undocumented and the javadoc tool will pick the comment from the
overridden method.

Vincent

Re: svn commit: r1328963 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/

Posted by Glenn Adams <gl...@skynav.com>.
On Tue, Apr 24, 2012 at 9:12 AM, Vincent Hennebert <vh...@gmail.com>wrote:

> On 22/04/12 21:09, gadams@apache.org wrote:
> > Author: gadams
> > Date: Sun Apr 22 20:09:42 2012
> > New Revision: 1328963
> >
> > URL: http://svn.apache.org/viewvc?rev=1328963&view=rev
> > Log:
> > Snapshot commit - does not build!
>
> What does that mean? Could you briefly describe the purpose of this
> commit?
>

This was a side effect of failing to perform a rebase on a local merge
prior to an svn commit.


> Also, I’d suggest not to bother about /** {@inheritDoc} */ any more, now
> that Checkstyle rules about Javadocs have been removed. This is just
> noise really.
>

I was thinking to fix warnings from javadoc builds prior to doing a release.

Re: svn commit: r1328963 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/

Posted by Vincent Hennebert <vh...@gmail.com>.
On 22/04/12 21:09, gadams@apache.org wrote:
> Author: gadams
> Date: Sun Apr 22 20:09:42 2012
> New Revision: 1328963
> 
> URL: http://svn.apache.org/viewvc?rev=1328963&view=rev
> Log:
> Snapshot commit - does not build!

What does that mean? Could you briefly describe the purpose of this
commit?

Also, I’d suggest not to bother about /** {@inheritDoc} */ any more, now
that Checkstyle rules about Javadocs have been removed. This is just
noise really.


Thanks,
Vincent


> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/AbsFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/CeilingFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FloorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromParentFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/Function.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/FunctionBase.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MaxFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/MinFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RoundFunction.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
<snip/>