001    /*
002     * Copyleft notice: This is public-domain software and documentation
003     * with no restrictions of any kind.
004     * Please feel free to use any of it in any way you want.
005     * This work is distributed in the hope that it will be useful,
006     * but WITHOUT ANY WARRANTY; without even the implied warranty of
007     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
008     */
009    
010    package time;
011    
012    import java.util.*;
013    import java.io.*;
014    
015    /**
016     * The 12 months of the year.
017     *
018     * <p>
019     * Although it is specific to a GregorianChronology, this enum is provided to
020     * promote its usage for other chronologies that may need it (exemple: Julian
021     * Chronology).
022     *
023     *
024     * @author Arnaud Roques
025     */
026    public enum Month
027    {
028            JANUARY(GregorianCalendar.JANUARY),
029            FEBRUARY(GregorianCalendar.FEBRUARY),
030            MARCH(GregorianCalendar.MARCH),
031            APRIL(GregorianCalendar.APRIL),
032            MAY(GregorianCalendar.MAY),
033            JUNE(GregorianCalendar.JUNE),
034            JULY(GregorianCalendar.JULY),
035            AUGUST(GregorianCalendar.AUGUST),
036            SEPTEMBER(GregorianCalendar.SEPTEMBER),
037            OCTOBER(GregorianCalendar.OCTOBER),
038            NOVEMBER(GregorianCalendar.NOVEMBER),
039            DECEMBER(GregorianCalendar.DECEMBER);
040    
041            private final int v;    
042    
043            private Month(int v)
044            {
045                    this.v = v;
046            }
047            
048            public int getValue()
049            {
050                    return v;
051            }
052            
053            public static Month fromValue(int i)
054            {
055                    Month r = Month.values()[i];
056                    assert(r.getValue()==i);
057                    return r;
058            }
059    }
060