Subversion Repository Public Repository

litesoft

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
package org.litesoft.core.simpletypes.temporal;

import org.litesoft.core.simpletypes.temporal.nonpublic.*;

/**
 * A Time resolution from the Hour thru the Millisecond.
 */
public final class TimeRes extends AbstractRes
{
    // 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 );

    /**
     * @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 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

Diff revisions: vs.
Revision Author Commited Message
2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000