Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.render.txt
Class Helper

    java.lang.Object
      org.apache.fop.render.txt.Helper

    public final class Helper

extends java.lang.Object

This class has a few convenient static methods for number quantization.

Method Summary
`static int` | `ceil(int x, int quantum)` Returns minimal possible integer, greater or equal than `x`, divisible by `quantum`.
`static int` | `ceilPosition(int x, int y)` Returns the smallest integer that is greater than or equal to the `x/y` fraction.
`static int` | `floor(int x, int quantum)` Returns maximum possible integer, less or equal than `oldValue`, divisible by `quantum`.
`static int` | `floorPosition(int x, int y)` Returns the largest integer that is less than or equal to the argument and is equal to `x/y` fraction.
`static int` | `round(int x, int quantum)` Returns nearest integer to `x`, divisible by `quantum`.
`static int` | `roundPosition(int x, int y)` Returns the closest integer to `x/y` fraction.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### round

    public static int round(int x,
                            int quantum)

  Returns nearest integer to `x`, divisible by `quantum`.

  Parameters:
    `x` - integer for quantization
    `quantum` - integer, representing quantization
  Returns:
    computed nearest integer

### ceil

    public static int ceil(int x,
                           int quantum)

  Returns minimal possible integer, greater or equal than `x`, divisible by `quantum`.

  Parameters:
    `x` - integer for quantization
    `quantum` - integer, representing quantization
  Returns:
    computed nearest integer

### floor

    public static int floor(int x,
                            int quantum)

  Returns maximum possible integer, less or equal than `oldValue`, divisible by `quantum`.

  Parameters:
    `x` - integer for quantization
    `quantum` - integer, representing quantization
  Returns:
    computed nearest integer

### roundPosition

    public static int roundPosition(int x,
                                    int y)

  Returns the closest integer to `x/y` fraction. It's possible to consider this methos as a analog of Math.round(x/y), without having deal with non-integer.

  Parameters:
    `x` - integer, fraction numerator
    `y` - integer, fraction denominator
  Returns:
    the value of the fraction rounded to the nearest
  See Also:
    `Math.round(double)`

### ceilPosition

    public static int ceilPosition(int x,
                                   int y)

  Returns the smallest integer that is greater than or equal to the `x/y` fraction. It's possible to consider this function as a analog of Math.ceil(x/y), without having deal with non-integer.

  Parameters:
    `x` - integer, fraction numerator
    `y` - integer, fraction denominator
  Returns:
    the smallest integer that is greater than or equal to `x/y` fraction
  See Also:
    `Math.ceil(double)`

### floorPosition

    public static int floorPosition(int x,
                                    int y)

  Returns the largest integer that is less than or equal to the argument and is equal to `x/y` fraction. It's possible to consider this function as a analog of Math.floor(x/y), without having deal with non-integer.

  Parameters:
    `x` - integer, fraction numerator
    `y` - integer, fraction denominator
  Returns:
    the largest integer that is less than or equal to the argument and is equal to `x/y` fraction
  See Also:
    `Math.floor(double)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.