Subversion Repository Public Repository

litesoft

Diff Revisions 809 vs 851 for /trunk/Java/core/Anywhere/src/org/litesoft/core/util/ExpirationLine.java

Diff revisions: vs.
  @@ -3,14 +3,16 @@
3 3
4 4 import org.litesoft.core.simpletypes.nonpublic.*;
5 5 import org.litesoft.core.simpletypes.temporal.*;
6 - import org.litesoft.core.simpletypes.temporal.nonpublic.*;
7 6 import org.litesoft.core.typeutils.*;
7 + import org.litesoft.core.typeutils.gregorian.*;
8 8 import org.litesoft.logger.*;
9 9
10 10 public final class ExpirationLine extends CompareSupport<ExpirationLine>
11 11 {
12 12 private static final Logger LOGGER = LoggerFactory.getLogger( ExpirationLine.class );
13 13
14 + private static DateFormat EXPIRATION_FORMAT = new DateFormat( "MM/yyyy" );
15 +
14 16 private int mQuantity, mMonth, mYear;
15 17
16 18 public ExpirationLine( int pQuantity, int pMonth, int pYear )
  @@ -23,8 +25,7 @@
23 25 public ExpirationLine( int pQuantity, int pDeltaMonths )
24 26 {
25 27 mQuantity = pQuantity;
26 - SimpleDate zDate = today();
27 - zDate.addMonths( pDeltaMonths );
28 + SimpleDate zDate = today().addMonths( pDeltaMonths );
28 29 mMonth = zDate.getMonth();
29 30 mYear = zDate.getYear();
30 31 }
  @@ -69,12 +70,12 @@
69 70
70 71 public SimpleDate getExpiration()
71 72 {
72 - return new SimpleDate( "MM/yyyy", mYear, mMonth );
73 + return new SimpleDate( EXPIRATION_FORMAT, mYear, mMonth );
73 74 }
74 75
75 76 public SimpleDate getExpirationDate()
76 77 {
77 - return new SimpleDate( SimpleDate.DEFAULT_DATE_FORMAT, mYear, mMonth, CalendarSupport.daysInMonth( mYear, mMonth ) );
78 + return new SimpleDate( DateFormat.DEFAULT_YMD, mYear, mMonth, Month.daysIn( mYear, mMonth ) );
78 79 }
79 80
80 81 public int getQuantity()
  @@ -94,7 +95,7 @@
94 95
95 96 private SimpleDate today()
96 97 {
97 - return new SimpleDate( SimpleDate.DEFAULT_DATE_FORMAT, new UtilDateAdaptor() );
98 + return new SimpleDate( DateFormat.DEFAULT_YMD, new UtilDateAdaptor() );
98 99 }
99 100
100 101 public int compareTo( ExpirationLine them )