Oxygen XML Editor 11.2 Author API

ro.sync.ecss.css
Class RelativeLength

java.lang.Object
  extended by ro.sync.ecss.css.RelativeLength

public class RelativeLength
extends Object

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


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

Method Detail

createAbsolute

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

Parameters:
value - The value of the absolute length.
Returns:
The new absolute value RelativeLength.

createRelative

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

Parameters:
percentage - The percentage from the value this length will refer to. (e.g: 50%)
Returns:
The new relative value RelativeLength.

get

public int get(int referenceLength)
Return the evaluated value of the RelativeLength 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 divided to 100 and rounded to the nearest integer.

Parameters:
referenceLength - Reference length for percentage lengths.
Returns:
The actual value.

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.