litesoft
@ 947
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
// This Source Code is in the Public Domain per: http://unlicense.org package org.litesoft.core.simpletypes.temporal; import org.litesoft.commonfoundation.typeutils.gregorian.*; import org.litesoft.core.simpletypes.temporal.nonpublic.*; /** * A Time resolution from the Hour thru the Millisecond. */ public final class TimeRes extends AbstractRes { private static final long serialVersionUID = 1L; // Formatting Indicators public static final char INDICATOR_HOUR = 'H'; public static final char INDICATOR_MIN = 'm'; public static final char INDICATOR_SEC = 's'; public static final char INDICATOR_MSEC = 'S'; public static final int HOURindex = 0; public static final int MINindex = 1; public static final int SECindex = 2; public static final int MSECindex = 3; public static TimeRes ToHOUR = new TimeRes( "ToHOUR", "Hour", HOURindex, INDICATOR_HOUR ); public static TimeRes ToMIN = new TimeRes( "ToMIN", "Min", MINindex, INDICATOR_MIN ); public static TimeRes ToSEC = new TimeRes( "ToSEC", "Sec", SECindex, INDICATOR_SEC ); public static TimeRes ToMSEC = new TimeRes( "ToMSEC", "MilliSec", MSECindex, INDICATOR_MSEC ); @SuppressWarnings({"deprecation", "UnusedDeclaration"}) @Deprecated /** for Serialization */ protected TimeRes() { } private TimeRes( String pName, String pFriendlyName, int pIndex, char pIndicator ) { super( pName, pFriendlyName, pIndex, pIndicator ); } private static AbstractRes[] OPTIONS = new AbstractRes[]{ToHOUR, ToMIN, ToSEC, ToMSEC,}; public static TimeRes fromIndex( int pIndex ) { return (TimeRes) LLfromIndex( OPTIONS, pIndex ); } public static TimeRes from( TemporalResolution pTemporalResolution ) { return fromIndex( pTemporalResolution.ordinal() - TemporalResolution.ToHour.ordinal() ); } public static TimeRes rehydrate( String pDesiccated ) throws IllegalArgumentException { return (TimeRes) LLrehydrate( "TimeRes", OPTIONS, pDesiccated ); } public boolean isValidToMin() { return MINindex <= getIndex(); } public boolean isValidToSec() { return SECindex <= getIndex(); } public boolean isValidToMilliSec() { return MSECindex <= getIndex(); } } |
Commits for litesoft/trunk/Java/core/Anywhere/src/org/litesoft/core/simpletypes/temporal/TimeRes.java
Revision | Author | Commited | Message |
---|---|---|---|
947 Diff | GeorgeS | Fri 06 Jun, 2014 23:36:56 +0000 | Correct Spelling of package! |
942 Diff | GeorgeS | Mon 02 Jun, 2014 23:41:46 +0000 | Extracting commonfoundation |
849 Diff | GeorgeS | Tue 11 Sep, 2012 17:11:59 +0000 | Clean up serialization |
49 Diff | GeorgeS | Mon 12 Apr, 2010 02:59:10 +0000 | License Text |
2 | GeorgeS | Sun 07 Feb, 2010 12:50:58 +0000 |