Browse Source

Snapshot commit - does not build!

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1328963 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_1rc1old
Glenn Adams 12 years ago
parent
commit
41d337ba2c
23 changed files with 203 additions and 247 deletions
  1. 4
    13
      src/java/org/apache/fop/fo/expr/AbsFunction.java
  2. 5
    14
      src/java/org/apache/fop/fo/expr/BodyStartFunction.java
  3. 7
    11
      src/java/org/apache/fop/fo/expr/CIELabColorFunction.java
  4. 3
    7
      src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java
  5. 4
    3
      src/java/org/apache/fop/fo/expr/CeilingFunction.java
  6. 4
    3
      src/java/org/apache/fop/fo/expr/FloorFunction.java
  7. 18
    18
      src/java/org/apache/fop/fo/expr/FromParentFunction.java
  8. 18
    21
      src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
  9. 29
    12
      src/java/org/apache/fop/fo/expr/Function.java
  10. 26
    6
      src/java/org/apache/fop/fo/expr/FunctionBase.java
  11. 11
    12
      src/java/org/apache/fop/fo/expr/ICCColorFunction.java
  12. 18
    19
      src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
  13. 4
    14
      src/java/org/apache/fop/fo/expr/LabelEndFunction.java
  14. 4
    13
      src/java/org/apache/fop/fo/expr/MaxFunction.java
  15. 4
    13
      src/java/org/apache/fop/fo/expr/MinFunction.java
  16. 3
    7
      src/java/org/apache/fop/fo/expr/NamedColorFunction.java
  17. 18
    19
      src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java
  18. 7
    20
      src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
  19. 4
    7
      src/java/org/apache/fop/fo/expr/PropertyParser.java
  20. 1
    1
      src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
  21. 4
    8
      src/java/org/apache/fop/fo/expr/RGBColorFunction.java
  22. 5
    3
      src/java/org/apache/fop/fo/expr/RoundFunction.java
  23. 2
    3
      src/java/org/apache/fop/fo/expr/SystemColorFunction.java

+ 4
- 13
src/java/org/apache/fop/fo/expr/AbsFunction.java View File

@@ -27,22 +27,13 @@ import org.apache.fop.fo.properties.Property;
*/
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");

+ 5
- 14
src/java/org/apache/fop/fo/expr/BodyStartFunction.java View File

@@ -31,22 +31,13 @@ import org.apache.fop.fo.properties.Property;
*/
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();

+ 7
- 11
src/java/org/apache/fop/fo/expr/CIELabColorFunction.java View File

@@ -30,29 +30,25 @@ import org.apache.fop.fo.properties.Property;
*/
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%]");
}

+ 3
- 7
src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java View File

@@ -27,17 +27,13 @@ import org.apache.fop.fo.properties.Property;
*/
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)

+ 4
- 3
src/java/org/apache/fop/fo/expr/CeilingFunction.java View File

@@ -24,12 +24,13 @@ import org.apache.fop.fo.properties.Property;

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");

+ 4
- 3
src/java/org/apache/fop/fo/expr/FloorFunction.java View File

@@ -25,12 +25,13 @@ import org.apache.fop.fo.properties.Property;

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");

+ 18
- 18
src/java/org/apache/fop/fo/expr/FromParentFunction.java View File

@@ -29,29 +29,29 @@ import org.apache.fop.fo.properties.Property;
*/
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");

+ 18
- 21
src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java View File

@@ -37,32 +37,29 @@ import org.apache.fop.fo.properties.Property;
*/
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();


+ 29
- 12
src/java/org/apache/fop/fo/expr/Function.java View File

@@ -28,11 +28,34 @@ import org.apache.fop.fo.properties.Property;
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();
}

+ 26
- 6
src/java/org/apache/fop/fo/expr/FunctionBase.java View File

@@ -26,17 +26,37 @@ import org.apache.fop.datatypes.PercentBase;
*/
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() );
}
}

+ 11
- 12
src/java/org/apache/fop/fo/expr/ICCColorFunction.java View File

@@ -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 FunctionBase {
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%]");
}

+ 18
- 19
src/java/org/apache/fop/fo/expr/InheritedPropFunction.java View File

@@ -28,30 +28,29 @@ import org.apache.fop.fo.properties.Property;
*/
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");

+ 4
- 14
src/java/org/apache/fop/fo/expr/LabelEndFunction.java View File

@@ -34,23 +34,13 @@ import org.apache.fop.fo.properties.Property;
*/
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();

+ 4
- 13
src/java/org/apache/fop/fo/expr/MaxFunction.java View File

@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Property;
*/
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) {

+ 4
- 13
src/java/org/apache/fop/fo/expr/MinFunction.java View File

@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Property;
*/
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) {

+ 3
- 7
src/java/org/apache/fop/fo/expr/NamedColorFunction.java View File

@@ -31,11 +31,8 @@ import org.apache.fop.fo.properties.Property;
*/
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 FunctionBase {
}

/** {@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();

+ 18
- 19
src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java View File

@@ -28,30 +28,29 @@ import org.apache.fop.fo.properties.Property;
*/
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(

+ 7
- 20
src/java/org/apache/fop/fo/expr/PPColWidthFunction.java View File

@@ -32,32 +32,19 @@ import org.apache.fop.fo.properties.TableColLength;
*/
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 "

+ 4
- 7
src/java/org/apache/fop/fo/expr/PropertyParser.java View File

@@ -59,13 +59,11 @@ public final class PropertyParser extends PropertyTokenizer {
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 extends PropertyTokenizer {
next();
} else {
while (true) {

prop = parseAdditiveExpr();
if (i < nbArgs) {
args[i++] = prop;

+ 1
- 1
src/java/org/apache/fop/fo/expr/PropertyTokenizer.java View File

@@ -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

+ 4
- 8
src/java/org/apache/fop/fo/expr/RGBColorFunction.java View File

@@ -30,22 +30,18 @@ import org.apache.fop.fo.properties.Property;
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] + ")");

+ 5
- 3
src/java/org/apache/fop/fo/expr/RoundFunction.java View File

@@ -24,12 +24,14 @@ import org.apache.fop.fo.properties.NumberProperty;
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");

+ 2
- 3
src/java/org/apache/fop/fo/expr/SystemColorFunction.java View File

@@ -29,13 +29,12 @@ import org.apache.fop.fo.properties.Property;
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());

Loading…
Cancel
Save