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.
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.
|
ceil
public static int ceil(int x,
int quantum)
Returns minimal possible integer, greater or equal than
x
, divisible by quantum
.
x
- integer for quantizationquantum
- integer, representing quantization
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.
x
- integer, fraction numeratory
- integer, fraction denominator
- the smallest integer that is greater than or equal to
x/y
fraction
java.lang.Math.ceil(double)
floor
public static int floor(int x,
int quantum)
Returns maximum possible integer, less or equal than
oldValue
, divisible by quantum
.
x
- integer for quantizationquantum
- integer, representing quantization
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.
x
- integer, fraction numeratory
- integer, fraction denominator
- the largest integer that is less than or equal to
the argument and is equal to
x/y
fraction
java.lang.Math.ceil(double)
round
public static int round(int x,
int quantum)
Returns nearest integer to x
, divisible by
quantum
.
x
- integer for quantizationquantum
- integer, representing quantization
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.
x
- integer, fraction numeratory
- integer, fraction denominator
- the value of the fraction rounded to the nearest
java.lang.Math.round(double)
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.