/**
Khalid
*/
package org.sikuli.slides.utils;
/**
 * This class converts between various units that OpenXML uses.
 * @author Khalid
 *
 */

public class UnitConverter {
	
	/**
	 * Converts from English Metric Units (EMUs) to pixels
	 * @param emu  Size in English Metric Unit (EMU)
	 * @return Size in pixels
	 * 
	 */
    public static int emuToPixels(int emu)
    {
        if (emu != 0)
        {
        	// assuming the shape is not a child, so we divide by 9525.
            return (int)Math.round((double)emu / 9525);
        }
        else
        {
            return 0;
        }
    }
    /**
     * converts from whole points to points. In drawing ML, Whole points are specified in increments of 100.
     * Use this to convert font size from whole points to regular points.
     * @param wholePoint
     * @return
     */
    public static double WholePointsToPoints(int wholePoint){
    	return wholePoint/100;
    }
}

@@ -40,16 +40,56 @@
 .utils;%0A
+%0Aimport java.util.concurrent.TimeUnit;%0A%0A
 /**%0A * T
@@ -965,10 +965,822 @@
 ;%0A    %7D%0A
+%09/**%0A%09 * Extracts and returns the time unit from a string. If the string%0A%09 * doesn't include a unit, it returns null.%0A%09 * @param timeString the string that contains a time unit%0A%09 * @return the extracted time unit. If the string%0A%09 * doesn't include a unit, it returns null.%0A%09 */%0A%09public static TimeUnit extractTimeUnitFromString(String timeString)%7B%0A%09%09%0A%09%09timeString=timeString.toLowerCase();%0A%09%09%0A%09%09if(timeString.contains(%22minute%22))%7B%0A%09%09%09return TimeUnit.MINUTES;%0A%09%09%7D%0A%09%09else if(timeString.contains(%22microsecond%22))%7B%0A%09%09%09return TimeUnit.MICROSECONDS;%0A%09%09%7D%0A%09%09else if(timeString.contains(%22millisecond%22))%7B%0A%09%09%09return TimeUnit.MILLISECONDS;%0A%09%09%7D%0A%09%09else if(timeString.contains(%22second%22))%7B%0A%09%09%09return TimeUnit.SECONDS;%0A%09%09%7D%0A%09%09else if(timeString.toLowerCase().contains(%22day%22))%7B%0A%09%09%09return TimeUnit.DAYS;%0A%09%09%7D%0A%09%09else%0A%09%09%09return null;%0A%09%7D%0A
 %7D%0A

add extract time unit from a string method