Subversion Repository Public Repository

litesoft

Diff Revisions 897 vs 898 for /trunk/Java/core/Anywhere/src/org/litesoft/core/simpletypes/temporal/AbstractCalendarYM.java

Diff revisions: vs.
  @@ -7,27 +7,13 @@
7 7 {
8 8 private static final long serialVersionUID = 1L;
9 9
10 - private /* final */ int mMonth;
11 -
12 - protected AbstractCalendarYM( int pYear, int pMonth )
13 - {
14 - super( pYear );
15 - mMonth = validateMonth( getYear(), pMonth );
16 - }
17 -
18 - @Override
19 - public final int getMonth()
20 - {
21 - return mMonth;
22 - }
23 -
24 10 /**
25 11 * Return a T with the Month set to the parameter, if there are insufficient days in the new month, the date will be set to the last day of the target month.
26 12 */
27 13 public final T month( int pMonth )
28 14 {
29 15 validateMonth( getYear(), pMonth );
30 - return (mMonth == pMonth) ? us() : LLsetMonth( pMonth );
16 + return (getMonth() == pMonth) ? us() : LLsetMonth( pMonth );
31 17 }
32 18
33 19 /**
  @@ -35,7 +21,7 @@
35 21 */
36 22 public final T addMonths( int pMonths )
37 23 {
38 - return (pMonths == 0) ? us() : LLsetMonth( mMonth + pMonths );
24 + return (pMonths == 0) ? us() : LLsetMonth( getMonth() + pMonths );
39 25 }
40 26
41 27 /**
  @@ -43,12 +29,12 @@
43 29 */
44 30 public final T minusMonths( int pMonths )
45 31 {
46 - return (pMonths == 0) ? us() : LLsetMonth( mMonth - pMonths );
32 + return (pMonths == 0) ? us() : LLsetMonth( getMonth() - pMonths );
47 33 }
48 34
49 35 // vvvvvvvvvvvvvvvvvv Support methods vvvvvvvvvvvvvvvvv
50 36
51 - protected static final int parseMonth(String pStringForm, String... pParts)
37 + protected static final int parseMonth( String pStringForm, String... pParts )
52 38 {
53 39 return parseInt( pParts[1], "Month", pStringForm );
54 40 }
  @@ -83,7 +69,7 @@
83 69
84 70 protected int LL_hashCode()
85 71 {
86 - return hashCodeEm( super.hashCode(), mMonth );
72 + return hashCodeEm( super.hashCode(), getMonth() );
87 73 }
88 74
89 75 /**
  @@ -115,9 +101,12 @@
115 101 return createTypeFrom( zMutable );
116 102 }
117 103
118 - protected abstract M createMutable( int pYear, int pNewMonth );
104 + protected final M createMutable( int pNewYear )
105 + {
106 + return createMutable( pNewYear, getMonth() );
107 + }
119 108
120 - protected abstract M createMutable( int pNewYear );
109 + protected abstract M createMutable( int pYear, int pNewMonth );
121 110
122 111 protected abstract T createTypeFrom( M pMutable );
123 112