org.extex.util
Class Unit

java.lang.Object
  extended by org.extex.util.Unit

public final class Unit
extends java.lang.Object

This class implements a converter e.g for dimen values.

Version:
$Revision: 5837 $
Author:
Michael Niedermair

Method Summary
static Dimen createDimenFromCM(double cm)
          Create a new Dimen from a CM-value
static float getDimenAsBP(FixedDimen value)
          Returns the Dimen-value as BP (big point)
static double getDimenAsCM(FixedDimen value)
          Returns the Dimen-value as CM (centimeter)
static double getDimenAsIN(FixedDimen value)
          Returns the Dimen-value as IN (inch)
static double getDimenAsMM(FixedDimen value)
          Returns the Dimen-value as MM (milimeter)
static double getDimenAsPT(FixedDimen value)
          Return the Dimen-value as PT (point)
static java.lang.String getDimenAsPTString(FixedDimen value)
          Return the Dimen-value (round) as PT (point) as String.
static java.lang.String getDimenAsPTString(FixedDimen value, int round)
          Return the Dimen-value (round) as PT (point) as String.
static double round(double value, int round)
          Round the double-value to a number of decimals.
static void setDimenFromCM(Dimen d, float bp)
          Set the Dimen-value from a BP-value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDimenAsBP

public static float getDimenAsBP(FixedDimen value)
Returns the Dimen-value as BP (big point)

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value as BP

getDimenAsPT

public static double getDimenAsPT(FixedDimen value)
Return the Dimen-value as PT (point)

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value as PT

getDimenAsPTString

public static java.lang.String getDimenAsPTString(FixedDimen value)
Return the Dimen-value (round) as PT (point) as String.

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value (round) as PT as String

getDimenAsPTString

public static java.lang.String getDimenAsPTString(FixedDimen value,
                                                  int round)
Return the Dimen-value (round) as PT (point) as String.

Parameters:
value - the Dimen
round - the round position
Returns:
Returns the Dimen-value (round) as PT as String

getDimenAsMM

public static double getDimenAsMM(FixedDimen value)
Returns the Dimen-value as MM (milimeter)

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value as MM

getDimenAsCM

public static double getDimenAsCM(FixedDimen value)
Returns the Dimen-value as CM (centimeter)

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value as CM

getDimenAsIN

public static double getDimenAsIN(FixedDimen value)
Returns the Dimen-value as IN (inch)

Parameters:
value - the Dimen
Returns:
Returns the Dimen-value as IN

createDimenFromCM

public static Dimen createDimenFromCM(double cm)
Create a new Dimen from a CM-value

Parameters:
cm - the cm-value
Returns:
Returns the new Dimne from cm-value.

setDimenFromCM

public static void setDimenFromCM(Dimen d,
                                  float bp)
Set the Dimen-value from a BP-value

Parameters:
d - the dimen
bp - the bp-value

round

public static double round(double value,
                           int round)
Round the double-value to a number of decimals.

Parameters:
value - the double-value
round - the number of decimals to round (not round: negative value)
Returns:
Returns the rounded double-value