litesoft
Diff Revisions
911
vs
912
for /trunk/Java/core/Anywhere/src/org/litesoft/core/simpletypes/temporal/AbstractCalendarYM.java
|
@@ -7,13 +7,27 @@ |
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 |
+ |
|
10 |
24 |
|
/** |
11 |
25 |
|
* 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. |
12 |
26 |
|
*/ |
13 |
27 |
|
public final T month( int pMonth ) |
14 |
28 |
|
{ |
15 |
29 |
|
validateMonth( getYear(), pMonth ); |
16 |
|
- |
return (getMonth() == pMonth) ? us() : LLsetMonth( pMonth ); |
|
30 |
+ |
return (mMonth == pMonth) ? us() : LLsetMonth( pMonth ); |
17 |
31 |
|
} |
18 |
32 |
|
|
19 |
33 |
|
/** |
|
@@ -21,7 +35,7 @@ |
21 |
35 |
|
*/ |
22 |
36 |
|
public final T addMonths( int pMonths ) |
23 |
37 |
|
{ |
24 |
|
- |
return (pMonths == 0) ? us() : LLsetMonth( getMonth() + pMonths ); |
|
38 |
+ |
return (pMonths == 0) ? us() : LLsetMonth( mMonth + pMonths ); |
25 |
39 |
|
} |
26 |
40 |
|
|
27 |
41 |
|
/** |
|
@@ -29,12 +43,12 @@ |
29 |
43 |
|
*/ |
30 |
44 |
|
public final T minusMonths( int pMonths ) |
31 |
45 |
|
{ |
32 |
|
- |
return (pMonths == 0) ? us() : LLsetMonth( getMonth() - pMonths ); |
|
46 |
+ |
return (pMonths == 0) ? us() : LLsetMonth( mMonth - pMonths ); |
33 |
47 |
|
} |
34 |
48 |
|
|
35 |
49 |
|
// vvvvvvvvvvvvvvvvvv Support methods vvvvvvvvvvvvvvvvv |
36 |
50 |
|
|
37 |
|
- |
protected static final int parseMonth( String pStringForm, String... pParts ) |
|
51 |
+ |
protected static final int parseMonth(String pStringForm, String... pParts) |
38 |
52 |
|
{ |
39 |
53 |
|
return parseInt( pParts[1], "Month", pStringForm ); |
40 |
54 |
|
} |
|
@@ -69,7 +83,7 @@ |
69 |
83 |
|
|
70 |
84 |
|
protected int LL_hashCode() |
71 |
85 |
|
{ |
72 |
|
- |
return hashCodeEm( super.hashCode(), getMonth() ); |
|
86 |
+ |
return hashCodeEm( super.hashCode(), mMonth ); |
73 |
87 |
|
} |
74 |
88 |
|
|
75 |
89 |
|
/** |
|
@@ -101,13 +115,10 @@ |
101 |
115 |
|
return createTypeFrom( zMutable ); |
102 |
116 |
|
} |
103 |
117 |
|
|
104 |
|
- |
protected final M createMutable( int pNewYear ) |
105 |
|
- |
{ |
106 |
|
- |
return createMutable( pNewYear, getMonth() ); |
107 |
|
- |
} |
108 |
|
- |
|
109 |
118 |
|
protected abstract M createMutable( int pYear, int pNewMonth ); |
110 |
119 |
|
|
|
120 |
+ |
protected abstract M createMutable( int pNewYear ); |
|
121 |
+ |
|
111 |
122 |
|
protected abstract T createTypeFrom( M pMutable ); |
112 |
123 |
|
|
113 |
124 |
|
protected static class Mutable extends AbstractCalendarY.Mutable implements CalendarAccessorYM |