net.sf.vex.css
Class RelativeLength

java.lang.Object
  |
  +--net.sf.vex.css.RelativeLength

public class RelativeLength
extends java.lang.Object

A length that may be expressed as an absolute or relative value.


Method Summary
static RelativeLength createAbsolute(int value)
          Create a relative length representing an absolute value.
static RelativeLength createRelative(float percentage)
          Create a relative length representing a relative value.
 int get(int referenceLength)
          Return the value of the length given a reference value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createAbsolute

public static RelativeLength createAbsolute(int value)
Create a relative length representing an absolute value.

Returns:
the new RelativeLength value.

createRelative

public static RelativeLength createRelative(float percentage)
Create a relative length representing a relative value.

Returns:
the new RelativeLength value.

get

public int get(int referenceLength)
Return the value of the length given a reference value. If this object represents an absolute value, that value is simply returned. Otherwise, returns the given reference length multiplied by the given percentage and rounded to the nearest integer.

Parameters:
referenceLength - reference length by which percentage lengths will by multiplied.
Returns:
the actual value