You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MinFunction.java 819B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo.expr;
  8. import org.apache.fop.fo.Property;
  9. public class MinFunction extends FunctionBase {
  10. public int nbArgs() {
  11. return 2;
  12. }
  13. // Handle "numerics" if no proportional/percent parts!
  14. public Property eval(Property[] args,
  15. PropertyInfo pInfo) throws PropertyException {
  16. Numeric n1 = args[0].getNumeric();
  17. Numeric n2 = args[1].getNumeric();
  18. if (n1 == null || n2 == null) {
  19. throw new PropertyException("Non numeric operands to min function");
  20. }
  21. return new NumericProperty(n1.min(n2));
  22. }
  23. }