net.sf.doolin.util.unit
Enum Unit

java.lang.Object
  extended by java.lang.Enum<Unit>
      extended by net.sf.doolin.util.unit.Unit
All Implemented Interfaces:
Serializable, Comparable<Unit>

public enum Unit
extends Enum<Unit>

Different types of units.

Author:
Damien Coraboeuf

Enum Constant Summary
CM
          Centimeter
INCH
          Inch
PERCENT
          Percentage
PIXEL
          Pixel
 
Method Summary
abstract  double getPixels(Number reference)
          Calculates the number of corresponding pixels for this unit, according to a reference.
 String getSymbol()
           
static Unit valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Unit[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PERCENT

public static final Unit PERCENT
Percentage


PIXEL

public static final Unit PIXEL
Pixel


CM

public static final Unit CM
Centimeter


INCH

public static final Unit INCH
Inch

Method Detail

values

public static Unit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Unit c : Unit.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Unit valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getPixels

public abstract double getPixels(Number reference)
Calculates the number of corresponding pixels for this unit, according to a reference. This reference is used only for percentage unit.

Parameters:
reference - Reference value
Returns:
Number of pixels

getSymbol

public String getSymbol()
Returns:
Associated symbol


Copyright © 2011. All Rights Reserved.