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.

FloorFunction.java 758B

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. import org.apache.fop.fo.NumberProperty;
  10. class FloorFunction extends FunctionBase {
  11. public int nbArgs() {
  12. return 1;
  13. }
  14. public Property eval(Property[] args,
  15. PropertyInfo pInfo) throws PropertyException {
  16. Number dbl = args[0].getNumber();
  17. if (dbl == null) {
  18. throw new PropertyException("Non number operand to floor function");
  19. }
  20. return new NumberProperty(Math.floor(dbl.doubleValue()));
  21. }
  22. }