Class SmilClock
java.lang.Object
com.adobe.epubcheck.overlay.SmilClock
A
SmilClock object is a wrapper for a SMIL clock value (time)
Versions: 0.1.0 (09/02/2003) - Implemented string parsing - Implemented both toString() methods 0.1.1 (10/02/2003) - Added static method to get/set tolerance for equals() and compareTo() methods - Modified equals() and compareTo() to take tolerance value into account 0.2.0 (10/04/2003) - Added support for npt= formats - Fixed bug in SmilClock(double) constructor - Fixed nasty bug in SmilClock(String) constructor 1.0.1 (11/01/2004) - Fixed bug in milliseconds parsing in SmilClock(String s); now handles values with more/less than 3 digits - Fixed bug in toString(int format) that caused milliseconds to lose leading zeroes 1.0.2 (11/06/2005) Markus - Added optimization: patterns compiled and static 1.0.3 (21/06/2005) Markus - Added secondsValueRounded 1.0.4 (10/02/2006) Linus - Fixed locale bug in toString: now using DecimalFormat instead of NumberFormat 1.0.5 (20/06/2006 Laurie - Added HUMAN_READABLE static int toString(int) 1.1.0 (14/11/2006) Linus - Use BigDecimal instead of double to avoid rounding errors
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate static Patternstatic final intprivate static longprivate final ClipTimestatic final intprivate static Patternstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate static Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintbooleanbooleaneqWithinTolerance(SmilClock other, long msecTolerance) private ClipTimeReturns clock value in millisecondsstatic longReturns tolerance settinglongDeprecated.longbooleannotSet()doubleReturns clock value in secondslongDeprecated.doubleReturns clock value in seconds, rounded to full secondsstatic voidsetTolerance(long msec) Sets tolerance for comparisons and equality testing.subtractTime(SmilClock subtractTime) toString()Returns clock value in full clock value format (default)toString(int format) Returns clock value in specified format
-
Field Details
-
fullClockPattern
-
partialClockPattern
-
timecountClockPattern
-
FULL
public static final int FULL- See Also:
-
PARTIAL
public static final int PARTIAL- See Also:
-
TIMECOUNT
public static final int TIMECOUNT- See Also:
-
TIMECOUNT_MSEC
public static final int TIMECOUNT_MSEC- See Also:
-
TIMECOUNT_SEC
public static final int TIMECOUNT_SEC- See Also:
-
TIMECOUNT_MIN
public static final int TIMECOUNT_MIN- See Also:
-
TIMECOUNT_HR
public static final int TIMECOUNT_HR- See Also:
-
HUMAN_READABLE
public static final int HUMAN_READABLE- See Also:
-
RAW_TIMECOUNT_TRUNCATED_MSC
public static final int RAW_TIMECOUNT_TRUNCATED_MSC- See Also:
-
msecValue
-
msecTolerance
private static long msecTolerance
-
-
Constructor Details
-
SmilClock
- Parameters:
s- A string representation of the SMIL clock value in any accepted format- Throws:
NumberFormatException- if the string is not a legal SMIL clock value format
-
SmilClock
public SmilClock() -
SmilClock
- Parameters:
msec- Time value in milliseconds
-
SmilClock
public SmilClock(double sec) - Parameters:
sec- Time value in seconds
-
SmilClock
Deprecated.Just for compability, broken by design really The SmilClock should only be initialized by values of "seconds", another basic type, implying another unit type, milliseconds is way to dangerous!- Parameters:
msec- Time value in milliseconds
-
-
Method Details
-
addTime
-
subtractTime
-
notSet
public boolean notSet() -
toString
-
toString
Returns clock value in specified format- Parameters:
format- Format code (FULL, PARTIAL, TIMECOUNT)- Returns:
- String with value in named format
-
getTimeWOPrecisionLoss
Returns clock value in milliseconds -
millisecondsValue
Deprecated.Just for compability, broken by design really- Returns:
- clock value in milliseconds
-
millisecondsValueAsLong
public long millisecondsValueAsLong() -
secondsValueRounded
Deprecated.Just for compability, broken by design really Enhance type system even further, get rid of log/double altogheter and use some class "Seconds" instead!- Returns:
-
secondsValue
public double secondsValue()Returns clock value in seconds- Returns:
- clock value in seconds
-
secondsValueRoundedDouble
public double secondsValueRoundedDouble()Returns clock value in seconds, rounded to full seconds- Returns:
- clock value in seconds, rounded to full seconds
-
roundToMSPrecision
-
floorToMSPrecision
-
equals
-
eqWithinTolerance
-
compareTo
- Throws:
ClassCastException
-
compareTo
- Throws:
ClassCastException
-
setTolerance
public static void setTolerance(long msec) Sets tolerance for comparisons and equality testing.When comparing two values, if they differ by less than the given tolerance, they will be evaluated as equal to one another.
- Parameters:
msec- Tolerance value in milliseconds
-
getTolerance
public static long getTolerance()Returns tolerance setting- Returns:
- Current tolerance value in milliseconds
-