You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(49) |
Sep
(134) |
Oct
(33) |
Nov
(18) |
Dec
(51) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(50) |
Feb
(32) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(9) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(1) |
Feb
(4) |
Mar
(8) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
(54) |
Apr
(21) |
May
(13) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <be...@us...> - 2006-09-09 15:02:05
|
Revision: 134
http://svn.sourceforge.net/objectlabkit/?rev=134&view=rev
Author: benoitx
Date: 2006-09-09 08:01:14 -0700 (Sat, 09 Sep 2006)
Log Message:
-----------
Improve coverage by removing code never called (null detection done somewhere else).
Modified Paths:
--------------
trunk/common-build/project.xml
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
trunk/project.properties
trunk/src/site/navigation.xml
Added Paths:
-----------
trunk/src/site/tenor.xml
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/common-build/project.xml 2006-09-09 15:01:14 UTC (rev 134)
@@ -26,6 +26,7 @@
/var/www/solutions/website/objectlab.co.uk/
</siteDirectory>
<repository>
+ <url>https://svn.sourceforge.net/svnroot/objectlabkit</url>
<connection>
scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk
</connection>
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2006-09-09 15:01:14 UTC (rev 134)
@@ -36,7 +36,7 @@
* @author $LastModifiedBy$
* @version $Revision: 128 $ $Date: 2006-09-08 15:14:46 +0200 (Fri, 08 Sep 2006) $
*/
-public class CalendarDateCalculator extends AbstractDateCalculator<Calendar> {
+public class CalendarDateCalculator extends AbstractDateCalculator<Calendar> {
private WorkingWeek workingWeek = WorkingWeek.DEFAULT;
@@ -68,42 +68,21 @@
}
public CalendarDateCalculator moveByDays(final int days) {
- if (getCurrentBusinessDate() == null) {
- initialise();
- }
getCurrentBusinessDate().add(Calendar.DAY_OF_MONTH, days);
-
+
if (getHolidayHandler() != null) {
setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this));
}
-
+
return this;
}
- private void initialise() {
- if (getStartDate() == null) {
- setStartDate(Calendar.getInstance());
- } else if (getCurrentBusinessDate() == null) {
- setCurrentBusinessDate(Calendar.getInstance());
- }
- }
-
@Override
- protected DateCalculator<Calendar> createNewCalculator(final String name, final Calendar startDate, final Set<Calendar> holidays,
- final HolidayHandler<Calendar> handler) {
+ protected DateCalculator<Calendar> createNewCalculator(final String name, final Calendar startDate,
+ final Set<Calendar> holidays, final HolidayHandler<Calendar> handler) {
return new CalendarDateCalculator(name, startDate, holidays, handler);
}
-/*
- * @Override public JdkCalendarBaseDateCalculator combine(final DateCalculator<Calendar>
- * calendar) { return (JdkCalendarBaseDateCalculator) super.combine(calendar); }
- *
- * @Override public JdkCalendarBaseDateCalculator moveByTenor(final Tenor tenor) {
- * return (JdkCalendarBaseDateCalculator) super.moveByTenor(tenor); }
- *
- * @Override public JdkCalendarBaseDateCalculator moveByBusinessDays(final int
- * businessDays) { return (JdkCalendarBaseDateCalculator)
- * super.moveByBusinessDays(businessDays); }
- */
+
@Override
protected Calendar getToday() {
return Utils.blastTime(Calendar.getInstance());
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java 2006-09-09 15:01:14 UTC (rev 134)
@@ -40,10 +40,6 @@
protected Date move(final DateCalculator<Date> calculator, final int step) {
final Calendar cal = Utils.getCal(calculator.getCurrentBusinessDate());
- if (cal == null) {
- return null;
- }
-
while (calculator.isNonWorkingDay(cal.getTime())) {
cal.add(Calendar.DAY_OF_MONTH, step);
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java 2006-09-09 15:01:14 UTC (rev 134)
@@ -35,8 +35,7 @@
*/
public final class JodaExcelDateUtil {
- private JodaExcelDateUtil() {
- }
+ private JodaExcelDateUtil() {}
public static LocalDate getLocalDate(final double date, final boolean use1904windowing) {
final Date javaDate = ExcelDateUtil.getJavaDate(date, use1904windowing);
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-09 15:01:14 UTC (rev 134)
@@ -47,7 +47,10 @@
setStartDate(startDate);
}
- // TODO throw an exception if the WorkinWeek type is wrong
+ /**
+ * @todo throw an exception if the WorkinWeek type is wrong
+ *
+ */
public void setWorkingWeek(final WorkingWeek week) {
if (week instanceof JodaWorkingWeek) {
workingWeek = (JodaWorkingWeek) week;
@@ -63,9 +66,6 @@
}
public DateCalculator<LocalDate> moveByDays(final int days) {
- if (getCurrentBusinessDate() == null) {
- initialise();
- }
setCurrentBusinessDate(getCurrentBusinessDate().plusDays(days));
if (getHolidayHandler() != null) {
@@ -75,14 +75,6 @@
return this;
}
- protected void initialise() {
- if (getStartDate() == null) {
- setStartDate(new LocalDate());
- } else if (getCurrentBusinessDate() == null) {
- setCurrentBusinessDate(new LocalDate());
- }
- }
-
@Override
protected DateCalculator<LocalDate> createNewCalculator(final String name, final LocalDate startDate,
final Set<LocalDate> holidays, final HolidayHandler<LocalDate> handler) {
Modified: trunk/project.properties
===================================================================
--- trunk/project.properties 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/project.properties 2006-09-09 15:01:14 UTC (rev 134)
@@ -27,7 +27,7 @@
# goal on each project when you run it through multiproject:site.
maven.multiproject.site.goals=site, dashboard:report-single
#
-maven.dashboard.aggregators = csfiles,cserrors,junittests,junitfailures,juniterrors,junitpassrate,pmdfiles,pmdviolations,fbfiles,fbviolations,simiantdl
+maven.dashboard.aggregators = cserrors,pmdviolations,fbviolations,simiantdl,junittests,junitfailures,juniterrors,junitpassrate,coberturalipc,coberturaloc
#maven.dashboard.aggregators = csfiles,cswarnings,cserrors,junittests,junitfailures,juniterrors,junitpassrate,pmdfiles,pmdviolations,simiantdl,jcoveragelipc,jcoverageloc
maven.pmd.check.tests=false
Modified: trunk/src/site/navigation.xml
===================================================================
--- trunk/src/site/navigation.xml 2006-09-09 12:45:09 UTC (rev 133)
+++ trunk/src/site/navigation.xml 2006-09-09 15:01:14 UTC (rev 134)
@@ -16,6 +16,7 @@
<item name="DateCalc JODA"
href="multiproject/datecalc-joda/index.html" />
<item name="Holiday Handling" href="algo.html" />
+ <item name="Tenor Handling" href="tenor.html" />
<item name="JavaDoc" class="newWindow" target="_new" href="apidocs/index.html" />
</menu>
<!--
Added: trunk/src/site/tenor.xml
===================================================================
--- trunk/src/site/tenor.xml (rev 0)
+++ trunk/src/site/tenor.xml 2006-09-09 15:01:14 UTC (rev 134)
@@ -0,0 +1,19 @@
+<document>
+ <properties>
+ <author email="Ki...@ob...">Benoit Xhenseval</author>
+ <title>ObjectLab Kit - Tenor Handling</title>
+ </properties>
+ <head>
+
+ </head>
+ <body>
+ <!-- The body of the document contains a number of sections -->
+ <section name="Tenor Handling">
+
+ <subsection name="Spot">
+ </subsection>
+
+ </section>
+
+ </body>
+</document>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-09 12:45:32
|
Revision: 133
http://svn.sourceforge.net/objectlabkit/?rev=133&view=rev
Author: benoitx
Date: 2006-09-09 05:45:09 -0700 (Sat, 09 Sep 2006)
Log Message:
-----------
Improve site by enabling Changes, ChangeLog, FileActivity and DeveloperActivity reports. (require svn.exe to be in the path).
Modified Paths:
--------------
trunk/common-build/project.xml
trunk/datecalc-common/qalab.xml
trunk/datecalc-jdk/qalab.xml
trunk/datecalc-joda/qalab.xml
trunk/project.properties
trunk/project.xml
trunk/src/site/index.xml
Added Paths:
-----------
trunk/src/site/changes.xml
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/common-build/project.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -112,7 +112,7 @@
<report>maven-simian-plugin</report>
<report>maven-cobertura-plugin</report>
<report>maven-qalab-plugin</report>
- <!--<report>maven-ydoc-plugin</report>-->
+ <report>maven-ydoc-plugin</report>
<report>maven-jdepend-plugin</report>
<report>maven-faq-plugin</report>
<report>maven-junit-report-plugin</report>
Modified: trunk/datecalc-common/qalab.xml
===================================================================
--- trunk/datecalc-common/qalab.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/datecalc-common/qalab.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -57,8 +57,10 @@
<summaryresult date="2006-09-06" filecount="18" statvalue="1" type="checkstyle"/>
<summaryresult date="2006-09-06" filecount="17" statvalue="66" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="17" statvalue="68" type="cobertura-branch"/>
- <summaryresult date="2006-09-07" filecount="17" statvalue="65" type="cobertura-line"/>
- <summaryresult date="2006-09-07" filecount="17" statvalue="67" type="cobertura-branch"/>
+ <summaryresult date="2006-09-07" filecount="17" statvalue="64" type="cobertura-line"/>
+ <summaryresult date="2006-09-07" filecount="17" statvalue="64" type="cobertura-branch"/>
+ <summaryresult date="2006-09-09" filecount="17" statvalue="63" type="cobertura-line"/>
+ <summaryresult date="2006-09-09" filecount="17" statvalue="64" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_common_package.html" path="net/objectlab/kit/datecalc/common/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -103,6 +105,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_WorkingWeek.java" path="net/objectlab/kit/datecalc/common/WorkingWeek.java">
<result date="2006-08-08" statvalue="3" type="checkstyle"/>
@@ -139,6 +143,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="95" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_TenorCode.java" path="net/objectlab/kit/datecalc/common/TenorCode.java">
<result date="2006-08-08" statvalue="100" type="cobertura-line"/>
@@ -167,6 +173,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandlerType.java" path="net/objectlab/kit/datecalc/common/HolidayHandlerType.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -182,6 +190,7 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_PeriodCountBasis.java" path="net/objectlab/kit/datecalc/common/PeriodCountBasis.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -195,6 +204,7 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_StandardTenor.java" path="net/objectlab/kit/datecalc/common/StandardTenor.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -222,6 +232,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="92" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="92" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java">
@@ -247,6 +259,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandler.java" path="net/objectlab/kit/datecalc/common/HolidayHandler.java">
<result date="2006-08-23" statvalue="100" type="cobertura-line"/>
@@ -265,6 +279,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java">
@@ -311,6 +327,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_Utils.java" path="net/objectlab/kit/datecalc/common/Utils.java">
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
@@ -320,14 +338,17 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="94" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="88" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="88" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMPeriod.java" path="net/objectlab/kit/datecalc/common/IMMPeriod.java">
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/common/ExcelDateUtil.java">
<result date="2006-09-05" statvalue="84" type="cobertura-line"/>
@@ -336,16 +357,26 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="93" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="93" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/IMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractIMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_common_KitCalculatorsFactory.java" path="net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-jdk/qalab.xml
===================================================================
--- trunk/datecalc-jdk/qalab.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/datecalc-jdk/qalab.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -58,8 +58,10 @@
<summaryresult date="2006-09-06" filecount="2" statvalue="32" type="simian"/>
<summaryresult date="2006-09-06" filecount="21" statvalue="84" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="21" statvalue="89" type="cobertura-branch"/>
- <summaryresult date="2006-09-07" filecount="19" statvalue="91" type="cobertura-line"/>
+ <summaryresult date="2006-09-07" filecount="19" statvalue="93" type="cobertura-line"/>
<summaryresult date="2006-09-07" filecount="19" statvalue="92" type="cobertura-branch"/>
+ <summaryresult date="2006-09-09" filecount="17" statvalue="93" type="cobertura-line"/>
+ <summaryresult date="2006-09-09" filecount="17" statvalue="92" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_jdk_package.html" path="net/objectlab/kit/datecalc/jdk/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -266,8 +268,10 @@
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="79" type="cobertura-line"/>
<result date="2006-09-06" statvalue="84" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="78" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="79" type="cobertura-line"/>
<result date="2006-09-07" statvalue="84" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="79" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="84" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java">
@@ -284,6 +288,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/jdk/ExcelDateUtil.java">
<result date="2006-09-02" statvalue="4" type="checkstyle"/>
@@ -308,6 +314,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="91" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java">
@@ -319,8 +327,8 @@
<result date="2006-09-05" statvalue="86" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="69" type="cobertura-line"/>
<result date="2006-09-06" statvalue="66" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="76" type="cobertura-line"/>
- <result date="2006-09-07" statvalue="66" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="80" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="71" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java">
@@ -341,7 +349,7 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="95" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
@@ -361,7 +369,7 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="90" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java">
@@ -404,7 +412,7 @@
id="net_objectlab_kit_datecalc_jdk_DefaultJdkCalendarCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java">
<result date="2006-09-06" statvalue="87" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkCalendarCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarCalculator.java">
@@ -441,38 +449,82 @@
id="net_objectlab_kit_datecalc_jdk_CalendarBackwardHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_CalendarForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarForwardHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_CalendarModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_CalendarModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_DateBackwardHandler.java" path="net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_DateForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/DateForwardHandler.java">
- <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="90" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="90" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DateModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DateModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java">
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java">
+ <result date="2006-09-09" statvalue="77" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="71" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarKitCalculatorsFactory.java" path="net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_DateDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/DateDateCalculator.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_DateIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/DateIMMDateCalculator.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DateKitCalculatorsFactory.java" path="net/objectlab/kit/datecalc/jdk/DateKitCalculatorsFactory.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/datecalc-joda/qalab.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -61,8 +61,10 @@
<summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
<summaryresult date="2006-09-06" filecount="19" statvalue="95" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="19" statvalue="96" type="cobertura-branch"/>
- <summaryresult date="2006-09-07" filecount="19" statvalue="95" type="cobertura-line"/>
- <summaryresult date="2006-09-07" filecount="19" statvalue="96" type="cobertura-branch"/>
+ <summaryresult date="2006-09-07" filecount="19" statvalue="94" type="cobertura-line"/>
+ <summaryresult date="2006-09-07" filecount="19" statvalue="93" type="cobertura-branch"/>
+ <summaryresult date="2006-09-09" filecount="19" statvalue="94" type="cobertura-line"/>
+ <summaryresult date="2006-09-09" filecount="19" statvalue="93" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_joda_package.html" path="net/objectlab/kit/datecalc/joda/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -177,6 +179,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_BackwardHandler.java" path="net/objectlab/kit/datecalc/joda/BackwardHandler.java">
<result date="2006-08-08" statvalue="28" type="cobertura-line"/>
@@ -361,8 +365,10 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="83" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="83" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="91" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateBackwardHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateBackwardHandler.java">
@@ -376,6 +382,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_LocalDateCalculator.java" path="net/objectlab/kit/datecalc/joda/LocalDateCalculator.java">
<result date="2006-09-02" statvalue="100" type="cobertura-line"/>
@@ -387,8 +395,10 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
- <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="76" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="71" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="76" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="71" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateForwardHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateForwardHandler.java">
@@ -402,6 +412,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java">
@@ -415,6 +427,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java">
@@ -428,6 +442,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayBackwardHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayBackwardHandler.java">
@@ -441,6 +457,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayDateCalculator.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java">
@@ -454,6 +472,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayForwardHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayForwardHandler.java">
@@ -467,6 +487,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java">
@@ -480,6 +502,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayModifiedPreceedingHandler.java">
@@ -493,6 +517,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_JodaExcelDateUtil.java" path="net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java">
<result date="2006-09-05" statvalue="85" type="cobertura-line"/>
@@ -501,6 +527,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="85" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="85" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateIMMDateCalculator.java" path="net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java">
@@ -508,6 +536,8 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayIMMDateCalculator.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java">
@@ -515,5 +545,27 @@
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-07" statvalue="100" type="cobertura-line"/>
<result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_LocalDateKitCalculatorsFactory.java" path="net/objectlab/kit/datecalc/joda/LocalDateKitCalculatorsFactory.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_LocalDatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java">
+ <result date="2006-09-09" statvalue="81" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="84" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_YearMonthDayKitCalculatorsFactory.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayKitCalculatorsFactory.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_YearMonthDayPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculator.java">
+ <result date="2006-09-09" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-09" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/project.properties
===================================================================
--- trunk/project.properties 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/project.properties 2006-09-09 12:45:09 UTC (rev 133)
@@ -56,8 +56,8 @@
# C H A N G E L O G P R O P E R T I E S
# -------------------------------------------------------------------
# Change log & activity stuff
+maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
-
# -------------------------------------------------------------------
# C H E C K S T Y L E P R O P E R T I E S
# -------------------------------------------------------------------
Modified: trunk/project.xml
===================================================================
--- trunk/project.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/project.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -19,12 +19,11 @@
<report>maven-faq-plugin</report>
<report>maven-dashboard-plugin</report>
<report>maven-license-plugin</report>
- <!-- <report>maven-statcvs-plugin</report>
+ <!-- <report>maven-statcvs-plugin</report> -->
+ <report>maven-changes-plugin</report>
<report>maven-changelog-plugin</report>
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
- <report>maven-file-activity-plugin</report>
- <report>maven-developer-activity-plugin</report>-->
<report>maven-linkcheck-plugin</report>
</reports>
</project>
Added: trunk/src/site/changes.xml
===================================================================
--- trunk/src/site/changes.xml (rev 0)
+++ trunk/src/site/changes.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!--
+ -->
+
+<document>
+ <properties>
+ <title>ObjectLabKit Changes</title>
+ <author email="ki...@ob...">Benoit Xhenseval</author>
+ </properties>
+ <body>
+ <release version="1.0" date="In SVN" description="First Cut">
+ <action dev="benoitx" type="add">First cut.</action>
+ </release>
+ </body>
+</document>
Modified: trunk/src/site/index.xml
===================================================================
--- trunk/src/site/index.xml 2006-09-08 15:16:33 UTC (rev 132)
+++ trunk/src/site/index.xml 2006-09-09 12:45:09 UTC (rev 133)
@@ -64,29 +64,29 @@
<ol>
<li><strong>Calendar:</strong>
<pre>
-DateCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
-PeriodCountCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
-IMMDateCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+DateCalculator<Calendar> calc = CalendarKitCalculatorsFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+PeriodCountCalculator<Calendar> calc = CalendarKitCalculatorsFactory.getDefaultInstance().getPeriodCountCalculator();
+IMMDateCalculator<Calendar> calc = CalendarKitCalculatorsFactory.getDefaultInstance().getIMMDateCalculator();
</pre>
</li>
<li><strong>Date:</strong><pre>
-DateCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
-PeriodCountCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
-IMMDateCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+DateCalculator<Date> calc = DateKitCalculatorsFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+PeriodCountCalculator<Date> calc = DateKitCalculatorsFactory.getDefaultInstance().getPeriodCountCalculator();
+IMMDateCalculator<Date> calc = DateKitCalculatorsFactory.getDefaultInstance().getIMMDateCalculator();
</pre></li>
</ol>
<h4>JODA</h4>
<p>2 implementations for Joda have been released</p>
<ol>
<li><strong>LocalDate</strong> (preferred):<pre>
-DateCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
-PeriodCountCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
-IMMDateCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+DateCalculator<LocalDate> calc = LocalDateKitCalculatorsFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+PeriodCountCalculator<LocalDate> calc = LocalDateKitCalculatorsFactory.getDefaultInstance().getPeriodCountCalculator();
+IMMDateCalculator<LocalDate> calc = LocalDateKitCalculatorsFactory.getDefaultInstance().getIMMDateCalculator();
</pre></li>
<li><strong>YearMonthDay:</strong><pre>
-DateCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
-PeriodCountCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
-IMMDateCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+DateCalculator<YearMonthDay> calc = YearMonthDayKitCalculatorsFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+PeriodCountCalculator<YearMonthDay> calc = YearMonthDayKitCalculatorsFactory.getDefaultInstance().getPeriodCountCalculator();
+IMMDateCalculator<YearMonthDay> calc = YearMonthDayKitCalculatorsFactory.getDefaultInstance().getIMMDateCalculator();
</pre></li>
</ol>
</subsection>
@@ -110,7 +110,7 @@
DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", holidays);
// ask for a LocalDate calculator for "UK" (even if a new set of holidays is registered, this one calculator is not affected
-DateCalculator<LocalDate> cal = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+DateCalculator<LocalDate> cal = LocalDateKitCalculatorsFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
cal.setStartDate(new LocalDate("2006-08-28)); // this also sets the current business date.
// the startDate stays 28 Aug 06 BUT the currentDate has moved,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-09-08 15:18:32
|
Revision: 132
http://svn.sourceforge.net/objectlabkit/?rev=132&view=rev
Author: marchy
Date: 2006-09-08 08:16:33 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
refactored the factory names to include the new KitCalculatorsFactory convention. I'm still not sure about the "Kit" in the name, I think we should just drop the kit.
also, dropped the Default, Base, and Jdk out of any implementation classes.
Modified Paths:
--------------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBackwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactoryTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarDateCalculatorCombinationTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarForwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedFollowingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedPreceedingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateBackwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateDateCalculatorCombinationTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateForwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateModifiedFollowingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateModifiedPreceedingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateBackwardDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateCalculatorFactoryTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateDateCalculatorCombinationTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateForwardDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayBackwardDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayCalculatorFactoryTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculatorCombinationTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayForwardDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedPrecedingDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculatorTest.java
Added Paths:
-----------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateKitCalculatorsFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateKitCalculatorsFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayKitCalculatorsFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculator.java
Removed Paths:
-------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDatePeriodCountCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java
Deleted: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,56 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.common;
-
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * TODO javadoc
- *
- * @author marchi
- * @author $LastChangedBy$
- * @version $Revision$ $Date$
- *
- */
-public abstract class AbstractDateCalculatorFactory<E> implements DateCalculatorFactory<E> {
-
- private final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
-
- /**
- * Use this method to register a set of holidays for a given calendar, it
- * will replace any existing set. It won't update any existing
- * DateCalculator as these should not be amended whilst in existence (we
- * could otherwise get inconsistent results).
- *
- * @param name
- * the calendar name to register these holidays under.
- * @param holidays
- * the set of holidays (non-working days).
- */
- public void registerHolidays(final String name, final Set<E> holidaysSet) {
- this.holidays.put(name, holidaysSet);
- }
-
- protected void setHolidays(final String name, final DateCalculator<E> dc) {
- if (holidays.containsKey(name)) {
- dc.setNonWorkingDays(holidays.get(name));
- }
- }
-}
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,56 @@
+/*
+ * $Id: AbstractDateCalculatorFactory.java 125 2006-09-07 17:24:20Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * TODO javadoc
+ *
+ * @author marchi
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
+ *
+ */
+public abstract class AbstractKitCalculatorsFactory<E> implements KitCalculatorsFactory<E> {
+
+ private final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
+
+ /**
+ * Use this method to register a set of holidays for a given calendar, it
+ * will replace any existing set. It won't update any existing
+ * DateCalculator as these should not be amended whilst in existence (we
+ * could otherwise get inconsistent results).
+ *
+ * @param name
+ * the calendar name to register these holidays under.
+ * @param holidays
+ * the set of holidays (non-working days).
+ */
+ public void registerHolidays(final String name, final Set<E> holidaysSet) {
+ this.holidays.put(name, holidaysSet);
+ }
+
+ protected void setHolidays(final String name, final DateCalculator<E> dc) {
+ if (holidays.containsKey(name)) {
+ dc.setNonWorkingDays(holidays.get(name));
+ }
+ }
+}
Deleted: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,78 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.common;
-
-import java.util.Set;
-
-/**
- * Factory will create new instances of calculators, these are lightweight, each
- * thread should use the factory as a given calculator should NOT be shared
- * across thread (unless you know what you're doing) as the startDate, current
- * date and working week would be shared. Once created, the set of holidays will
- * NOT change even if a new set is registered; one needs to get a new
- * DateCalculator to get the new set.
- *
- * @param E
- * a representation of a date, typically JDK: Date, Calendar;
- * Joda:LocalDate, YearMonthDay
- *
- * @author Benoit Xhenseval
- * @author $LastChangedBy$
- * @version $Revision$ $Date$
- */
-public interface DateCalculatorFactory<E> {
-
- /**
- * Create a new DateCalculator for a given name and type of handling.
- *
- * @param name
- * calendar name (holidays set interested in). If there is set of
- * holidays with that name, it will return a DateCalculator with
- * an empty holiday set (will work on Weekend only).
- * @param type
- * typically one of the value of HolidayHandlerType or null.
- * @return a new DateCalculator
- * @exception IllegalArgumentException
- * if the type is not null or a valid value.
- */
- DateCalculator<E> getDateCalculator(final String name, final String holidayHandlerType);
-
- /**
- * Use this method to register a set of holidays for a given calendar.
- *
- * @param name
- * the calendar name to register these holidays under.
- * @param holidays
- * the set of holidays (non-working days).
- */
- void registerHolidays(final String name, Set<E> holidays);
-
- /**
- * Create a new PeriodCountCalculator.
- *
- * @return a PeriodCountCalculator
- */
- PeriodCountCalculator<E> getPeriodCountCalculator();
-
- /**
- * Create a new IMMDateCalculator.
- *
- * @return an IMMDateCalculator
- */
- IMMDateCalculator<E> getIMMDateCalculator();
-}
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,78 @@
+/*
+ * $Id: DateCalculatorFactory.java 125 2006-09-07 17:24:20Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Set;
+
+/**
+ * Factory will create new instances of calculators, these are lightweight, each
+ * thread should use the factory as a given calculator should NOT be shared
+ * across thread (unless you know what you're doing) as the startDate, current
+ * date and working week would be shared. Once created, the set of holidays will
+ * NOT change even if a new set is registered; one needs to get a new
+ * DateCalculator to get the new set.
+ *
+ * @param E
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
+ */
+public interface KitCalculatorsFactory<E> {
+
+ /**
+ * Create a new DateCalculator for a given name and type of handling.
+ *
+ * @param name
+ * calendar name (holidays set interested in). If there is set of
+ * holidays with that name, it will return a DateCalculator with
+ * an empty holiday set (will work on Weekend only).
+ * @param type
+ * typically one of the value of HolidayHandlerType or null.
+ * @return a new DateCalculator
+ * @exception IllegalArgumentException
+ * if the type is not null or a valid value.
+ */
+ DateCalculator<E> getDateCalculator(final String name, final String holidayHandlerType);
+
+ /**
+ * Use this method to register a set of holidays for a given calendar.
+ *
+ * @param name
+ * the calendar name to register these holidays under.
+ * @param holidays
+ * the set of holidays (non-working days).
+ */
+ void registerHolidays(final String name, Set<E> holidays);
+
+ /**
+ * Create a new PeriodCountCalculator.
+ *
+ * @return a PeriodCountCalculator
+ */
+ PeriodCountCalculator<E> getPeriodCountCalculator();
+
+ /**
+ * Create a new IMMDateCalculator.
+ *
+ * @return an IMMDateCalculator
+ */
+ IMMDateCalculator<E> getIMMDateCalculator();
+}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -9,7 +9,7 @@
public abstract class AbstractDateTestCase<E> extends TestCase {
protected abstract E newDate(final String date);
- protected abstract DateCalculatorFactory<E> getDateCalculatorFactory();
+ protected abstract KitCalculatorsFactory<E> getDateCalculatorFactory();
protected void checkDate(final String string, final DateCalculator<E> calendar, final String string2) {
Assert.assertEquals(string, newDate(string2), calendar.getCurrentBusinessDate());
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,111 @@
+/*
+ * $Id: JdkCalendarBaseDateCalculator.java 128 2006-09-08 13:14:46Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Set;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandler;
+import net.objectlab.kit.datecalc.common.Utils;
+import net.objectlab.kit.datecalc.common.WorkingWeek;
+
+/**
+ * This class is used via the DateCalculator interface, it enables the handling
+ * of different HolidayHandler, if no HolidayHandler is defined, the calendar
+ * will NOT move a date, even if it falls on a holiday or weekend.
+ *
+ * @author Marcin Jekot
+ * @author $LastModifiedBy$
+ * @version $Revision: 128 $ $Date: 2006-09-08 15:14:46 +0200 (Fri, 08 Sep 2006) $
+ */
+public class CalendarDateCalculator extends AbstractDateCalculator<Calendar> {
+
+ private WorkingWeek workingWeek = WorkingWeek.DEFAULT;
+
+ @SuppressWarnings("unchecked")
+ public CalendarDateCalculator() {
+ this(null, null, Collections.EMPTY_SET, null);
+ }
+
+ public CalendarDateCalculator(final String name, final Calendar startDate, final Set<Calendar> nonWorkingDays,
+ final HolidayHandler<Calendar> holidayHandler) {
+ super(name, nonWorkingDays, holidayHandler);
+ Calendar date = startDate;
+ if (date == null) {
+ date = getToday();
+ }
+ setStartDate(date);
+ }
+
+ public void setWorkingWeek(final WorkingWeek week) {
+ workingWeek = week;
+ }
+
+ /**
+ * is the date a non-working day according to the WorkingWeek?
+ */
+ public boolean isWeekend(final Calendar date) {
+ assert workingWeek != null;
+ return !workingWeek.isWorkingDay(date);
+ }
+
+ public CalendarDateCalculator moveByDays(final int days) {
+ if (getCurrentBusinessDate() == null) {
+ initialise();
+ }
+ getCurrentBusinessDate().add(Calendar.DAY_OF_MONTH, days);
+
+ if (getHolidayHandler() != null) {
+ setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this));
+ }
+
+ return this;
+ }
+
+ private void initialise() {
+ if (getStartDate() == null) {
+ setStartDate(Calendar.getInstance());
+ } else if (getCurrentBusinessDate() == null) {
+ setCurrentBusinessDate(Calendar.getInstance());
+ }
+ }
+
+ @Override
+ protected DateCalculator<Calendar> createNewCalculator(final String name, final Calendar startDate, final Set<Calendar> holidays,
+ final HolidayHandler<Calendar> handler) {
+ return new CalendarDateCalculator(name, startDate, holidays, handler);
+ }
+/*
+ * @Override public JdkCalendarBaseDateCalculator combine(final DateCalculator<Calendar>
+ * calendar) { return (JdkCalendarBaseDateCalculator) super.combine(calendar); }
+ *
+ * @Override public JdkCalendarBaseDateCalculator moveByTenor(final Tenor tenor) {
+ * return (JdkCalendarBaseDateCalculator) super.moveByTenor(tenor); }
+ *
+ * @Override public JdkCalendarBaseDateCalculator moveByBusinessDays(final int
+ * businessDays) { return (JdkCalendarBaseDateCalculator)
+ * super.moveByBusinessDays(businessDays); }
+ */
+ @Override
+ protected Calendar getToday() {
+ return Utils.blastTime(Calendar.getInstance());
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,124 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import net.objectlab.kit.datecalc.common.AbstractIMMDateCalculator;
+import net.objectlab.kit.datecalc.common.IMMPeriod;
+
+public class CalendarIMMDateCalculator extends AbstractIMMDateCalculator<Calendar> {
+ private static final int NUMBER_DAYS_IN_WEEK = 7;
+
+ /**
+ * Returns a list of IMM dates between 2 dates, it will exclude the start
+ * date if it is an IMM date but would include the end date if it is an IMM.
+ *
+ * @param start
+ * start of the interval, excluded
+ * @param end
+ * end of the interval, may be included.
+ * @param period
+ * specify when the "next" IMM is, if quarterly then it is the
+ * conventional algorithm.
+ * @return list of IMM dates
+ */
+ public List<Calendar> getIMMDates(final Calendar start, final Calendar end, final IMMPeriod period) {
+
+ final List<Calendar> dates = new ArrayList<Calendar>();
+ Calendar cal = (Calendar) start.clone();
+ while (true) {
+ cal = getNextIMMDate(true, cal, period);
+ if (!cal.after(end)) {
+ dates.add(cal);
+ } else {
+ break;
+ }
+ }
+
+ return dates;
+ }
+
+ @Override
+ protected Calendar getNextIMMDate(final boolean requestNextIMM, final Calendar startDate, final IMMPeriod period) {
+
+ Calendar cal = (Calendar) startDate.clone();
+
+ if (isIMMMonth(cal)) {
+ moveToIMMDay(cal);
+ // TODO simplify this if condition
+ // if (forward ^ cal.getTime().before(startDate) ||
+ // cal.getTime().equals(startDate)) {
+ if ((requestNextIMM && cal.after(startDate)) || (!requestNextIMM && cal.before(startDate))) {
+ return cal;
+ }
+ }
+
+ final int delta = (requestNextIMM ? 1 : -1);
+ do {
+ cal.add(Calendar.MONTH, delta);
+ } while (!isIMMMonth(cal));
+
+ moveToIMMDay(cal);
+
+ final int month = cal.get(Calendar.MONTH);
+ if ((period == IMMPeriod.BI_ANNUALY_JUN_DEC && (Calendar.MARCH == month || Calendar.SEPTEMBER == month))
+ || (period == IMMPeriod.BI_ANNUALY_MAR_SEP && (Calendar.JUNE == month || Calendar.DECEMBER == month))) {
+ // need to move to the next one.
+ cal = getNextIMMDate(requestNextIMM, cal, period);
+ } else if (period == IMMPeriod.ANNUALLY) {
+ // second jump
+ cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
+ // third jump
+ cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
+ // fourth jump
+ cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
+ // fifth jump
+ cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
+ }
+
+ return cal;
+ }
+
+ private boolean isIMMMonth(final Calendar cal) {
+ final int month = cal.get(Calendar.MONTH);
+
+ switch (month) {
+ case Calendar.MARCH:
+ case Calendar.JUNE:
+ case Calendar.SEPTEMBER:
+ case Calendar.DECEMBER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Assumes that the month is correct, get the day for the 3rd wednesday.
+ *
+ * @param first
+ * @return
+ */
+ private void moveToIMMDay(final Calendar cal) {
+ cal.set(Calendar.DAY_OF_MONTH, 1);
+
+ // go to 1st wed
+ final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ if (dayOfWeek < Calendar.WEDNESDAY) {
+ cal.add(Calendar.DAY_OF_MONTH, Calendar.WEDNESDAY - dayOfWeek);
+ } else if (dayOfWeek > Calendar.WEDNESDAY) {
+ cal.add(Calendar.DAY_OF_MONTH, (Calendar.WEDNESDAY + NUMBER_DAYS_IN_WEEK) - dayOfWeek);
+ }
+
+ // go to 3rd wednesday - i.e. move 2 weeks forward
+ cal.add(Calendar.DAY_OF_MONTH, NUMBER_DAYS_IN_WEEK * 2);
+ }
+
+ public boolean isIMMDate(final Calendar date) {
+ // TODO a slightly crude implementation - revisit
+ final Calendar cal = (Calendar) date.clone();
+ moveToIMMDay(cal);
+ return cal.equals(date);
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarKitCalculatorsFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,89 @@
+/*
+ * $Id: DefaultJdkDateCalculatorFactory.java 96 2006-09-04 15:01:20Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractKitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.IMMDateCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+
+/**
+ * TODO add javadoc
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class CalendarKitCalculatorsFactory extends AbstractKitCalculatorsFactory<Calendar> {
+
+ private static final CalendarKitCalculatorsFactory DEFAULT = new CalendarKitCalculatorsFactory();
+
+ private static final PeriodCountCalculator<Calendar> PCC = new CalendarPeriodCountCalculator();
+
+ private static final CalendarIMMDateCalculator IMMDC = new CalendarIMMDateCalculator();
+
+ public static CalendarKitCalculatorsFactory getDefaultInstance() {
+ return DEFAULT;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
+ * java.lang.String)
+ */
+ public DateCalculator<Calendar> getDateCalculator(final String name, final String holidayHandlerType) {
+ final CalendarDateCalculator cal = new CalendarDateCalculator();
+ cal.setName(name);
+ setHolidays(name, cal);
+
+ if (holidayHandlerType == null) {
+ return cal;
+ } else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new CalendarForwardHandler());
+ } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new CalendarBackwardHandler());
+ } else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new CalendarModifiedFollowingHandler());
+ } else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new CalendarModifiedPreceedingHandler());
+ } else {
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
+ }
+
+ return cal;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
+ */
+ public PeriodCountCalculator<Calendar> getPeriodCountCalculator() {
+ return PCC;
+ }
+
+ public IMMDateCalculator<Calendar> getIMMDateCalculator() {
+ return IMMDC;
+ }
+
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,104 @@
+/*
+ * $Id: JdkDateBaseDateCalculator.java 125 2006-09-07 17:24:20Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Set;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandler;
+import net.objectlab.kit.datecalc.common.Utils;
+import net.objectlab.kit.datecalc.common.WorkingWeek;
+
+/**
+ * This class is used via the DateCalculator interface, it enables the handling
+ * of different HolidayHandler, if no HolidayHandler is defined, the calendar
+ * will NOT move a date, even if it falls on a holiday or weekend.
+ *
+ * @author Marcin Jekot
+ * @author $LastModifiedBy$
+ * @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
+ */
+public class DateDateCalculator extends AbstractDateCalculator<Date> {
+
+ private CalendarDateCalculator delegate;
+
+ @SuppressWarnings("unchecked")
+ public DateDateCalculator() {
+ this(null, null, Collections.EMPTY_SET, null);
+ }
+
+ public DateDateCalculator(final String name, final Date startDate, final Set<Date> nonWorkingDays,
+ final HolidayHandler<Date> holidayHandler) {
+ super(name, nonWorkingDays, holidayHandler);
+ Date date = startDate;
+ final HolidayHandler<Calendar> locDate = new HolidayHandlerDateWrapper(holidayHandler, this);
+
+ final Set<Calendar> nonWorkingCalendars = Utils.toCalendarSet(nonWorkingDays);
+ if (date == null) {
+ date = getToday();
+ }
+
+ delegate = new CalendarDateCalculator(name, Utils.getCal(date), nonWorkingCalendars, locDate);
+ delegate.setStartDate(Utils.getCal(date));
+ setStartDate(date);
+ }
+
+ // TODO throw an exception if the type is incorrect
+ public void setWorkingWeek(final WorkingWeek week) {
+ delegate.setWorkingWeek(week);
+ }
+
+ /**
+ * is the date a non-working day according to the WorkingWeek?
+ */
+ public boolean isWeekend(final Date date) {
+ if (date != null && delegate != null) {
+ return delegate.isWeekend(Utils.getCal(date));
+ }
+ return false;
+ }
+
+ public DateCalculator<Date> moveByDays(final int days) {
+ delegate.setCurrentBusinessDate(Utils.getCal(getCurrentBusinessDate()));
+ setCurrentBusinessDate(delegate.moveByDays(days).getCurrentBusinessDate().getTime());
+ return this;
+ }
+
+ @Override
+ protected DateCalculator<Date> createNewCalculator(final String name, final Date startDate, final Set<Date> holidays,
+ final HolidayHandler<Date> handler) {
+ return new DateDateCalculator(name, startDate, holidays, handler);
+ }
+
+ @Override
+ public void setStartDate(final Date startDate) {
+ if (delegate != null) {
+ delegate.setStartDate(startDate != null ? Utils.getCal(startDate) : null);
+ }
+ super.setStartDate(startDate);
+ }
+
+ @Override
+ protected Date getToday() {
+ return Utils.blastTime(Calendar.getInstance()).getTime();
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateIMMDateCalculator.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateIMMDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,36 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import net.objectlab.kit.datecalc.common.AbstractIMMDateCalculator;
+import net.objectlab.kit.datecalc.common.IMMPeriod;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class DateIMMDateCalculator extends AbstractIMMDateCalculator<Date> {
+
+ private static final CalendarIMMDateCalculator DELEGATE = new CalendarIMMDateCalculator();
+
+ @Override
+ protected Date getNextIMMDate(final boolean requestNextIMM, final Date theStartDate, final IMMPeriod period) {
+ return DELEGATE.getNextIMMDate(requestNextIMM, Utils.getCal(theStartDate), period).getTime();
+ }
+
+ public List<Date> getIMMDates(final Date start, final Date end, final IMMPeriod period) {
+ return buildList(DELEGATE.getIMMDates(Utils.getCal(start), Utils.getCal(end), period));
+ }
+
+ public boolean isIMMDate(final Date date) {
+ return DELEGATE.isIMMDate(Utils.getCal(date));
+ }
+
+ private List<Date> buildList(final List<Calendar> dates) {
+ final List<Date> imms = new ArrayList<Date>();
+ for (final Calendar date : dates) {
+ imms.add(date.getTime());
+ }
+ return imms;
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateKitCalculatorsFactory.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateKitCalculatorsFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -0,0 +1,89 @@
+/*
+ * $Id: DefaultJdkDateCalculatorFactory.java 127 2006-09-08 11:22:24Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.AbstractKitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.IMMDateCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+
+/**
+ * TODO add javadoc
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 127 $ $Date: 2006-09-08 13:22:24 +0200 (Fri, 08 Sep 2006) $
+ *
+ */
+public class DateKitCalculatorsFactory extends AbstractKitCalculatorsFactory<Date> {
+
+ private static final DateKitCalculatorsFactory DEFAULT = new DateKitCalculatorsFactory();
+
+ private static final PeriodCountCalculator<Date> PCC = new DatePeriodCountCalculator();
+
+ private static final DateIMMDateCalculator IMMDC = new DateIMMDateCalculator();
+
+ public static DateKitCalculatorsFactory getDefaultInstance() {
+ return DEFAULT;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
+ * java.lang.String)
+ */
+ public DateCalculator<Date> getDateCalculator(final String name, final String holidayHandlerType) {
+ final DateDateCalculator cal = new DateDateCalculator();
+ cal.setName(name);
+ setHolidays(name, cal);
+
+ if (holidayHandlerType == null) {
+ return cal;
+ } else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new DateForwardHandler());
+ } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new DateBackwardHandler());
+ } else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new DateModifiedFollowingHandler());
+ } else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new DateModifiedPreceedingHandler());
+ } else {
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
+ }
+
+ return cal;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
+ */
+ public PeriodCountCalculator<Date> getPeriodCountCalculator() {
+ return PCC;
+ }
+
+ public IMMDateCalculator<Date> getIMMDateCalculator() {
+ return IMMDC;
+ }
+
+}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,89 +0,0 @@
-/*
- * $Id: DefaultJdkDateCalculatorFactory.java 96 2006-09-04 15:01:20Z benoitx $
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-
-import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-import net.objectlab.kit.datecalc.common.IMMDateCalculator;
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-
-/**
- * TODO add javadoc
- *
- * @author Benoit Xhenseval
- * @author $LastChangedBy: benoitx $
- * @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
- *
- */
-public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> {
-
- private static final DefaultJdkCalendarCalculatorFactory DEFAULT = new DefaultJdkCalendarCalculatorFactory();
-
- private static final PeriodCountCalculator<Calendar> PCC = new CalendarPeriodCountCalculator();
-
- private static final JdkCalendarIMMDateCalculator IMMDC = new JdkCalendarIMMDateCalculator();
-
- public static DefaultJdkCalendarCalculatorFactory getDefaultInstance() {
- return DEFAULT;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
- * java.lang.String)
- */
- public DateCalculator<Calendar> getDateCalculator(final String name, final String holidayHandlerType) {
- final JdkCalendarBaseDateCalculator cal = new JdkCalendarBaseDateCalculator();
- cal.setName(name);
- setHolidays(name, cal);
-
- if (holidayHandlerType == null) {
- return cal;
- } else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new CalendarForwardHandler());
- } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new CalendarBackwardHandler());
- } else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new CalendarModifiedFollowingHandler());
- } else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new CalendarModifiedPreceedingHandler());
- } else {
- throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
- }
-
- return cal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
- */
- public PeriodCountCalculator<Calendar> getPeriodCountCalculator() {
- return PCC;
- }
-
- public IMMDateCalculator<Calendar> getIMMDateCalculator() {
- return IMMDC;
- }
-
-}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,89 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-
-import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-import net.objectlab.kit.datecalc.common.IMMDateCalculator;
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-
-/**
- * TODO add javadoc
- *
- * @author Benoit Xhenseval
- * @author $LastChangedBy$
- * @version $Revision$ $Date$
- *
- */
-public class DefaultJdkDateCalculatorFactory extends AbstractDateCalculatorFactory<Date> {
-
- private static final DefaultJdkDateCalculatorFactory DEFAULT = new DefaultJdkDateCalculatorFactory();
-
- private static final PeriodCountCalculator<Date> PCC = new DatePeriodCountCalculator();
-
- private static final JdkDateIMMDateCalculator IMMDC = new JdkDateIMMDateCalculator();
-
- public static DefaultJdkDateCalculatorFactory getDefaultInstance() {
- return DEFAULT;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
- * java.lang.String)
- */
- public DateCalculator<Date> getDateCalculator(final String name, final String holidayHandlerType) {
- final JdkDateBaseDateCalculator cal = new JdkDateBaseDateCalculator();
- cal.setName(name);
- setHolidays(name, cal);
-
- if (holidayHandlerType == null) {
- return cal;
- } else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new DateForwardHandler());
- } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new DateBackwardHandler());
- } else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new DateModifiedFollowingHandler());
- } else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new DateModifiedPreceedingHandler());
- } else {
- throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
- }
-
- return cal;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
- */
- public PeriodCountCalculator<Date> getPeriodCountCalculator() {
- return PCC;
- }
-
- public IMMDateCalculator<Date> getIMMDateCalculator() {
- return IMMDC;
- }
-
-}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,111 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Set;
-
-import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandler;
-import net.objectlab.kit.datecalc.common.Utils;
-import net.objectlab.kit.datecalc.common.WorkingWeek;
-
-/**
- * This class is used via the DateCalculator interface, it enables the handling
- * of different HolidayHandler, if no HolidayHandler is defined, the calendar
- * will NOT move a date, even if it falls on a holiday or weekend.
- *
- * @author Marcin Jekot
- * @author $LastModifiedBy$
- * @version $Revision$ $Date$
- */
-public class JdkCalendarBaseDateCalculator extends AbstractDateCalculator<Calendar> {
-
- private WorkingWeek workingWeek = WorkingWeek.DEFAULT;
-
- @SuppressWarnings("unchecked")
- public JdkCalendarBaseDateCalculator() {
- this(null, null, Collections.EMPTY_SET, null);
- }
-
- public JdkCalendarBaseDateCalculator(final String name, final Calendar startDate, final Set<Calendar> nonWorkingDays,
- final HolidayHandler<Calendar> holidayHandler) {
- super(name, nonWorkingDays, holidayHandler);
- Calendar date = startDate;
- if (date == null) {
- date = getToday();
- }
- setStartDate(date);
- }
-
- public void setWorkingWeek(final WorkingWeek week) {
- workingWeek = week;
- }
-
- /**
- * is the date a non-working day according to the WorkingWeek?
- */
- public boolean isWeekend(final Calendar date) {
- assert workingWeek != null;
- return !workingWeek.isWorkingDay(date);
- }
-
- public JdkCalendarBaseDateCalculator moveByDays(final int days) {
- if (getCurrentBusinessDate() == null) {
- initialise();
- }
- getCurrentBusinessDate().add(Calendar.DAY_OF_MONTH, days);
-
- if (getHolidayHandler() != null) {
- setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this));
- }
-
- return this;
- }
-
- private void initialise() {
- if (getStartDate() == null) {
- setStartDate(Calendar.getInstance());
- } else if (getCurrentBusinessDate() == null) {
- setCurrentBusinessDate(Calendar.getInstance());
- }
- }
-
- @Override
- protected DateCalculator<Calendar> createNewCalculator(final String name, final Calendar startDate, final Set<Calendar> holidays,
- final HolidayHandler<Calendar> handler) {
- return new JdkCalendarBaseDateCalculator(name, startDate, holidays, handler);
- }
-/*
- * @Override public JdkCalendarBaseDateCalculator combine(final DateCalculator<Calendar>
- * calendar) { return (JdkCalendarBaseDateCalculator) super.combine(calendar); }
- *
- * @Override public JdkCalendarBaseDateCalculator moveByTenor(final Tenor tenor) {
- * return (JdkCalendarBaseDateCalculator) super.moveByTenor(tenor); }
- *
- * @Override public JdkCalendarBaseDateCalculator moveByBusinessDays(final int
- * businessDays) { return (JdkCalendarBaseDateCalculator)
- * super.moveByBusinessDays(businessDays); }
- */
- @Override
- protected Calendar getToday() {
- return Utils.blastTime(Calendar.getInstance());
- }
-}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,124 +0,0 @@
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import net.objectlab.kit.datecalc.common.AbstractIMMDateCalculator;
-import net.objectlab.kit.datecalc.common.IMMPeriod;
-
-public class JdkCalendarIMMDateCalculator extends AbstractIMMDateCalculator<Calendar> {
- private static final int NUMBER_DAYS_IN_WEEK = 7;
-
- /**
- * Returns a list of IMM dates between 2 dates, it will exclude the start
- * date if it is an IMM date but would include the end date if it is an IMM.
- *
- * @param start
- * start of the interval, excluded
- * @param end
- * end of the interval, may be included.
- * @param period
- * specify when the "next" IMM is, if quarterly then it is the
- * conventional algorithm.
- * @return list of IMM dates
- */
- public List<Calendar> getIMMDates(final Calendar start, final Calendar end, final IMMPeriod period) {
-
- final List<Calendar> dates = new ArrayList<Calendar>();
- Calendar cal = (Calendar) start.clone();
- while (true) {
- cal = getNextIMMDate(true, cal, period);
- if (!cal.after(end)) {
- dates.add(cal);
- } else {
- break;
- }
- }
-
- return dates;
- }
-
- @Override
- protected Calendar getNextIMMDate(final boolean requestNextIMM, final Calendar startDate, final IMMPeriod period) {
-
- Calendar cal = (Calendar) startDate.clone();
-
- if (isIMMMonth(cal)) {
- moveToIMMDay(cal);
- // TODO simplify this if condition
- // if (forward ^ cal.getTime().before(startDate) ||
- // cal.getTime().equals(startDate)) {
- if ((requestNextIMM && cal.after(startDate)) || (!requestNextIMM && cal.before(startDate))) {
- return cal;
- }
- }
-
- final int delta = (requestNextIMM ? 1 : -1);
- do {
- cal.add(Calendar.MONTH, delta);
- } while (!isIMMMonth(cal));
-
- moveToIMMDay(cal);
-
- final int month = cal.get(Calendar.MONTH);
- if ((period == IMMPeriod.BI_ANNUALY_JUN_DEC && (Calendar.MARCH == month || Calendar.SEPTEMBER == month))
- || (period == IMMPeriod.BI_ANNUALY_MAR_SEP && (Calendar.JUNE == month || Calendar.DECEMBER == month))) {
- // need to move to the next one.
- cal = getNextIMMDate(requestNextIMM, cal, period);
- } else if (period == IMMPeriod.ANNUALLY) {
- // second jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // third jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // fourth jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // fifth jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- }
-
- return cal;
- }
-
- private boolean isIMMMonth(final Calendar cal) {
- final int month = cal.get(Calendar.MONTH);
-
- switch (month) {
- case Calendar.MARCH:
- case Calendar.JUNE:
- case Calendar.SEPTEMBER:
- case Calendar.DECEMBER:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * Assumes that the month is correct, get the day for the 3rd wednesday.
- *
- * @param first
- * @return
- */
- private void moveToIMMDay(final Calendar cal) {
- cal.set(Calendar.DAY_OF_MONTH, 1);
-
- // go to 1st wed
- final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
- if (dayOfWeek < Calendar.WEDNESDAY) {
- cal.add(Calendar.DAY_OF_MONTH, Calendar.WEDNESDAY - dayOfWeek);
- } else if (dayOfWeek > Calendar.WEDNESDAY) {
- cal.add(Calendar.DAY_OF_MONTH, (Calendar.WEDNESDAY + NUMBER_DAYS_IN_WEEK) - dayOfWeek);
- }
-
- // go to 3rd wednesday - i.e. move 2 weeks forward
- cal.add(Calendar.DAY_OF_MONTH, NUMBER_DAYS_IN_WEEK * 2);
- }
-
- public boolean isIMMDate(final Calendar date) {
- // TODO a slightly crude implementation - revisit
- final Calendar cal = (Calendar) date.clone();
- moveToIMMDay(cal);
- return cal.equals(date);
- }
-}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java 2006-09-08 14:59:22 UTC (rev 131)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java 2006-09-08 15:16:33 UTC (rev 132)
@@ -1,104 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Set;
-
-import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
-import net.ob...
[truncated message content] |
|
From: <ma...@us...> - 2006-09-08 14:59:39
|
Revision: 131
http://svn.sourceforge.net/objectlabkit/?rev=131&view=rev
Author: marchy
Date: 2006-09-08 07:59:22 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
adding eclipse project files in toplevel root folder - just as an option for development
Added Paths:
-----------
trunk/.classpath
trunk/.project
trunk/.settings/
trunk/.settings/org.eclipse.jdt.core.prefs
trunk/.settings/org.eclipse.jdt.ui.prefs
Added: trunk/.classpath
===================================================================
--- trunk/.classpath (rev 0)
+++ trunk/.classpath 2006-09-08 14:59:22 UTC (rev 131)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="datecalc-common/src/main/java"/>
+ <classpathentry kind="src" path="datecalc-common/src/test/java"/>
+ <classpathentry kind="src" path="datecalc-jdk/src/main/java"/>
+ <classpathentry kind="src" path="datecalc-jdk/src/test/java"/>
+ <classpathentry kind="src" path="datecalc-joda/src/main/java"/>
+ <classpathentry kind="src" path="datecalc-joda/src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.3/joda-time-1.3.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/.project
===================================================================
--- trunk/.project (rev 0)
+++ trunk/.project 2006-09-08 14:59:22 UTC (rev 131)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>objectlabkit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/.settings/org.eclipse.jdt.core.prefs 2006-09-08 14:59:22 UTC (rev 131)
@@ -0,0 +1,12 @@
+#Fri Sep 08 16:51:16 CAT 2006
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- trunk/.settings/org.eclipse.jdt.ui.prefs (rev 0)
+++ trunk/.settings/org.eclipse.jdt.ui.prefs 2006-09-08 14:59:22 UTC (rev 131)
@@ -0,0 +1,4 @@
+#Fri Sep 08 16:51:16 CAT 2006
+eclipse.preferences.version=1
+internal.default.compliance=default
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<templates/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-09-08 14:58:36
|
Revision: 130
http://svn.sourceforge.net/objectlabkit/?rev=130&view=rev
Author: marchy
Date: 2006-09-08 07:58:19 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
cleaning up maven2 setup - removed all the spring rich client stuff that was there before and starting afresh, kinda a minimalist approach ;)
Modified Paths:
--------------
trunk/datecalc-common/pom.xml
trunk/datecalc-jdk/pom.xml
trunk/datecalc-joda/pom.xml
trunk/pom.xml
Modified: trunk/datecalc-common/pom.xml
===================================================================
--- trunk/datecalc-common/pom.xml 2006-09-08 13:17:23 UTC (rev 129)
+++ trunk/datecalc-common/pom.xml 2006-09-08 14:58:19 UTC (rev 130)
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- /*
- * ========================================================================
- * ObjectLab Financial Ltd, proud sponsor of The Kit.
- * ========================================================================
- */
--->
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ /*
+ * ========================================================================
+ * ObjectLab Financial Ltd, proud sponsor of The Kit.
+ * ========================================================================
+ */
+-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -33,14 +33,4 @@
</plugins>
</reporting>
- <dependencies>
- <!-- TODO test cases should use log4j transparently -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
</project>
\ No newline at end of file
Modified: trunk/datecalc-jdk/pom.xml
===================================================================
--- trunk/datecalc-jdk/pom.xml 2006-09-08 13:17:23 UTC (rev 129)
+++ trunk/datecalc-jdk/pom.xml 2006-09-08 14:58:19 UTC (rev 130)
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- /*
- * ========================================================================
- * ObjectLab Financial Ltd, proud sponsor of The Kit.
- * ========================================================================
- */
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<!--
+ /*
+ * ========================================================================
+ * ObjectLab Financial Ltd, proud sponsor of The Kit.
+ * ========================================================================
+ */
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -34,18 +34,10 @@
<dependencies>
<dependency>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc-common</artifactId>
<version>${pom.version}</version>
</dependency>
-
- <!-- TODO test cases should use log4j transparently -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/datecalc-joda/pom.xml
===================================================================
--- trunk/datecalc-joda/pom.xml 2006-09-08 13:17:23 UTC (rev 129)
+++ trunk/datecalc-joda/pom.xml 2006-09-08 14:58:19 UTC (rev 130)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -28,28 +28,12 @@
<dependencies>
<dependency>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc-common</artifactId>
<version>${pom.version}</version>
</dependency>
- <!-- Internal
<dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-resources</artifactId>
- <optional>true</optional>
- </dependency>
- -->
-
- <!-- TODO test cases should use log4j transparently -->
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Dependency injection -->
- <dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.3</version>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2006-09-08 13:17:23 UTC (rev 129)
+++ trunk/pom.xml 2006-09-08 14:58:19 UTC (rev 130)
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc</artifactId>
<packaging>pom</packaging>
<name>ObjectLab Kit</name>
@@ -14,372 +14,32 @@
Why re-inventing the wheel???
</description>
- <issueManagement>
- <system>jira</system>
- <url>http://opensource2.atlassian.com/projects/spring/browse/RCP</url>
- </issueManagement>
- <ciManagement>
- <system>continuum</system>
- <notifiers>
- <notifier>
- <type>mail</type>
- <configuration>
- <address>spr...@li...</address>
- </configuration>
- </notifier>
- </notifiers>
- </ciManagement>
- <inceptionYear>2006</inceptionYear>
- <mailingLists>
- <mailingList>
- <name>User list</name>
- <subscribe>http://forum.springframework.org/forumdisplay.php?f=28</subscribe>
- <unsubscribe>http://forum.springframework.org/forumdisplay.php?f=28</unsubscribe>
- <post>http://forum.springframework.org/forumdisplay.php?f=28</post>
- <archive>http://forum.springframework.org/forumdisplay.php?f=28</archive>
- </mailingList>
- <mailingList>
- <name>Developer list</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/springframework-rcp-dev</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/springframework-rcp-dev</unsubscribe>
- <!-- This list is not part of the spring-rich-c SF project but of the springframework -->
- <post>spr...@li...</post>
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=springframework-rcp-dev</archive>
- <otherArchives>
- <otherArchive>http://news.gmane.org/gmane.comp.java.springframework.rcp.devel</otherArchive>
- </otherArchives>
- </mailingList>
- <mailingList>
- <name>Version control commits</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs</unsubscribe>
- <post>spr...@li...</post>
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=spring-rich-c-cvs</archive>
- <otherArchives>
- <otherArchive>http://news.gmane.org/gmane.comp.java.springframework.rcp.commits</otherArchive>
- </otherArchives>
- </mailingList>
- </mailingLists>
- <developers>
- <developer>
- <id>benoitx</id>
- <name>Benoit Xhenseval</name>
- <email>kit AT objectlab DOT co DOT UK</email>
- <roles>
- <role>Project Leader</role>
- <role>Java developer</role>
- </roles>
- <timezone/>
- </developer>
- <developer>
- <id>mjekot</id>
- <name>Marcin Jekot</name>
- <email/>
- <roles>
- <role>Java developer</role>
- </roles>
- <timezone/>
- </developer>
- </developers>
- <contributors/>
-
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <connection>
- scm:svn:https://svn.sourceforge.net/svnroot/spring-rich-c/trunk/spring-richclient/
- </connection>
- <developerConnection>
- scm:svn:https://svn.sourceforge.net/svnroot/spring-rich-c/trunk/spring-richclient/
- </developerConnection>
- <url>
- http://svn.sourceforge.net/viewcvs.cgi/spring-rich-c/trunk/spring-richclient/
- </url>
- </scm>
- <organization>
- <name>ObjectLab</name>
- <url>http://www.objectlab.co.uk</url>
- </organization>
-
- <build>
-<!-- <pluginManagement> -->
- <plugins>
- <!--
- Last time synchronized with the latest plugin releases:
- 2006-06-21
- See http://news.gmane.org/gmane.comp.apache.maven.announce
- -->
-
- <!-- Building -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-help-plugin</artifactId>
- <version>2.0.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.1</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- <forkMode>never</forkMode>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*AbstractTests.java</exclude>
- </excludes>
- </configuration>
- </plugin>
-
- <!-- Packaging -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.1</version>
-
- </plugin>
-<!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.1</version>
- </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.1</version>
- </plugin>
-
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-4</version>
- <configuration>
- <tagBase>
- https://svn.sourceforge.net/svnroot/spring-rich-c/tags
- </tagBase>
- </configuration>
- </plugin>
--->
- <!-- IDE -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-idea-plugin</artifactId>
- <version>2.0</version>
- <configuration>
- <downloadSources>true</downloadSources>
- <downloadJavadocs>true</downloadJavadocs>
- </configuration>
- </plugin>
-
- <!--Site -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>2.0-beta-5</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.0.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <!--<plugin>-->
- <!--<groupId>org.codehaus.mojo</groupId>-->
- <!--<artifactId>taglist-maven-plugin</artifactId>-->
- <!--<version>???</version>-->
- <!--</plugin>-->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jdepend-maven-plugin</artifactId>
- <version>2.0-beta-1-SNAPSHOT</version>
- </plugin>
- <!--
- TODO checkstyle rules must be configured so it no longer
- generates a 4 mb file which is hard to site-deploy...
- -->
- <!--<plugin>-->
- <!--<groupId>org.apache.maven.plugins</groupId>-->
- <!--<artifactId>maven-checkstyle-plugin</artifactId>-->
- <!--<version>2.1</version>-->
- <!--</plugin>-->
- <!--
- TODO Changelog is unfinished:
- - has also a problem with the netbeans (cvs)lib dependency
- - is moving from mojo.codehaus.org to maven.apache.org
- -->
- <!--<plugin>-->
- <!--<groupId>org.apache.maven.plugins</groupId>-->
- <!--<artifactId>maven-changelog-plugin</artifactId>-->
- <!--<version>???</version>-->
- <!--</plugin>-->
-
- </plugins>
-<!-- </pluginManagement>
- <plugins>
- </plugins>-->
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>taglist-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <!--<plugin>-->
- <!--<groupId>org.apache.maven.plugins</groupId>-->
- <!--<artifactId>maven-changelog-plugin</artifactId>-->
- <!--</plugin>-->
- </plugins>
- </reporting>
-
- <profiles>
- <profile>
- <id>fast</id>
- <properties>
- <maven.test.skip>true</maven.test.skip>
- </properties>
- </profile>
- </profiles>
-
<modules>
<module>datecalc-common</module>
<module>datecalc-jdk</module>
<module>datecalc-joda</module>
</modules>
-
- <repositories>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>springRichclientRepository</id>
- <name>Spring rich client repository</name>
- <url>http://spring-rich-c.sourceforge.net/maven2repository</url>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <!-- currently only needed to use jdepend report -->
- <pluginRepository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>codehaus-snapshots</id>
- <name>Snapshot repository from codehaus</name>
- <url>http://snapshots.maven.codehaus.org/maven2</url>
- </pluginRepository>
- </pluginRepositories>
-
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
</dependency>
- <!--
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- </dependency>
- -->
</dependencies>
<dependencyManagement>
@@ -395,146 +55,11 @@
<version>${pom.version}</version>
</dependency>
<dependency>
- <groupId>net.objectlab.kit.</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc-joda</artifactId>
<version>${pom.version}</version>
</dependency>
- <!--
- Declare all dependency versions and default scopes here, but not optional.
- Each module should declare it's direct dependency and possibily overwrite scope/optional.
- -->
-
- <!-- Internal
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-resources</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-resources</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-core</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-core</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-binding</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-binding</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-form</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-form</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-support</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-support</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-tiger</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-tiger</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-sandbox</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-sandbox</artifactId>
- <type>test-jar</type>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.richclient</groupId>
- <artifactId>spring-richclient-full</artifactId>
- <version>${pom.version}</version>
- <type>pom</type>
- </dependency>
--->
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.12</version>
- <scope>runtime</scope>
- <optional>true</optional>
- </dependency>
-
</dependencies>
</dependencyManagement>
- <distributionManagement>
- <repository>
- <id>shell.sourceforge.net</id>
- <url>
- scp://shell.sourceforge.net/home/groups/s/sp/spring-rich-c/htdocs/maven2repository
- </url>
- </repository>
- <site>
- <id>shell.sourceforge.net</id>
- <url>
- scp://shell.sourceforge.net/home/groups/s/sp/spring-rich-c/htdocs/
- </url>
- </site>
- <!-- Archive deployment -->
- <!--<site>-->
- <!--<id>shell.sourceforge.net</id>-->
- <!--<url>-->
- <!--scp://shell.sourceforge.net/home/groups/s/sp/spring-rich-c/htdocs/archive/${pom.version}/-->
- <!--</url>-->
- <!--</site>-->
- </distributionManagement>
-
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-08 13:17:31
|
Revision: 129
http://svn.sourceforge.net/objectlabkit/?rev=129&view=rev
Author: benoitx
Date: 2006-09-08 06:17:23 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
Use UK Holidays.
Modified Paths:
--------------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 13:14:46 UTC (rev 128)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 13:17:23 UTC (rev 129)
@@ -52,9 +52,18 @@
return getDateCalculatorFactory().getDateCalculator(name, type);
}
+ /**
+ * Based on UK Holidays for Aug 2006.
+ * @param startDate
+ * @param tenor
+ * @param daysToSpot
+ * @param expectedDate
+ * @param holidayHandlerType
+ */
protected void checkMoveByTenor(final String startDate, final Tenor tenor, final int daysToSpot, final String expectedDate,
- final String holidayHandlerType) {
+ final String holidayHandlerType) {
final DateCalculator<E> cal = newDateCalculator("bla", holidayHandlerType);
+ cal.setNonWorkingDays(createUKHolidays());
cal.setStartDate(newDate(startDate));
checkDate("Move start:" + startDate + " tenor:" + tenor + " daysToSpot:" + daysToSpot,
cal.moveByTenor(tenor, daysToSpot), expectedDate);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-08 13:15:03
|
Revision: 128
http://svn.sourceforge.net/objectlabkit/?rev=128&view=rev
Author: benoitx
Date: 2006-09-08 06:14:46 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
Slightly modify the moveByTenor interface and provide more tests for it. (I need to add more for Fwd,modifiedPreceeding and Backward) as well as SPOT tests.
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractBackwardDateCalculatorTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractForwardDateCalculatorTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedFollowingDateCalculatorTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedPreceedingDateCalculatorTest.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -100,14 +100,19 @@
* handler and not count towards the number of days to move.
*
* @param businessDays
+ * @param daysToSpot number of days to "spot" days, this can vary from one market to the other.
* @return the current businessCalendar (so one can do
* calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();)
*/
- public DateCalculator<E> moveByTenor(final Tenor tenor) {
+ public DateCalculator<E> moveByTenor(final Tenor tenor, final int daysToSpot) {
if (tenor == null) {
throw new IllegalArgumentException("Tenor cannot be null");
}
+
+ // get to the Spot date first:
+ moveByDays(daysToSpot);
+ // move by tenor
switch (tenor.getCode()) {
case DAY:
return moveByDays(tenor.getUnits());
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -145,7 +145,7 @@
*
* @param days
* number of days (can be <0 or >0)
- * @return the businessCalendar (so one can do
+ * @return the DateCalculator (so one can do
* calendar.moveByDays(-2).getCurrentBusinessDate();)
*/
DateCalculator<E> moveByDays(final int days);
@@ -159,7 +159,7 @@
*
* @param businessDays
* (can be <0 or >0)
- * @return the current businessCalendar (so one can do
+ * @return the current DateCalculator (so one can do
* calendar.moveByBusinessDays(2).getCurrentBusinessDate();)
* @exception IllegalArgumentException
* if the HolidayHandlerType is (MODIFIED_PRECEEDING or
@@ -183,13 +183,14 @@
DateCalculator<E> combine(DateCalculator<E> calculator);
/**
- * move the current date by a given tenor, this means that if a date is
- * either a 'weekend' or holiday, it will be skipped acording to the holiday
- * handler and not count towards the number of days to move.
+ * Move the current date by a given tenor, please note that all tenors are relative to
+ * the SPOT day which is a number of days from the current date. This method therefore,
+ * calculates the SPOT day first, moves it if it falls on a holiday and then goes to the
+ * calculated day according to the Tenor.
*
- * @param businessDays
- * @return the current businessCalendar (so one can do
- * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();)
+ * @param tenor the Tenor to reach.
+ * @param daysToSpot number of days to "spot" days, this can vary from one market to the other.
+ * @return the current DateCalculator
*/
- DateCalculator<E> moveByTenor(final Tenor tenor);
+ DateCalculator<E> moveByTenor(final Tenor tenor, final int daysToSpot);
}
\ No newline at end of file
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractBackwardDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractBackwardDateCalculatorTest.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractBackwardDateCalculatorTest.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -203,32 +203,17 @@
}
public void testMoveByTenorDays() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.BACKWARD);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1D", cal.moveByTenor(StandardTenor.T_1D), "2006-08-09");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2D", cal.moveByTenor(new Tenor(2, TenorCode.DAY)), "2006-08-10");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 10D", cal.moveByTenor(new Tenor(10, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 11D", cal.moveByTenor(new Tenor(11, TenorCode.DAY)), "2006-08-18");
-
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 0, "2006-08-09", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 0, "2006-08-10", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(10, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(11, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(12, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(13, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.BACKWARD);
}
public void testMoveByTenorWeek() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.BACKWARD);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1W", cal.moveByTenor(StandardTenor.T_1W), "2006-08-15");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2W", cal.moveByTenor(new Tenor(2, TenorCode.WEEK)), "2006-08-22");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05");
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 0, "2006-08-15", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 0, "2006-08-22", HolidayHandlerType.BACKWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 0, "2006-09-05", HolidayHandlerType.BACKWARD);
}
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateTestCase.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -51,4 +51,13 @@
protected DateCalculator<E> newDateCalculator(final String name, final String type) {
return getDateCalculatorFactory().getDateCalculator(name, type);
}
+
+ protected void checkMoveByTenor(final String startDate, final Tenor tenor, final int daysToSpot, final String expectedDate,
+ final String holidayHandlerType) {
+ final DateCalculator<E> cal = newDateCalculator("bla", holidayHandlerType);
+ cal.setStartDate(newDate(startDate));
+ checkDate("Move start:" + startDate + " tenor:" + tenor + " daysToSpot:" + daysToSpot,
+ cal.moveByTenor(tenor, daysToSpot), expectedDate);
+ }
+
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractForwardDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractForwardDateCalculatorTest.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractForwardDateCalculatorTest.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -193,32 +193,17 @@
}
public void testMoveByTenorDays() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.FORWARD);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1D", cal.moveByTenor(StandardTenor.T_1D), "2006-08-09");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2D", cal.moveByTenor(new Tenor(2, TenorCode.DAY)), "2006-08-10");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 10D", cal.moveByTenor(new Tenor(10, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 11D", cal.moveByTenor(new Tenor(11, TenorCode.DAY)), "2006-08-21");
-
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 0, "2006-08-09", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 0, "2006-08-10", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(10, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(11, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(12, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(13, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.FORWARD);
}
public void testMoveByTenorWeek() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.FORWARD);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1W", cal.moveByTenor(StandardTenor.T_1W), "2006-08-15");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2W", cal.moveByTenor(new Tenor(2, TenorCode.WEEK)), "2006-08-22");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05");
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 0, "2006-08-15", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 0, "2006-08-22", HolidayHandlerType.FORWARD);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 0, "2006-09-05", HolidayHandlerType.FORWARD);
}
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedFollowingDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedFollowingDateCalculatorTest.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedFollowingDateCalculatorTest.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -194,33 +194,48 @@
}
public void testMoveByTenorDays() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 0, "2006-08-09", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 0, "2006-08-10", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(10, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(11, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(12, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(13, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ }
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1D", cal.moveByTenor(StandardTenor.T_1D), "2006-08-09");
+ public void testMoveByTenorDaysOneDayToSpot() {
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 1, "2006-08-10", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 1, "2006-08-11", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(10, TenorCode.DAY), 1, "2006-08-18", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(11, TenorCode.DAY), 1, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(12, TenorCode.DAY), 1, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(13, TenorCode.DAY), 1, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ }
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2D", cal.moveByTenor(new Tenor(2, TenorCode.DAY)), "2006-08-10");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 10D", cal.moveByTenor(new Tenor(10, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 11D", cal.moveByTenor(new Tenor(11, TenorCode.DAY)), "2006-08-21");
-
+ public void testMoveByTenorDaysTwoDaysToSpot() {
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 2, "2006-08-11", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 2, "2006-08-14", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(10, TenorCode.DAY), 2, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(11, TenorCode.DAY), 2, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(12, TenorCode.DAY), 2, "2006-08-21", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-07", new Tenor(13, TenorCode.DAY), 2, "2006-08-22", HolidayHandlerType.MODIFIED_FOLLLOWING);
}
public void testMoveByTenorWeek() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 0, "2006-08-15", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 0, "2006-08-22", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 0, "2006-09-05", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ }
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1W", cal.moveByTenor(StandardTenor.T_1W), "2006-08-15");
+ public void testMoveByTenorWeekOneDayToSpot() {
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 1, "2006-08-16", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 1, "2006-08-23", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 1, "2006-09-06", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ }
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2W", cal.moveByTenor(new Tenor(2, TenorCode.WEEK)), "2006-08-22");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05");
+ public void testMoveByTenorWeekTwoDaysToSpot() {
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 2, "2006-08-17", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 2, "2006-08-24", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 2, "2006-09-07", HolidayHandlerType.MODIFIED_FOLLLOWING);
}
public void testAddAcrossMonth() {
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedPreceedingDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedPreceedingDateCalculatorTest.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractModifiedPreceedingDateCalculatorTest.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -206,39 +206,18 @@
}
public void testMoveByTenorDays() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.MODIFIED_PRECEEDING);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1D", cal.moveByTenor(StandardTenor.T_1D), "2006-08-09");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2D", cal.moveByTenor(new Tenor(2, TenorCode.DAY)), "2006-08-10");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 10D", cal.moveByTenor(new Tenor(10, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 11D", cal.moveByTenor(new Tenor(11, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 12D", cal.moveByTenor(new Tenor(12, TenorCode.DAY)), "2006-08-18");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 13D", cal.moveByTenor(new Tenor(13, TenorCode.DAY)), "2006-08-21");
-
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1D, 0, "2006-08-09", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.DAY), 0, "2006-08-10", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(10, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(11, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(12, TenorCode.DAY), 0, "2006-08-18", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(13, TenorCode.DAY), 0, "2006-08-21", HolidayHandlerType.MODIFIED_PRECEEDING);
}
public void testMoveByTenorWeek() {
- final DateCalculator<E> cal = newDateCalculator("bla", HolidayHandlerType.MODIFIED_PRECEEDING);
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 1W", cal.moveByTenor(StandardTenor.T_1W), "2006-08-15");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 2W", cal.moveByTenor(new Tenor(2, TenorCode.WEEK)), "2006-08-22");
-
- cal.setStartDate(newDate("2006-08-08"));
- checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05");
+ checkMoveByTenor("2006-08-08", StandardTenor.T_1W, 0, "2006-08-15", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(2, TenorCode.WEEK), 0, "2006-08-22", HolidayHandlerType.MODIFIED_PRECEEDING);
+ checkMoveByTenor("2006-08-08", new Tenor(4, TenorCode.WEEK), 0, "2006-09-05", HolidayHandlerType.MODIFIED_PRECEEDING);
}
public void testAddAcrossMonth() {
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-08 13:14:46 UTC (rev 128)
@@ -24,7 +24,6 @@
import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandler;
-import net.objectlab.kit.datecalc.common.Tenor;
import net.objectlab.kit.datecalc.common.Utils;
import net.objectlab.kit.datecalc.common.WorkingWeek;
@@ -94,23 +93,18 @@
final HolidayHandler<Calendar> handler) {
return new JdkCalendarBaseDateCalculator(name, startDate, holidays, handler);
}
-
+/*
+ * @Override public JdkCalendarBaseDateCalculator combine(final DateCalculator<Calendar>
+ * calendar) { return (JdkCalendarBaseDateCalculator) super.combine(calendar); }
+ *
+ * @Override public JdkCalendarBaseDateCalculator moveByTenor(final Tenor tenor) {
+ * return (JdkCalendarBaseDateCalculator) super.moveByTenor(tenor); }
+ *
+ * @Override public JdkCalendarBaseDateCalculator moveByBusinessDays(final int
+ * businessDays) { return (JdkCalendarBaseDateCalculator)
+ * super.moveByBusinessDays(businessDays); }
+ */
@Override
- public JdkCalendarBaseDateCalculator combine(final DateCalculator<Calendar> calendar) {
- return (JdkCalendarBaseDateCalculator) super.combine(calendar);
- }
-
- @Override
- public JdkCalendarBaseDateCalculator moveByTenor(final Tenor tenor) {
- return (JdkCalendarBaseDateCalculator) super.moveByTenor(tenor);
- }
-
- @Override
- public JdkCalendarBaseDateCalculator moveByBusinessDays(final int businessDays) {
- return (JdkCalendarBaseDateCalculator) super.moveByBusinessDays(businessDays);
- }
-
- @Override
protected Calendar getToday() {
return Utils.blastTime(Calendar.getInstance());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-08 11:22:31
|
Revision: 127
http://svn.sourceforge.net/objectlabkit/?rev=127&view=rev
Author: benoitx
Date: 2006-09-08 04:22:24 -0700 (Fri, 08 Sep 2006)
Log Message:
-----------
Removed 2 unnecessary interfaces in JDK.
Modified Paths:
--------------
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculator.java
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java 2006-09-07 17:34:27 UTC (rev 126)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
@@ -20,6 +20,7 @@
import java.util.Date;
import net.objectlab.kit.datecalc.common.PeriodCountBasis;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
import net.objectlab.kit.datecalc.common.Utils;
/**
@@ -30,7 +31,7 @@
* @version $Revision$ $Date$
*
*/
-public class DatePeriodCountCalculator implements JdkDatePeriodCountCalculator {
+public class DatePeriodCountCalculator implements PeriodCountCalculator<Date> {
private static final CalendarPeriodCountCalculator PCC = new CalendarPeriodCountCalculator();
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-07 17:34:27 UTC (rev 126)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-08 11:22:24 UTC (rev 127)
@@ -23,6 +23,7 @@
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
import net.objectlab.kit.datecalc.common.IMMDateCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
/**
* TODO add javadoc
@@ -36,7 +37,7 @@
private static final DefaultJdkCalendarCalculatorFactory DEFAULT = new DefaultJdkCalendarCalculatorFactory();
- private static final CalendarPeriodCountCalculator PCC = new CalendarPeriodCountCalculator();
+ private static final PeriodCountCalculator<Calendar> PCC = new CalendarPeriodCountCalculator();
private static final JdkCalendarIMMDateCalculator IMMDC = new JdkCalendarIMMDateCalculator();
@@ -77,7 +78,7 @@
*
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
*/
- public CalendarPeriodCountCalculator getPeriodCountCalculator() {
+ public PeriodCountCalculator<Calendar> getPeriodCountCalculator() {
return PCC;
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-07 17:34:27 UTC (rev 126)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-08 11:22:24 UTC (rev 127)
@@ -23,6 +23,7 @@
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
import net.objectlab.kit.datecalc.common.IMMDateCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
/**
* TODO add javadoc
@@ -36,7 +37,7 @@
private static final DefaultJdkDateCalculatorFactory DEFAULT = new DefaultJdkDateCalculatorFactory();
- private static final JdkDatePeriodCountCalculator PCC = new DatePeriodCountCalculator();
+ private static final PeriodCountCalculator<Date> PCC = new DatePeriodCountCalculator();
private static final JdkDateIMMDateCalculator IMMDC = new JdkDateIMMDateCalculator();
@@ -77,7 +78,7 @@
*
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
*/
- public JdkDatePeriodCountCalculator getPeriodCountCalculator() {
+ public PeriodCountCalculator<Date> getPeriodCountCalculator() {
return PCC;
}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java 2006-09-07 17:34:27 UTC (rev 126)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
@@ -1,9 +0,0 @@
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-
-public interface JdkCalendarPeriodCountCalculator extends PeriodCountCalculator<Date> {
-
-}
\ No newline at end of file
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculator.java 2006-09-07 17:34:27 UTC (rev 126)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculator.java 2006-09-08 11:22:24 UTC (rev 127)
@@ -1,9 +0,0 @@
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-
-public interface JdkDatePeriodCountCalculator extends PeriodCountCalculator<Date> {
-
-}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-07 17:34:48
|
Revision: 126
http://svn.sourceforge.net/objectlabkit/?rev=126&view=rev
Author: benoitx
Date: 2006-09-07 10:34:27 -0700 (Thu, 07 Sep 2006)
Log Message:
-----------
Found a "nice" way to include the common classes as a JAR in the JDK and JODA jars.
Modified Paths:
--------------
trunk/datecalc-jdk/maven.xml
trunk/datecalc-jdk/project.xml
trunk/datecalc-joda/maven.xml
trunk/datecalc-joda/project.xml
Added Paths:
-----------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactoryTest.java
Modified: trunk/datecalc-jdk/maven.xml
===================================================================
--- trunk/datecalc-jdk/maven.xml 2006-09-07 17:24:20 UTC (rev 125)
+++ trunk/datecalc-jdk/maven.xml 2006-09-07 17:34:27 UTC (rev 126)
@@ -15,6 +15,7 @@
<goal name="kit:rebuild" prereqs="clean,kit:build" />
<goal name="kit:build" prereqs="jar:jar">
+ <!--
<echo>ADD Common to full JAR</echo>
<ant:jar basedir="target/classes"
jarfile="${maven.build.dir}/${pom.artifactId}-full-${pom.currentVersion}.jar"
@@ -22,6 +23,6 @@
<fileset dir="${basedir}/../datecalc-common/target/classes"
excludes="**/Test.class" includes="**/*.class" />
</ant:jar>
-
+ -->
</goal>
</project>
Modified: trunk/datecalc-jdk/project.xml
===================================================================
--- trunk/datecalc-jdk/project.xml 2006-09-07 17:24:20 UTC (rev 125)
+++ trunk/datecalc-jdk/project.xml 2006-09-07 17:34:27 UTC (rev 126)
@@ -56,6 +56,15 @@
</resource>
</resources>
</unitTest>
+ <resources>
+ <resource>
+ <directory>../datecalc-common/target/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </resource>
+ </resources>
</build>
</project>
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactoryTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactoryTest.java 2006-09-07 17:34:27 UTC (rev 126)
@@ -0,0 +1,20 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactoryTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarCalculatorFactoryTest extends AbstractDateCalculatorFactoryTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<Calendar> getDateCalculatorFactory() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance();
+ }
+}
Modified: trunk/datecalc-joda/maven.xml
===================================================================
--- trunk/datecalc-joda/maven.xml 2006-09-07 17:24:20 UTC (rev 125)
+++ trunk/datecalc-joda/maven.xml 2006-09-07 17:34:27 UTC (rev 126)
@@ -15,6 +15,7 @@
<goal name="kit:rebuild" prereqs="clean,kit:build" />
<goal name="kit:build" prereqs="jar:jar">
+<!--
<echo>ADD Common classes to full JAR</echo>
<ant:jar basedir="target/classes"
@@ -23,6 +24,6 @@
<fileset dir="${basedir}/../datecalc-common/target/classes"
excludes="**/Test.class" includes="**/*.class" />
</ant:jar>
-
+-->
</goal>
</project>
Modified: trunk/datecalc-joda/project.xml
===================================================================
--- trunk/datecalc-joda/project.xml 2006-09-07 17:24:20 UTC (rev 125)
+++ trunk/datecalc-joda/project.xml 2006-09-07 17:34:27 UTC (rev 126)
@@ -57,5 +57,14 @@
</resource>
</resources>
</unitTest>
+ <resources>
+ <resource>
+ <directory>../datecalc-common/target/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </resource>
+ </resources>
</build>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-07 17:24:55
|
Revision: 125
http://svn.sourceforge.net/objectlabkit/?rev=125&view=rev
Author: benoitx
Date: 2006-09-07 10:24:20 -0700 (Thu, 07 Sep 2006)
Log Message:
-----------
Added more tests to JDK and Joda for factory tests (genericesed ie). That spotted a couple of bugs!
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java
trunk/datecalc-joda/.classpath
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
Added Paths:
-----------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateCalculatorFactoryTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayCalculatorFactoryTest.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/AbstractDateCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -61,9 +61,14 @@
}
public E getStartDate() {
+ if (startDate == null) {
+ startDate = getToday();
+ }
return startDate;
}
+ protected abstract E getToday();
+
/** Set both start date and current date */
public void setStartDate(final E startDate) {
this.startDate = startDate;
@@ -71,6 +76,9 @@
}
public E getCurrentBusinessDate() {
+ if (currentBusinessDate == null) {
+ currentBusinessDate = getToday();
+ }
return currentBusinessDate;
}
@@ -127,6 +135,9 @@
}
public boolean isCurrentDateNonWorking() {
+ if (currentBusinessDate == null) {
+ currentBusinessDate = getToday();
+ }
return isNonWorkingDay(currentBusinessDate);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -47,7 +47,7 @@
public void registerHolidays(final String name, final Set<E> holidaysSet) {
this.holidays.put(name, holidaysSet);
}
-
+
protected void setHolidays(final String name, final DateCalculator<E> dc) {
if (holidays.containsKey(name)) {
dc.setNonWorkingDays(holidays.get(name));
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -45,8 +45,10 @@
* holidays with that name, it will return a DateCalculator with
* an empty holiday set (will work on Weekend only).
* @param type
- * typically one of the value of HolidayHandlerType
+ * typically one of the value of HolidayHandlerType or null.
* @return a new DateCalculator
+ * @exception IllegalArgumentException
+ * if the type is not null or a valid value.
*/
DateCalculator<E> getDateCalculator(final String name, final String holidayHandlerType);
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -48,8 +48,12 @@
}
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
+ return blastTime(cal);
+ }
+
+ public static Calendar blastTime(final Calendar cal) {
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
- cal.set(Calendar.HOUR, 0);
+ cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
@@ -59,12 +63,15 @@
/**
*
* @param str
- * string
- * @return
+ * string (return today if string is null)
+ * @return today if
* @throws IllegalArgumentException
* if the string cannot be parsed.
*/
public static Date createDate(final String str) {
+ if (str == null) {
+ return createCalendar(null).getTime();
+ }
try {
final Date date = SDF.parse(str);
final Calendar cal = getCal(date);
@@ -83,6 +90,9 @@
* if the string cannot be parsed.
*/
public static Calendar createCalendar(final String str) {
+ if (str == null) {
+ return blastTime(Calendar.getInstance());
+ }
try {
final Date date = SDF.parse(str);
final Calendar cal = getCal(date);
Added: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java (rev 0)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -0,0 +1,111 @@
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Set;
+
+import junit.framework.Assert;
+
+public abstract class AbstractDateCalculatorFactoryTest<E> extends AbstractDateTestCase<E> {
+
+ public void testGetCalendarsNoHoliday() {
+ final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
+ Assert.assertNotNull("cal1", cal1);
+ Assert.assertEquals("name", "bla", cal1.getName());
+ Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
+
+ final DateCalculator<E> cal2 = getDateCalculatorFactory().getDateCalculator("bla", null);
+ Assert.assertNotNull("cal2", cal2);
+ Assert.assertEquals("name", "bla", cal2.getName());
+ Assert.assertTrue("no holiday", cal2.getNonWorkingDays().isEmpty());
+ Assert.assertNotSame(cal1, cal2);
+ }
+
+ public void testGetCalendarsNoHolidayButSomeRegistered() {
+ final Set<E> uk = createUKHolidays();
+ getDateCalculatorFactory().registerHolidays("UK", uk);
+
+ final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
+ Assert.assertNotNull("cal1", cal1);
+ Assert.assertEquals("name", "bla", cal1.getName());
+ Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
+
+ final DateCalculator<E> cal2 = getDateCalculatorFactory().getDateCalculator("UK", null);
+ Assert.assertNotNull("cal2", cal2);
+ Assert.assertEquals("name cal2", "UK", cal2.getName());
+ Assert.assertEquals("UK holidays", 4, cal2.getNonWorkingDays().size());
+ Assert.assertNotSame(cal1, cal2);
+ }
+
+ public void testGetCorrectAlgo() {
+ DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
+
+ Assert.assertNull("No algo", cal1.getHolidayHandlerType());
+ cal1 = getDateCalculatorFactory().getDateCalculator("bla", HolidayHandlerType.BACKWARD);
+ Assert.assertEquals("Type", HolidayHandlerType.BACKWARD, cal1.getHolidayHandlerType());
+
+ cal1 = getDateCalculatorFactory().getDateCalculator("bla", HolidayHandlerType.FORWARD);
+ Assert.assertEquals("Type", HolidayHandlerType.FORWARD, cal1.getHolidayHandlerType());
+
+ cal1 = getDateCalculatorFactory().getDateCalculator("bla", HolidayHandlerType.MODIFIED_FOLLLOWING);
+ Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_FOLLLOWING, cal1.getHolidayHandlerType());
+
+ cal1 = getDateCalculatorFactory().getDateCalculator("bla", HolidayHandlerType.MODIFIED_PRECEEDING);
+ Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_PRECEEDING, cal1.getHolidayHandlerType());
+ }
+
+ public void testGetIncorrectAlgo() {
+ try {
+ getDateCalculatorFactory().getDateCalculator("bla", "bliobl");
+ fail("Should have thrown UnsupportedOperationException");
+ } catch (final IllegalArgumentException e) {
+ // all ok
+ }
+ }
+
+ public void testSetHol() {
+ final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
+
+ Assert.assertNotNull("No algo", cal1);
+ Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
+ Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
+
+ cal1.setNonWorkingDays(null);
+ Assert.assertNotNull("empty", cal1.getNonWorkingDays());
+ Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
+ }
+
+ public void testUseDefault() {
+ final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
+
+ Assert.assertNotNull("No algo", cal1);
+ Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
+ Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
+
+ E date = cal1.moveByDays(0).getCurrentBusinessDate();
+ Assert.assertEquals("default today", newDate(null), date);
+
+ cal1.setStartDate(null);
+ date = cal1.moveByDays(0).getCurrentBusinessDate();
+ Assert.assertEquals("default today", newDate(null), date);
+
+ cal1.setStartDate(newDate("2006-08-08"));
+ cal1.setCurrentBusinessDate(null);
+ date = cal1.moveByDays(0).getCurrentBusinessDate();
+ Assert.assertEquals("default today", newDate(null), date);
+ }
+
+ public void testHolNoAlgo() {
+ final Set<E> uk = createUKHolidays();
+ getDateCalculatorFactory().registerHolidays("UK", uk);
+ final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("UK", null);
+
+ Assert.assertNotNull("No algo", cal1);
+ Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
+ Assert.assertTrue("non empty hol", !cal1.getNonWorkingDays().isEmpty());
+
+ cal1.setCurrentBusinessDate(newDate("2006-12-25"));
+ Assert.assertTrue("current date is holiday", cal1.isCurrentDateNonWorking());
+
+ cal1.setCurrentBusinessDate(newDate("2006-12-24"));
+ Assert.assertTrue("current date is weekend", cal1.isCurrentDateNonWorking());
+ }
+}
Added: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorTest.java (rev 0)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -0,0 +1,35 @@
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractDateCalculatorTest extends TestCase {
+
+ public AbstractDateCalculatorTest() {
+ super();
+ }
+
+ protected Date createDate(final String str) {
+ return Utils.createDate(str);
+ }
+
+ protected Set<Date> createUKHolidays() {
+ final Set<Date> uk = new HashSet<Date>();
+ uk.add(createDate("2006-01-01"));
+ uk.add(createDate("2006-08-28"));
+ uk.add(createDate("2006-12-25"));
+ uk.add(createDate("2006-12-26"));
+ return uk;
+ }
+
+ protected Set<Date> createUSHolidays() {
+ final Set<Date> us = new HashSet<Date>();
+ us.add(createDate("2006-07-04"));
+ us.add(createDate("2006-11-28"));
+ us.add(createDate("2006-12-25"));
+ return us;
+ }
+}
\ No newline at end of file
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -66,7 +66,7 @@
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
cal.setHolidayHandler(new CalendarModifiedPreceedingHandler());
} else {
- throw new UnsupportedOperationException("Unsupported HolidayHandler: " + holidayHandlerType);
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
}
return cal;
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -66,7 +66,7 @@
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
cal.setHolidayHandler(new DateModifiedPreceedingHandler());
} else {
- throw new UnsupportedOperationException("Unsupported HolidayHandler: " + holidayHandlerType);
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
}
return cal;
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -25,6 +25,7 @@
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandler;
import net.objectlab.kit.datecalc.common.Tenor;
+import net.objectlab.kit.datecalc.common.Utils;
import net.objectlab.kit.datecalc.common.WorkingWeek;
/**
@@ -48,7 +49,11 @@
public JdkCalendarBaseDateCalculator(final String name, final Calendar startDate, final Set<Calendar> nonWorkingDays,
final HolidayHandler<Calendar> holidayHandler) {
super(name, nonWorkingDays, holidayHandler);
- setStartDate(startDate);
+ Calendar date = startDate;
+ if (date == null) {
+ date = getToday();
+ }
+ setStartDate(date);
}
public void setWorkingWeek(final WorkingWeek week) {
@@ -104,4 +109,9 @@
public JdkCalendarBaseDateCalculator moveByBusinessDays(final int businessDays) {
return (JdkCalendarBaseDateCalculator) super.moveByBusinessDays(businessDays);
}
+
+ @Override
+ protected Calendar getToday() {
+ return Utils.blastTime(Calendar.getInstance());
+ }
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -49,13 +49,17 @@
public JdkDateBaseDateCalculator(final String name, final Date startDate, final Set<Date> nonWorkingDays,
final HolidayHandler<Date> holidayHandler) {
super(name, nonWorkingDays, holidayHandler);
-
+ Date date = startDate;
final HolidayHandler<Calendar> locDate = new HolidayHandlerDateWrapper(holidayHandler, this);
final Set<Calendar> nonWorkingCalendars = Utils.toCalendarSet(nonWorkingDays);
- delegate = new JdkCalendarBaseDateCalculator(name, Utils.getCal(startDate), nonWorkingCalendars, locDate);
- setStartDate(startDate);
- delegate.setStartDate(Utils.getCal(startDate));
+ if (date == null) {
+ date = getToday();
+ }
+
+ delegate = new JdkCalendarBaseDateCalculator(name, Utils.getCal(date), nonWorkingCalendars, locDate);
+ delegate.setStartDate(Utils.getCal(date));
+ setStartDate(date);
}
// TODO throw an exception if the type is incorrect
@@ -67,7 +71,7 @@
* is the date a non-working day according to the WorkingWeek?
*/
public boolean isWeekend(final Date date) {
- if (date != null) {
+ if (date != null && delegate != null) {
return delegate.isWeekend(Utils.getCal(date));
}
return false;
@@ -92,4 +96,9 @@
}
super.setStartDate(startDate);
}
+
+ @Override
+ protected Date getToday() {
+ return Utils.blastTime(Calendar.getInstance()).getTime();
+ }
}
Deleted: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -1,36 +0,0 @@
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-import net.objectlab.kit.datecalc.common.Utils;
-
-public abstract class AbstractDateCalculatorTest extends TestCase {
-
- public AbstractDateCalculatorTest() {
- super();
- }
-
- protected Date createDate(final String str) {
- return Utils.createDate(str);
- }
-
- protected Set<Date> createUKHolidays() {
- final Set<Date> uk = new HashSet<Date>();
- uk.add(createDate("2006-01-01"));
- uk.add(createDate("2006-08-28"));
- uk.add(createDate("2006-12-25"));
- uk.add(createDate("2006-12-26"));
- return uk;
- }
-
- protected Set<Date> createUSHolidays() {
- final Set<Date> us = new HashSet<Date>();
- us.add(createDate("2006-07-04"));
- us.add(createDate("2006-11-28"));
- us.add(createDate("2006-12-25"));
- return us;
- }
-}
\ No newline at end of file
Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -1,60 +1,20 @@
package net.objectlab.kit.datecalc.jdk;
import java.util.Date;
-import java.util.Set;
-import junit.framework.Assert;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactoryTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
-public class DateCalculatorFactoryTest extends AbstractDateCalculatorTest {
+public class DateCalculatorFactoryTest extends AbstractDateCalculatorFactoryTest<Date> {
- public void testGetCalendarsNoHoliday() {
- final DateCalculator<Date> cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null);
- Assert.assertNotNull("cal1", cal1);
- Assert.assertEquals("name", "bla", cal1.getName());
- Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
-
- final DateCalculator<Date> cal2 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null);
- Assert.assertNotNull("cal2", cal2);
- Assert.assertEquals("name", "bla", cal2.getName());
- Assert.assertTrue("no holiday", cal2.getNonWorkingDays().isEmpty());
- Assert.assertNotSame(cal1, cal2);
+ @Override
+ protected Date newDate(final String date) {
+ return Utils.createDate(date);
}
- public void testGetCalendarsNoHolidayButSomeRegistered() {
- final Set<Date> uk = createUKHolidays();
- DefaultJdkDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", uk);
-
- final DateCalculator<Date> cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null);
- Assert.assertNotNull("cal1", cal1);
- Assert.assertEquals("name", "bla", cal1.getName());
- Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
-
- final DateCalculator<Date> cal2 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", null);
- Assert.assertNotNull("cal2", cal2);
- Assert.assertEquals("name cal2", "UK", cal2.getName());
- Assert.assertEquals("UK holidays", 4, cal2.getNonWorkingDays().size());
- Assert.assertNotSame(cal1, cal2);
+ @Override
+ protected DateCalculatorFactory<Date> getDateCalculatorFactory() {
+ return DefaultJdkDateCalculatorFactory.getDefaultInstance();
}
-
- public void testGetCorrectAlgo() {
- DateCalculator<Date> cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null);
-
- Assert.assertNull("No algo", cal1.getHolidayHandlerType());
- cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD);
- Assert.assertEquals("Type", HolidayHandlerType.BACKWARD, cal1.getHolidayHandlerType());
-
- cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD);
- Assert.assertEquals("Type", HolidayHandlerType.FORWARD, cal1.getHolidayHandlerType());
-
- cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- HolidayHandlerType.MODIFIED_FOLLLOWING);
- Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_FOLLLOWING, cal1.getHolidayHandlerType());
-
- cal1 = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- HolidayHandlerType.MODIFIED_PRECEEDING);
- Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_PRECEEDING, cal1.getHolidayHandlerType());
-
- }
}
Modified: trunk/datecalc-joda/.classpath
===================================================================
--- trunk/datecalc-joda/.classpath 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/.classpath 2006-09-07 17:24:20 UTC (rev 125)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.3/joda-time-1.3.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/datecalc-common"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry path="src/main/java" kind="src"/>
+ <classpathentry path="src/test/java" output="target/test-classes" kind="src"/>
+ <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>
+ <classpathentry sourcepath="/JODA_TIME_SRC" path="M2_REPO/joda-time/joda-time/1.3/joda-time-1.3.jar" kind="var"/>
+ <classpathentry path="/datecalc-common" combineaccessrules="false" kind="src"/>
+ <classpathentry path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" kind="var"/>
+ <classpathentry path="target/classes" kind="output"/>
</classpath>
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -58,6 +58,8 @@
cal.setHolidayHandler(new LocalDateModifiedFollowingHandler());
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
cal.setHolidayHandler(new LocalDateModifiedPreceedingHandler());
+ } else if (holidayHandlerType != null) {
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
}
return cal;
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -60,6 +60,8 @@
cal.setHolidayHandler(new YearMonthDayModifiedFollowingHandler());
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
cal.setHolidayHandler(new YearMonthDayModifiedPreceedingHandler());
+ } else if (holidayHandlerType != null) {
+ throw new IllegalArgumentException("Unsupported HolidayHandler: " + holidayHandlerType);
}
return cal;
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -88,4 +88,9 @@
final Set<LocalDate> holidays, final HolidayHandler<LocalDate> handler) {
return new LocalDateCalculator(name, startDate, holidays, handler);
}
+
+ @Override
+ protected LocalDate getToday() {
+ return new LocalDate();
+ }
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -67,7 +67,7 @@
* is the date a non-working day according to the WorkingWeek?
*/
public boolean isWeekend(final YearMonthDay date) {
- if (date != null) {
+ if (date != null && delegate != null) {
return delegate.isWeekend(date.toLocalDate());
}
return false;
@@ -92,4 +92,9 @@
}
super.setStartDate(startDate);
}
+
+ @Override
+ protected YearMonthDay getToday() {
+ return new YearMonthDay();
+ }
}
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/AbstractDateCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/AbstractDateCalculatorTest.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/AbstractDateCalculatorTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -1,32 +0,0 @@
-package net.objectlab.kit.datecalc.joda;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.joda.time.LocalDate;
-
-public abstract class AbstractDateCalculatorTest extends TestCase {
-
- public AbstractDateCalculatorTest() {
- super();
- }
-
- protected Set<LocalDate> createUKHolidays() {
- final Set<LocalDate> uk = new HashSet<LocalDate>();
- uk.add(new LocalDate("2006-01-01"));
- uk.add(new LocalDate("2006-08-28"));
- uk.add(new LocalDate("2006-12-25"));
- uk.add(new LocalDate("2006-12-26"));
- return uk;
- }
-
- protected Set<LocalDate> createUSHolidays() {
- final Set<LocalDate> us = new HashSet<LocalDate>();
- us.add(new LocalDate("2006-07-04"));
- us.add(new LocalDate("2006-11-28"));
- us.add(new LocalDate("2006-12-25"));
- return us;
- }
-}
\ No newline at end of file
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java 2006-09-07 14:48:06 UTC (rev 124)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -1,117 +0,0 @@
-package net.objectlab.kit.datecalc.joda;
-
-import java.util.Set;
-
-import junit.framework.Assert;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-
-import org.joda.time.LocalDate;
-
-public class DateCalculatorFactoryTest extends AbstractDateCalculatorTest {
-
- public void testGetCalendarsNoHoliday() {
- final DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- null);
- Assert.assertNotNull("cal1", cal1);
- Assert.assertEquals("name", "bla", cal1.getName());
- Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
-
- final DateCalculator<LocalDate> cal2 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- null);
- Assert.assertNotNull("cal2", cal2);
- Assert.assertEquals("name", "bla", cal2.getName());
- Assert.assertTrue("no holiday", cal2.getNonWorkingDays().isEmpty());
- Assert.assertNotSame(cal1, cal2);
- }
-
- public void testGetCalendarsNoHolidayButSomeRegistered() {
- final Set<LocalDate> uk = createUKHolidays();
- DefaultLocalDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", uk);
-
- final DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- null);
- Assert.assertNotNull("cal1", cal1);
- Assert.assertEquals("name", "bla", cal1.getName());
- Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty());
-
- final DateCalculator<LocalDate> cal2 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK",
- null);
- Assert.assertNotNull("cal2", cal2);
- Assert.assertEquals("name cal2", "UK", cal2.getName());
- Assert.assertEquals("UK holidays", 4, cal2.getNonWorkingDays().size());
- Assert.assertNotSame(cal1, cal2);
- }
-
- public void testGetCorrectAlgo() {
- DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null);
-
- Assert.assertNull("No algo", cal1.getHolidayHandlerType());
- cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD);
- Assert.assertEquals("Type", HolidayHandlerType.BACKWARD, cal1.getHolidayHandlerType());
-
- cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD);
- Assert.assertEquals("Type", HolidayHandlerType.FORWARD, cal1.getHolidayHandlerType());
-
- cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- HolidayHandlerType.MODIFIED_FOLLLOWING);
- Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_FOLLLOWING, cal1.getHolidayHandlerType());
-
- cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- HolidayHandlerType.MODIFIED_PRECEEDING);
- Assert.assertEquals("Type", HolidayHandlerType.MODIFIED_PRECEEDING, cal1.getHolidayHandlerType());
-
- }
-
- public void testSetHol() {
- final DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- null);
-
- Assert.assertNotNull("No algo", cal1);
- Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
- Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
-
- cal1.setNonWorkingDays(null);
- Assert.assertNotNull("empty", cal1.getNonWorkingDays());
- Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
- }
-
- public void testUseDefault() {
- final DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla",
- null);
-
- Assert.assertNotNull("No algo", cal1);
- Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
- Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty());
-
- LocalDate date = cal1.moveByDays(0).getCurrentBusinessDate();
- Assert.assertEquals("default today", new LocalDate(), date);
-
- cal1.setStartDate(null);
- date = cal1.moveByDays(0).getCurrentBusinessDate();
- Assert.assertEquals("default today", new LocalDate(), date);
-
- cal1.setStartDate(new LocalDate("2006-08-08"));
- cal1.setCurrentBusinessDate(null);
- date = cal1.moveByDays(0).getCurrentBusinessDate();
- Assert.assertEquals("default today", new LocalDate(), date);
- }
-
- public void testHolNoAlgo() {
- final Set<LocalDate> uk = createUKHolidays();
- DefaultLocalDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", uk);
- final DateCalculator<LocalDate> cal1 = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK",
- null);
-
- Assert.assertNotNull("No algo", cal1);
- Assert.assertNotNull("No hol", cal1.getNonWorkingDays());
- Assert.assertTrue("non empty hol", !cal1.getNonWorkingDays().isEmpty());
-
- cal1.setCurrentBusinessDate(new LocalDate("2006-12-25"));
- Assert.assertTrue("current date is holiday", cal1.isCurrentDateNonWorking());
-
- cal1.setCurrentBusinessDate(new LocalDate("2006-12-24"));
- Assert.assertTrue("current date is weekend", cal1.isCurrentDateNonWorking());
-
- }
-}
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateCalculatorFactoryTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateCalculatorFactoryTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -0,0 +1,19 @@
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactoryTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+
+import org.joda.time.LocalDate;
+
+public class LocalDateCalculatorFactoryTest extends AbstractDateCalculatorFactoryTest<LocalDate> {
+
+ @Override
+ protected LocalDate newDate(final String date) {
+ return new LocalDate(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<LocalDate> getDateCalculatorFactory() {
+ return DefaultLocalDateCalculatorFactory.getDefaultInstance();
+ }
+}
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayCalculatorFactoryTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayCalculatorFactoryTest.java 2006-09-07 17:24:20 UTC (rev 125)
@@ -0,0 +1,19 @@
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactoryTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+
+import org.joda.time.YearMonthDay;
+
+public class YearMonthDayCalculatorFactoryTest extends AbstractDateCalculatorFactoryTest<YearMonthDay> {
+
+ @Override
+ protected YearMonthDay newDate(final String date) {
+ return new YearMonthDay(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<YearMonthDay> getDateCalculatorFactory() {
+ return DefaultYearMonthDayCalculatorFactory.getDefaultInstance();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-07 14:48:48
|
Revision: 124
http://svn.sourceforge.net/objectlabkit/?rev=124&view=rev
Author: benoitx
Date: 2006-09-07 07:48:06 -0700 (Thu, 07 Sep 2006)
Log Message:
-----------
Keep the lovely generics in our interfaces, this reduces the number of interfaces.
One thought thought is to find a better way for the holiday handlers, at the moment each time a new type of handler arrives, it requires a whole set of implementations whilst a wrapper could be used... Let me think about that one...
next step renaming Factories and Interfaces?
Modified Paths:
--------------
trunk/common-build/project.xml
trunk/datecalc-common/qalab.xml
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
trunk/datecalc-jdk/qalab.xml
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateDateCalculatorCombinationTest.java
trunk/datecalc-joda/qalab.xml
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateBackwardHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateForwardHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
trunk/src/site/index.xml
trunk/src/site/navigation.xml
Added Paths:
-----------
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarDateCalculatorCombinationTest.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BackwardHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ModifiedFollowingHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ModifiedPreceedingHandler.java
Property Changed:
----------------
trunk/datecalc-common/
trunk/datecalc-jdk/
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/common-build/project.xml 2006-09-07 14:48:06 UTC (rev 124)
@@ -112,7 +112,7 @@
<report>maven-simian-plugin</report>
<report>maven-cobertura-plugin</report>
<report>maven-qalab-plugin</report>
- <report>maven-ydoc-plugin</report>
+ <!--<report>maven-ydoc-plugin</report>-->
<report>maven-jdepend-plugin</report>
<report>maven-faq-plugin</report>
<report>maven-junit-report-plugin</report>
Property changes on: trunk/datecalc-common
___________________________________________________________________
Name: svn:ignore
-
target
+ target
.fbwarnings
Modified: trunk/datecalc-common/qalab.xml
===================================================================
--- trunk/datecalc-common/qalab.xml 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/qalab.xml 2006-09-07 14:48:06 UTC (rev 124)
@@ -57,6 +57,8 @@
<summaryresult date="2006-09-06" filecount="18" statvalue="1" type="checkstyle"/>
<summaryresult date="2006-09-06" filecount="17" statvalue="66" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="17" statvalue="68" type="cobertura-branch"/>
+ <summaryresult date="2006-09-07" filecount="17" statvalue="65" type="cobertura-line"/>
+ <summaryresult date="2006-09-07" filecount="17" statvalue="67" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_common_package.html" path="net/objectlab/kit/datecalc/common/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -99,6 +101,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_WorkingWeek.java" path="net/objectlab/kit/datecalc/common/WorkingWeek.java">
<result date="2006-08-08" statvalue="3" type="checkstyle"/>
@@ -133,6 +137,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="95" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_TenorCode.java" path="net/objectlab/kit/datecalc/common/TenorCode.java">
<result date="2006-08-08" statvalue="100" type="cobertura-line"/>
@@ -159,6 +165,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandlerType.java" path="net/objectlab/kit/datecalc/common/HolidayHandlerType.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -173,6 +181,7 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_PeriodCountBasis.java" path="net/objectlab/kit/datecalc/common/PeriodCountBasis.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -185,6 +194,7 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_StandardTenor.java" path="net/objectlab/kit/datecalc/common/StandardTenor.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -210,6 +220,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="92" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="92" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java">
@@ -233,6 +245,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandler.java" path="net/objectlab/kit/datecalc/common/HolidayHandler.java">
<result date="2006-08-23" statvalue="100" type="cobertura-line"/>
@@ -249,6 +263,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java">
@@ -275,6 +291,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/common/PeriodCountCalculator.java">
@@ -291,6 +309,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_Utils.java" path="net/objectlab/kit/datecalc/common/Utils.java">
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
@@ -300,24 +320,32 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="94" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMPeriod.java" path="net/objectlab/kit/datecalc/common/IMMPeriod.java">
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/common/ExcelDateUtil.java">
<result date="2006-09-05" statvalue="84" type="cobertura-line"/>
<result date="2006-09-05" statvalue="83" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="93" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="93" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/IMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractIMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
</qalab>
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -34,11 +34,6 @@
* @param <E>
*/
public abstract class AbstractDateCalculator<E> implements DateCalculator<E> {
-
- // protected static final int MONTHS_IN_QUARTER = 3;
-
- // protected static final int MONTH_IN_YEAR = 12;
-
protected static final int DAYS_IN_WEEK = 7;
private String name;
@@ -202,12 +197,12 @@
newSet.addAll(calendar.getNonWorkingDays());
}
- final DateCalculator<E> cal = createNewCalcultaor(getName() + "/" + calendar.getName(), getStartDate(), newSet,
+ final DateCalculator<E> cal = createNewCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet,
holidayHandler);
return cal;
}
- protected abstract DateCalculator<E> createNewCalcultaor(String calcName, E theStartDate, Set<E> holidays,
+ protected abstract DateCalculator<E> createNewCalculator(String calcName, E theStartDate, Set<E> holidays,
HolidayHandler<E> handler);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -31,13 +31,8 @@
*/
public abstract class AbstractDateCalculatorFactory<E> implements DateCalculatorFactory<E> {
- protected final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
+ private final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
- // public abstract DateCalculator<E> getDateCalculator(String name, String
- // holidayHandlerType);
-
- // public abstract PeriodCountCalculator<E> getPeriodCountCalculator();
-
/**
* Use this method to register a set of holidays for a given calendar, it
* will replace any existing set. It won't update any existing
@@ -52,4 +47,10 @@
public void registerHolidays(final String name, final Set<E> holidaysSet) {
this.holidays.put(name, holidaysSet);
}
+
+ protected void setHolidays(final String name, final DateCalculator<E> dc) {
+ if (holidays.containsKey(name)) {
+ dc.setNonWorkingDays(holidays.get(name));
+ }
+ }
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -20,13 +20,17 @@
import java.util.Set;
/**
- * Factory will create new instances of DateCalculator, these are lightweight,
- * each thread should use the factory as a given DateCalculator should NOT be
- * shared across thread (unless you know what you're doing) as the startDate,
- * current date and working week would be shared. Once created, the set of
- * holidays will NOT change even if a new set is registered; one needs to get a
- * new DateCalculator to get the new set.
+ * Factory will create new instances of calculators, these are lightweight, each
+ * thread should use the factory as a given calculator should NOT be shared
+ * across thread (unless you know what you're doing) as the startDate, current
+ * date and working week would be shared. Once created, the set of holidays will
+ * NOT change even if a new set is registered; one needs to get a new
+ * DateCalculator to get the new set.
*
+ * @param E
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
@@ -57,11 +61,15 @@
void registerHolidays(final String name, Set<E> holidays);
/**
+ * Create a new PeriodCountCalculator.
+ *
* @return a PeriodCountCalculator
*/
PeriodCountCalculator<E> getPeriodCountCalculator();
/**
+ * Create a new IMMDateCalculator.
+ *
* @return an IMMDateCalculator
*/
IMMDateCalculator<E> getIMMDateCalculator();
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -22,7 +22,7 @@
* @author Benoit Xhenseval
*/
public interface HolidayHandler<E> {
- E moveCurrentDate(DateCalculator<E> calendar);
+ E moveCurrentDate(DateCalculator<E> date);
String getType();
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -20,7 +20,8 @@
import java.util.List;
/**
- * The IMMDates are defined as the 3rd Wednesday of March, June, September and December.
+ * The IMMDates are defined as the 3rd Wednesday of March, June, September and
+ * December.
*
* @author Benoit Xhenseval
* @author $LastChangedBy: benoitx $
@@ -37,8 +38,8 @@
boolean isIMMDate(final E date);
/**
- * Given a start date, it will return the next IMM
- * Date, even if the start date is an IMM date (same as calling
+ * Given a start date, it will return the next IMM Date, even if the start
+ * date is an IMM date (same as calling
* getNextIMMDate(IMMPeriod.QUARTERLY)).
*
* @param startDate
@@ -47,8 +48,8 @@
E getNextIMMDate(final E startDate);
/**
- * Given a start date, it will return the next IMM Date
- * based on the IMMPeriod, even if the start date is an IMM date.
+ * Given a start date, it will return the next IMM Date based on the
+ * IMMPeriod, even if the start date is an IMM date.
*
* @param startDate
* @param period
@@ -59,8 +60,8 @@
E getNextIMMDate(final E startDate, final IMMPeriod period);
/**
- * Given a start date, it will return the previous IMM
- * Date, even if the start date is an IMM date.
+ * Given a start date, it will return the previous IMM Date, even if the
+ * start date is an IMM date.
*
* @param startDate
* @return the previous IMMDate based on current date.
@@ -68,9 +69,8 @@
E getPreviousIMMDate(final E startDate);
/**
- * Given a start date, it will return the previous IMM
- * Date based on the IMMPeriod, even if the start date is an IMM
- * date.
+ * Given a start date, it will return the previous IMM Date based on the
+ * IMMPeriod, even if the start date is an IMM date.
*
* @param period
* specify when the "previous" IMM is, if quarterly then it is
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -18,8 +18,9 @@
package net.objectlab.kit.datecalc.common;
/**
- * Some instruments require a period different from the usual Quarterly but still following IMM, e.g. Bi Annually which then can be Mar-Sep or
- * Jun-Dec, or Annually.
+ * Some instruments require a period different from the usual Quarterly but
+ * still following IMM, e.g. Bi Annually which then can be Mar-Sep or Jun-Dec,
+ * or Annually.
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -18,14 +18,16 @@
package net.objectlab.kit.datecalc.common;
/**
- * Interface that defines a financial market way of calculating difference in days, month (or part of) and year (or part of).
- * TODO Improve javadoc.
+ * Interface that defines a financial market way of calculating difference in
+ * days, month (or part of) and year (or part of). TODO Improve javadoc.
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
*
- * @param <E> a representation of "Date", typically Date, Calendar, LocalDate, YearMonthDay.
+ * @param <E>
+ * a representation of "Date", typically Date, Calendar, LocalDate,
+ * YearMonthDay.
*/
public interface PeriodCountCalculator<E> {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -43,6 +43,9 @@
}
public static Calendar getCal(final Date date) {
+ if (date == null) {
+ return null;
+ }
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
Property changes on: trunk/datecalc-jdk
___________________________________________________________________
Name: svn:ignore
- target
+ target
.checkstyle
.fbwarnings
Modified: trunk/datecalc-jdk/qalab.xml
===================================================================
--- trunk/datecalc-jdk/qalab.xml 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-jdk/qalab.xml 2006-09-07 14:48:06 UTC (rev 124)
@@ -58,6 +58,8 @@
<summaryresult date="2006-09-06" filecount="2" statvalue="32" type="simian"/>
<summaryresult date="2006-09-06" filecount="21" statvalue="84" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="21" statvalue="89" type="cobertura-branch"/>
+ <summaryresult date="2006-09-07" filecount="19" statvalue="91" type="cobertura-line"/>
+ <summaryresult date="2006-09-07" filecount="19" statvalue="92" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_jdk_package.html" path="net/objectlab/kit/datecalc/jdk/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -264,6 +266,8 @@
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="79" type="cobertura-line"/>
<result date="2006-09-06" statvalue="84" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="78" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="84" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java">
@@ -278,6 +282,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/jdk/ExcelDateUtil.java">
<result date="2006-09-02" statvalue="4" type="checkstyle"/>
@@ -300,6 +306,8 @@
<result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java">
@@ -311,6 +319,8 @@
<result date="2006-09-05" statvalue="86" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="69" type="cobertura-line"/>
<result date="2006-09-06" statvalue="66" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="76" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="66" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java">
@@ -331,6 +341,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="95" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarDateCalculator.java">
@@ -349,6 +361,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="90" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java">
<result date="2006-09-04" statvalue="100" type="cobertura-line"/>
@@ -366,6 +380,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_AbstractDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java"/>
@@ -388,6 +404,8 @@
id="net_objectlab_kit_datecalc_jdk_DefaultJdkCalendarCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java">
<result date="2006-09-06" statvalue="87" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkCalendarCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
@@ -402,15 +420,59 @@
id="net_objectlab_kit_datecalc_jdk_JdkCalendarIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java">
<result date="2006-09-06" statvalue="100" type="cobertura-line"/>
<result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarBackwardHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarForwardHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_CalendarModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_DateBackwardHandler.java" path="net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_DateForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/DateForwardHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DateModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DateModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java">
+ <result date="2006-09-07" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-07" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BackwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BackwardHandler.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BackwardHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -1,45 +0,0 @@
-/*
- * $Id$
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-
-/**
- * TODO javadoc
- *
- * @author Marcin Jekot
- * @author $LastChangedBy$
- * @version $Revision$ $Date$
- *
- */
-public class BackwardHandler extends ForwardHandler {
-
- @Override
- public Calendar moveCurrentDate(final DateCalculator<Calendar> calendar) {
- return move(calendar, -1);
- }
-
- @Override
- public String getType() {
- return HolidayHandlerType.BACKWARD;
- }
-
-}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarBackwardHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,45 @@
+/*
+ * $Id: CalendarBackwardHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class CalendarBackwardHandler extends CalendarForwardHandler {
+
+ @Override
+ public Calendar moveCurrentDate(final DateCalculator<Calendar> calendar) {
+ return move(calendar, -1);
+ }
+
+ @Override
+ public String getType() {
+ return HolidayHandlerType.BACKWARD;
+ }
+
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,60 @@
+/*
+ * $Id: CalendarModifiedFollowingHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandler;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class CalendarModifiedFollowingHandler implements HolidayHandler<Calendar> {
+
+ public Calendar moveCurrentDate(final DateCalculator<Calendar> calendar) {
+ return move(calendar, 1);
+ }
+
+ protected Calendar move(final DateCalculator<Calendar> calendar, int step) {
+
+ final Calendar cal = (Calendar) calendar.getCurrentBusinessDate().clone();
+
+ final int month = cal.get(Calendar.MONTH);
+
+ while (calendar.isNonWorkingDay(cal)) {
+ cal.add(Calendar.DAY_OF_MONTH, step);
+ if (month != cal.get(Calendar.MONTH)) {
+ // switch direction and go back
+ step *= -1;
+ cal.add(Calendar.DAY_OF_MONTH, step);
+ }
+ }
+
+ return cal;
+ }
+
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_FOLLLOWING;
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedPreceedingHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,44 @@
+/*
+ * $Id: CalendarModifiedPreceedingHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class CalendarModifiedPreceedingHandler extends CalendarModifiedFollowingHandler {
+
+ @Override
+ public Calendar moveCurrentDate(final DateCalculator<Calendar> calendar) {
+ return move(calendar, -1);
+ }
+
+ @Override
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_PRECEEDING;
+ }
+
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateBackwardHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,45 @@
+/*
+ * $Id: CalendarBackwardHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class DateBackwardHandler extends DateForwardHandler {
+
+ @Override
+ public Date moveCurrentDate(final DateCalculator<Date> calendar) {
+ return move(calendar, -1);
+ }
+
+ @Override
+ public String getType() {
+ return HolidayHandlerType.BACKWARD;
+ }
+
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateForwardHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandler;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.Utils;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class DateForwardHandler implements HolidayHandler<Date> {
+
+ public Date moveCurrentDate(final DateCalculator<Date> calendar) {
+ return move(calendar, 1);
+ }
+
+ protected Date move(final DateCalculator<Date> calculator, final int step) {
+ final Calendar cal = Utils.getCal(calculator.getCurrentBusinessDate());
+
+ if (cal == null) {
+ return null;
+ }
+
+ while (calculator.isNonWorkingDay(cal.getTime())) {
+ cal.add(Calendar.DAY_OF_MONTH, step);
+ }
+
+ return cal.getTime();
+ }
+
+ public String getType() {
+ return HolidayHandlerType.FORWARD;
+ }
+
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,61 @@
+/*
+ * $Id: CalendarModifiedFollowingHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandler;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.Utils;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class DateModifiedFollowingHandler implements HolidayHandler<Date> {
+
+ public Date moveCurrentDate(final DateCalculator<Date> calendar) {
+ return move(calendar, 1);
+ }
+
+ protected Date move(final DateCalculator<Date> calendar, int step) {
+ final Calendar cal = (Calendar) Utils.getCal(calendar.getCurrentBusinessDate()).clone();
+
+ final int month = cal.get(Calendar.MONTH);
+
+ while (calendar.isNonWorkingDay(cal.getTime())) {
+ cal.add(Calendar.DAY_OF_MONTH, step);
+ if (month != cal.get(Calendar.MONTH)) {
+ // switch direction and go back
+ step *= -1;
+ cal.add(Calendar.DAY_OF_MONTH, step);
+ }
+ }
+
+ return cal.getTime();
+ }
+
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_FOLLLOWING;
+ }
+}
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedPreceedingHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -0,0 +1,44 @@
+/*
+ * $Id: CalendarModifiedPreceedingHandler.java 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+/**
+ * TODO javadoc
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class DateModifiedPreceedingHandler extends DateModifiedFollowingHandler {
+
+ @Override
+ public Date moveCurrentDate(final DateCalculator<Date> calendar) {
+ return move(calendar, -1);
+ }
+
+ @Override
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_PRECEEDING;
+ }
+
+}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -20,6 +20,7 @@
import java.util.Calendar;
import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
import net.objectlab.kit.datecalc.common.IMMDateCalculator;
@@ -31,8 +32,7 @@
* @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
*
*/
-public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> implements
- JdkCalendarCalculatorFactory {
+public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> {
private static final DefaultJdkCalendarCalculatorFactory DEFAULT = new DefaultJdkCalendarCalculatorFactory();
@@ -40,7 +40,7 @@
private static final JdkCalendarIMMDateCalculator IMMDC = new JdkCalendarIMMDateCalculator();
- public static JdkCalendarCalculatorFactory getDefaultInstance() {
+ public static DefaultJdkCalendarCalculatorFactory getDefaultInstance() {
return DEFAULT;
}
@@ -50,23 +50,21 @@
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
* java.lang.String)
*/
- public JdkCalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
+ public DateCalculator<Calendar> getDateCalculator(final String name, final String holidayHandlerType) {
final JdkCalendarBaseDateCalculator cal = new JdkCalendarBaseDateCalculator();
cal.setName(name);
- if (holidays.containsKey(name)) {
- cal.setNonWorkingDays(holidays.get(name));
- }
+ setHolidays(name, cal);
if (holidayHandlerType == null) {
return cal;
} else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ForwardHandler());
+ cal.setHolidayHandler(new CalendarForwardHandler());
} else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new BackwardHandler());
+ cal.setHolidayHandler(new CalendarBackwardHandler());
} else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ModifiedFollowingHandler());
+ cal.setHolidayHandler(new CalendarModifiedFollowingHandler());
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ModifiedPreceedingHandler());
+ cal.setHolidayHandler(new CalendarModifiedPreceedingHandler());
} else {
throw new UnsupportedOperationException("Unsupported HolidayHandler: " + holidayHandlerType);
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -20,6 +20,7 @@
import java.util.Date;
import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
import net.objectlab.kit.datecalc.common.IMMDateCalculator;
@@ -31,15 +32,15 @@
* @version $Revision$ $Date$
*
*/
-public class DefaultJdkDateCalculatorFactory extends AbstractDateCalculatorFactory<Date> implements JdkDateCalculatorFactory {
+public class DefaultJdkDateCalculatorFactory extends AbstractDateCalculatorFactory<Date> {
- private static final JdkDateCalculatorFactory DEFAULT = new DefaultJdkDateCalculatorFactory();
+ private static final DefaultJdkDateCalculatorFactory DEFAULT = new DefaultJdkDateCalculatorFactory();
private static final JdkDatePeriodCountCalculator PCC = new DatePeriodCountCalculator();
private static final JdkDateIMMDateCalculator IMMDC = new JdkDateIMMDateCalculator();
- public static JdkDateCalculatorFactory getDefaultInstance() {
+ public static DefaultJdkDateCalculatorFactory getDefaultInstance() {
return DEFAULT;
}
@@ -49,23 +50,21 @@
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
* java.lang.String)
*/
- public JdkDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
+ public DateCalculator<Date> getDateCalculator(final String name, final String holidayHandlerType) {
final JdkDateBaseDateCalculator cal = new JdkDateBaseDateCalculator();
cal.setName(name);
- if (holidays.containsKey(name)) {
- cal.setNonWorkingDays(holidays.get(name));
- }
+ setHolidays(name, cal);
if (holidayHandlerType == null) {
return cal;
} else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ForwardHandler());
+ cal.setHolidayHandler(new DateForwardHandler());
} else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new BackwardHandler());
+ cal.setHolidayHandler(new DateBackwardHandler());
} else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ModifiedFollowingHandler());
+ cal.setHolidayHandler(new DateModifiedFollowingHandler());
} else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
- cal.setHolidayHandler(new ModifiedPreceedingHandler());
+ cal.setHolidayHandler(new DateModifiedPreceedingHandler());
} else {
throw new UnsupportedOperationException("Unsupported HolidayHandler: " + holidayHandlerType);
}
Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java 2006-09-06 23:00:22 UTC (rev 123)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java 2006-09-07 14:48:06 UTC (rev 124)
@@ -1,54 +0,0 @@
-/*
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandler;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-
-/**
- * TODO javadoc
- *
- * @author Marcin Jekot
- * @author $LastChangedBy$
- * @version $Revision$ $Date$
- *
- */
-public class ForwardHandler implements HolidayHandler<Calendar> {
-
- public Calendar moveCurrentDate(final DateCalculator<Calendar> calendar) {
- return move(calendar, 1);
- }
-
- protected Calendar move(final DateCalculator<Calendar> calculator, final int step) {
- // final Calendar cal = (Calendar)
- // calculator.getCurrentBusinessDate().clone();
- final Calendar cal = calculator.getCurrentBusinessDate();
-
- while (calculator.isNonWorkingDay(cal)) {
- cal.add(Calendar.DAY_OF_MONTH, step);
- }
-
- return cal;
- }
-
- public String getType() {
- return HolidayHandlerType.FORWARD;
- }
-
-}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java
=============================...
[truncated message content] |
|
From: <be...@us...> - 2006-09-06 23:01:17
|
Revision: 123
http://svn.sourceforge.net/objectlabkit/?rev=123&view=rev
Author: benoitx
Date: 2006-09-06 16:00:22 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Better doc (slightly)
Modified Paths:
--------------
trunk/common-build/project.xml
trunk/datecalc-common/qalab.xml
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-jdk/qalab.xml
trunk/datecalc-joda/qalab.xml
trunk/src/site/index.xml
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/common-build/project.xml 2006-09-06 23:00:22 UTC (rev 123)
@@ -112,7 +112,7 @@
<report>maven-simian-plugin</report>
<report>maven-cobertura-plugin</report>
<report>maven-qalab-plugin</report>
- <report>maven-javadoc-plugin</report>
+ <report>maven-ydoc-plugin</report>
<report>maven-jdepend-plugin</report>
<report>maven-faq-plugin</report>
<report>maven-junit-report-plugin</report>
Modified: trunk/datecalc-common/qalab.xml
===================================================================
--- trunk/datecalc-common/qalab.xml 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-common/qalab.xml 2006-09-06 23:00:22 UTC (rev 123)
@@ -54,6 +54,9 @@
<summaryresult date="2006-09-05" filecount="1" statvalue="1" type="findbugs"/>
<summaryresult date="2006-09-05" filecount="15" statvalue="63" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="15" statvalue="67" type="cobertura-branch"/>
+ <summaryresult date="2006-09-06" filecount="18" statvalue="1" type="checkstyle"/>
+ <summaryresult date="2006-09-06" filecount="17" statvalue="66" type="cobertura-line"/>
+ <summaryresult date="2006-09-06" filecount="17" statvalue="68" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_common_package.html" path="net/objectlab/kit/datecalc/common/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -94,6 +97,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_WorkingWeek.java" path="net/objectlab/kit/datecalc/common/WorkingWeek.java">
<result date="2006-08-08" statvalue="3" type="checkstyle"/>
@@ -126,6 +131,8 @@
<result date="2006-09-05" statvalue="1" type="findbugs"/>
<result date="2006-09-05" statvalue="95" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_TenorCode.java" path="net/objectlab/kit/datecalc/common/TenorCode.java">
<result date="2006-08-08" statvalue="100" type="cobertura-line"/>
@@ -150,6 +157,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandlerType.java" path="net/objectlab/kit/datecalc/common/HolidayHandlerType.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -163,6 +172,7 @@
<result date="2006-09-02" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_PeriodCountBasis.java" path="net/objectlab/kit/datecalc/common/PeriodCountBasis.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -174,6 +184,7 @@
<result date="2006-09-02" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_StandardTenor.java" path="net/objectlab/kit/datecalc/common/StandardTenor.java">
<result date="2006-08-08" statvalue="100" type="cobertura-branch"/>
@@ -197,6 +208,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="92" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="92" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java">
@@ -218,6 +231,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_HolidayHandler.java" path="net/objectlab/kit/datecalc/common/HolidayHandler.java">
<result date="2006-08-23" statvalue="100" type="cobertura-line"/>
@@ -232,6 +247,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_AbstractDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java">
@@ -243,6 +260,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="1" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="1" type="checkstyle"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_DateCalculatorFactory.java" path="net/objectlab/kit/datecalc/common/DateCalculatorFactory.java">
@@ -254,6 +273,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_common_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/common/PeriodCountCalculator.java">
@@ -268,6 +289,8 @@
<result date="2006-09-05" statvalue="6" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_Utils.java" path="net/objectlab/kit/datecalc/common/Utils.java">
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
@@ -275,13 +298,26 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="85" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="94" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMPeriod.java" path="net/objectlab/kit/datecalc/common/IMMPeriod.java">
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/common/ExcelDateUtil.java">
<result date="2006-09-05" statvalue="84" type="cobertura-line"/>
<result date="2006-09-05" statvalue="83" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="93" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
+ <file id="net_objectlab_kit_datecalc_common_IMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/IMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_common_AbstractIMMDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 23:00:22 UTC (rev 123)
@@ -20,7 +20,7 @@
import java.util.List;
/**
- * The IMMDates are defined
+ * The IMMDates are defined as the 3rd Wednesday of March, June, September and December.
*
* @author Benoit Xhenseval
* @author $LastChangedBy: benoitx $
@@ -37,8 +37,8 @@
boolean isIMMDate(final E date);
/**
- * Starting from the current business date, it will return the next IMM
- * Date, even if the current business date is an IMM date (same as calling
+ * Given a start date, it will return the next IMM
+ * Date, even if the start date is an IMM date (same as calling
* getNextIMMDate(IMMPeriod.QUARTERLY)).
*
* @param startDate
@@ -47,8 +47,8 @@
E getNextIMMDate(final E startDate);
/**
- * Starting from the current business date, it will return the next IMM Date
- * based on the IMMPeriod, even if the current business date is an IMM date.
+ * Given a start date, it will return the next IMM Date
+ * based on the IMMPeriod, even if the start date is an IMM date.
*
* @param startDate
* @param period
@@ -59,8 +59,8 @@
E getNextIMMDate(final E startDate, final IMMPeriod period);
/**
- * Starting from the current business date, it will return the previous IMM
- * Date, even if the current business date is an IMM date.
+ * Given a start date, it will return the previous IMM
+ * Date, even if the start date is an IMM date.
*
* @param startDate
* @return the previous IMMDate based on current date.
@@ -68,8 +68,8 @@
E getPreviousIMMDate(final E startDate);
/**
- * Starting from the current business date, it will return the previous IMM
- * Date based on the IMMPeriod, even if the current business date is an IMM
+ * Given a start date, it will return the previous IMM
+ * Date based on the IMMPeriod, even if the start date is an IMM
* date.
*
* @param period
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-06 23:00:22 UTC (rev 123)
@@ -18,8 +18,8 @@
package net.objectlab.kit.datecalc.common;
/**
- * Some instruments require a period Bi Annually which then can be Mar-Sep or
- * Jun-Dec.
+ * Some instruments require a period different from the usual Quarterly but still following IMM, e.g. Bi Annually which then can be Mar-Sep or
+ * Jun-Dec, or Annually.
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
@@ -32,6 +32,6 @@
BI_ANNUALY_JUN_DEC,
/** Conventional period: Quarterly: eg March, June, September, December */
QUARTERLY,
- /** Annually, jump from 1y to the next */
+ /** Annually, jump from 1 year to the next */
ANNUALLY
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-06 23:00:22 UTC (rev 123)
@@ -18,13 +18,14 @@
package net.objectlab.kit.datecalc.common;
/**
- * TODO add javadoc
+ * Interface that defines a financial market way of calculating difference in days, month (or part of) and year (or part of).
+ * TODO Improve javadoc.
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
*
- * @param <E>
+ * @param <E> a representation of "Date", typically Date, Calendar, LocalDate, YearMonthDay.
*/
public interface PeriodCountCalculator<E> {
Modified: trunk/datecalc-jdk/qalab.xml
===================================================================
--- trunk/datecalc-jdk/qalab.xml 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-jdk/qalab.xml 2006-09-06 23:00:22 UTC (rev 123)
@@ -55,6 +55,9 @@
<summaryresult date="2006-09-05" filecount="16" statvalue="14" type="checkstyle"/>
<summaryresult date="2006-09-05" filecount="15" statvalue="83" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="15" statvalue="87" type="cobertura-branch"/>
+ <summaryresult date="2006-09-06" filecount="2" statvalue="32" type="simian"/>
+ <summaryresult date="2006-09-06" filecount="21" statvalue="84" type="cobertura-line"/>
+ <summaryresult date="2006-09-06" filecount="21" statvalue="89" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_jdk_package.html" path="net/objectlab/kit/datecalc/jdk/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -223,6 +226,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_BackwardHandler.java" path="net/objectlab/kit/datecalc/jdk/BackwardHandler.java">
<result date="2006-08-28" statvalue="66" type="cobertura-line"/>
@@ -233,6 +238,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_ModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/jdk/ModifiedPreceedingHandler.java">
@@ -243,6 +250,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_CalendarPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/CalendarPeriodCountCalculator.java">
@@ -253,6 +262,8 @@
<result date="2006-09-04" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="79" type="cobertura-line"/>
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="79" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="84" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java">
@@ -265,6 +276,8 @@
<result date="2006-09-05" statvalue="1" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/jdk/ExcelDateUtil.java">
<result date="2006-09-02" statvalue="4" type="checkstyle"/>
@@ -277,6 +290,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_HolidayHandlerDateWrapper.java" path="net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java">
@@ -284,6 +299,7 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java">
@@ -293,6 +309,8 @@
<result date="2006-09-05" statvalue="8" type="checkstyle"/>
<result date="2006-09-05" statvalue="87" type="cobertura-line"/>
<result date="2006-09-05" statvalue="86" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="69" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="66" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java">
@@ -302,6 +320,8 @@
<result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_DefaultJdkDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java">
@@ -309,6 +329,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="95" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="95" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkCalendarDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarDateCalculator.java">
@@ -316,6 +338,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java">
@@ -323,12 +347,16 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="91" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="90" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java">
<result date="2006-09-04" statvalue="100" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculator.java">
@@ -336,6 +364,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_AbstractDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java"/>
@@ -354,4 +384,33 @@
id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedFollowingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedFollowingDateCalculatorTest.java"/>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedPreceedingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedPreceedingDateCalculatorTest.java"/>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DefaultJdkCalendarCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java">
+ <result date="2006-09-06" statvalue="87" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_JdkCalendarCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkCalendarCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkCalendarIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkCalendarPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateIMMDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/datecalc-joda/qalab.xml 2006-09-06 23:00:22 UTC (rev 123)
@@ -59,7 +59,6 @@
<summaryresult date="2006-09-05" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="91" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
- <summaryresult date="2006-09-06" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-06" filecount="19" statvalue="95" type="cobertura-line"/>
<summaryresult date="2006-09-06" filecount="19" statvalue="96" type="cobertura-branch"/>
</summary>
Modified: trunk/src/site/index.xml
===================================================================
--- trunk/src/site/index.xml 2006-09-06 15:04:38 UTC (rev 122)
+++ trunk/src/site/index.xml 2006-09-06 23:00:22 UTC (rev 123)
@@ -56,18 +56,37 @@
<ul>
<li><a href="./multiproject/datecalc-common/apidocs/net/objectlab/kit/datecalc/common/DateCalculator.html">DateCalculator</a> for all Date calculations.</li>
<li><a href="./multiproject/datecalc-common/apidocs/net/objectlab/kit/datecalc/common/PeriodCountCalculator.html">PeriodCountCalculator</a> for all day, month and year diff calculations.</li>
+ <li><a href="./multiproject/datecalc-common/apidocs/net/objectlab/kit/datecalc/common/IMMDateCalculator.html">IMMDateCalculator</a> for all IMM calculations (International Money Market).</li>
</ul>
<h4>JDK</h4>
<p>2 implementations for Pure JDK have been released</p>
<ol>
- <li><strong>Calendar:</strong><pre>DateCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);</pre></li>
- <li><strong>Date:</strong><pre>DateCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);</pre></li>
+ <li><strong>Calendar:</strong>
+ <pre>
+ DateCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+ PeriodCountCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ IMMDateCalculator<Calendar> calc = DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+ </pre>
+ </li>
+ <li><strong>Date:</strong><pre>
+ DateCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+ PeriodCountCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ IMMDateCalculator<Date> calc = DefaultJdkDateCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+ </pre></li>
</ol>
<h4>JODA</h4>
<p>2 implementations for Joda have been released</p>
<ol>
- <li><strong>LocalDate</strong> (preferred):<pre>DateCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);</pre></li>
- <li><strong>YearMonthDay:</strong><pre>DateCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);</pre></li>
+ <li><strong>LocalDate</strong> (preferred):<pre>
+ DateCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+ PeriodCountCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ IMMDateCalculator<LocalDate> calc = DefaultLocalDateCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+ </pre></li>
+ <li><strong>YearMonthDay:</strong><pre>
+ DateCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
+ PeriodCountCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ IMMDateCalculator<YearMonthDay> calc = DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getIMMDateCalculator();
+ </pre></li>
</ol>
</subsection>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-06 15:05:59
|
Revision: 122
http://svn.sourceforge.net/objectlabkit/?rev=122&view=rev
Author: benoitx
Date: 2006-09-06 08:04:38 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Formatting and improved QA (Checkstyle).
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java
Removed Paths:
-------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -35,9 +35,9 @@
*/
public abstract class AbstractDateCalculator<E> implements DateCalculator<E> {
-// protected static final int MONTHS_IN_QUARTER = 3;
+ // protected static final int MONTHS_IN_QUARTER = 3;
-// protected static final int MONTH_IN_YEAR = 12;
+ // protected static final int MONTH_IN_YEAR = 12;
protected static final int DAYS_IN_WEEK = 7;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -33,9 +33,10 @@
protected final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
-// public abstract DateCalculator<E> getDateCalculator(String name, String holidayHandlerType);
+ // public abstract DateCalculator<E> getDateCalculator(String name, String
+ // holidayHandlerType);
-// public abstract PeriodCountCalculator<E> getPeriodCountCalculator();
+ // public abstract PeriodCountCalculator<E> getPeriodCountCalculator();
/**
* Use this method to register a set of holidays for a given calendar, it
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -60,7 +60,7 @@
* @return a PeriodCountCalculator
*/
PeriodCountCalculator<E> getPeriodCountCalculator();
-
+
/**
* @return an IMMDateCalculator
*/
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -20,7 +20,7 @@
import java.util.List;
/**
- * The IMMDates are defined
+ * The IMMDates are defined
*
* @author Benoit Xhenseval
* @author $LastChangedBy: benoitx $
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -38,9 +38,10 @@
private static final String DATE_PATTERN = "yyyy-MM-dd";
private static final SimpleDateFormat SDF = new SimpleDateFormat(DATE_PATTERN);
-
- private Utils() {}
+ private Utils() {
+ }
+
public static Calendar getCal(final Date date) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
@@ -54,9 +55,11 @@
/**
*
- * @param str string
+ * @param str
+ * string
* @return
- * @throws IllegalArgumentException if the string cannot be parsed.
+ * @throws IllegalArgumentException
+ * if the string cannot be parsed.
*/
public static Date createDate(final String str) {
try {
@@ -70,9 +73,11 @@
/**
*
- * @param str string
+ * @param str
+ * string
* @return
- * @throws IllegalArgumentException if the string cannot be parsed.
+ * @throws IllegalArgumentException
+ * if the string cannot be parsed.
*/
public static Calendar createCalendar(final String str) {
try {
Deleted: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -1,68 +0,0 @@
-/*
- * $Id: org.eclipse.jdt.ui.prefs 99 2006-09-04 20:30:25Z marchy $
- *
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.common;
-
-
-import java.io.*;
-
-/**
- *
- * @author xhensevb
- * @author $LastChangedBy: marchy $
- * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
- *
- */
-public class Version {
- public static void main(String[] args) throws Exception {
- if (args.length != 1) {
- System.err.println("Usage: java version <.class file>");
- System.exit(1);
- }
-
- if (!new File(args[0]).exists()) {
- System.err.println(args[0] + " does not exist!");
- System.exit(2);
- }
-
- DataInputStream dis = new DataInputStream(new FileInputStream(args[0]));
- int magic = dis.readInt();
- if (magic != 0xcafebabe) {
- System.err.println(args[0] + " is not a .class file");
- System.exit(3);
- }
-
- int minor = dis.readShort();
- int major = dis.readShort();
- System.out.println("class file version is " + major + "." + minor);
-
- String version = null;
-
- if (major < 48) {
- version = "1.3.1";
- } else if (major == 48) {
- version = "1.4.2";
- } else if (major == 49) {
- version = "1.5";
- } else if (major == 50) {
- version = "6";
- } else {
- version = "7";
- }
- System.out.println("You need to use JDK " + version + " or above");
- }
-}
\ No newline at end of file
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -24,45 +24,44 @@
* @author Benoit Xhenseval
*/
public class WorkingWeek {
+ private static final byte MONDAY = 1;
- protected static final byte MONDAY = 1;
+ private static final byte TUESDAY = 2;
- protected static final byte TUESDAY = 2;
+ private static final byte WEDNESDAY = 4;
- protected static final byte WEDNESDAY = 4;
+ private static final byte THURSDAY = 8;
- protected static final byte THURSDAY = 8;
+ private static final byte FRIDAY = 16;
- protected static final byte FRIDAY = 16;
+ private static final byte SATURDAY = 32;
- protected static final byte SATURDAY = 32;
+ private static final byte SUNDAY = 64;
- protected static final byte SUNDAY = 64;
+ private static final byte DEFAULT_WORKING_DAYS = (byte) (MONDAY + TUESDAY + WEDNESDAY + THURSDAY + FRIDAY);
- protected static final byte DEFAULT_WORKING_DAYS = (byte) (MONDAY + TUESDAY + WEDNESDAY + THURSDAY + FRIDAY);
-
- protected static final byte[] WORKING_WEEK_DAYS_OFFSET = new byte[] { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
+ private static final byte[] WORKING_WEEK_DAYS_OFFSET = new byte[] { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
SATURDAY };
public static final WorkingWeek DEFAULT = new WorkingWeek();
/**
+ * working days: 1 Monday, 2 Tuesday, 4 Wednesday, 8 Thursday, 16 Friday, 32
+ * Saturday, 64 Sunday So Monday-Friday= 1+2+4+8+16 = 31
+ */
+ private byte workingDays = DEFAULT_WORKING_DAYS;
+
+ /**
* Default Working Week Monday -> Friday.
*/
public WorkingWeek() {
this(DEFAULT_WORKING_DAYS);
}
- private WorkingWeek(final byte workingDays) {
+ protected WorkingWeek(final byte workingDays) {
this.workingDays = workingDays;
}
- /**
- * working days: 1 Monday, 2 Tuesday, 4 Wednesday, 8 Thursday, 16 Friday, 32
- * Saturday, 64 Sunday So Monday-Friday= 1+2+4+8+16 = 31
- */
- protected byte workingDays = DEFAULT_WORKING_DAYS;
-
public boolean isWorkingDayFromCalendar(final int dayOfWeek) {
final int day = adjustDay(dayOfWeek);
return (WORKING_WEEK_DAYS_OFFSET[day] & workingDays) != 0;
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -155,7 +155,6 @@
checkImm(cal, parseDate("2006-12-21"), false);
}
-
public void testPreviousIMM() {
E startDate = parseDate("2006-08-01");
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -76,12 +76,12 @@
Collections.sort(actual);
assertEquals(expected, actual);
}
-
+
public void testFailCreateDate() {
try {
Utils.createDate("blablabla");
fail("should have thown an IllegalArgumentException");
- } catch(IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// all ok
}
}
@@ -90,7 +90,7 @@
try {
Utils.createCalendar("blablabla");
fail("should have thown an IllegalArgumentException");
- } catch(IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// all ok
}
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -32,7 +32,7 @@
*/
public class DatePeriodCountCalculator implements JdkDatePeriodCountCalculator {
- private final CalendarPeriodCountCalculator PCC = new CalendarPeriodCountCalculator();
+ private static final CalendarPeriodCountCalculator PCC = new CalendarPeriodCountCalculator();
public int dayDiff(final Date start, final Date end, final PeriodCountBasis basis) {
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -31,7 +31,8 @@
* @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
*
*/
-public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> implements JdkCalendarCalculatorFactory {
+public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> implements
+ JdkCalendarCalculatorFactory {
private static final DefaultJdkCalendarCalculatorFactory DEFAULT = new DefaultJdkCalendarCalculatorFactory();
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandlerDateWrapper.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -34,9 +34,9 @@
*/
public class HolidayHandlerDateWrapper implements HolidayHandler<Date> {
- HolidayHandler<Calendar> delegate;
+ private HolidayHandler<Calendar> delegate;
- DateCalculator<Calendar> calculator;
+ private DateCalculator<Calendar> calculator;
public HolidayHandlerDateWrapper(final HolidayHandler<Calendar> holidayHandler, final DateCalculator<Calendar> dateCalulator) {
delegate = holidayHandler;
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -7,8 +7,8 @@
public interface JdkCalendarCalculatorFactory extends DateCalculatorFactory<Calendar> {
- public abstract JdkCalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType);
+ JdkCalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType);
- public abstract PeriodCountCalculator<Calendar> getPeriodCountCalculator();
+ PeriodCountCalculator<Calendar> getPeriodCountCalculator();
}
\ No newline at end of file
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -8,6 +8,8 @@
import net.objectlab.kit.datecalc.common.IMMPeriod;
public class JdkCalendarIMMDateCalculator extends AbstractIMMDateCalculator<Calendar> {
+ private static final int NUMBER_DAYS_IN_WEEK = 7;
+
/**
* Returns a list of IMM dates between 2 dates, it will exclude the start
* date if it is an IMM date but would include the end date if it is an IMM.
@@ -87,9 +89,9 @@
case Calendar.SEPTEMBER:
case Calendar.DECEMBER:
return true;
+ default:
+ return false;
}
-
- return false;
}
/**
@@ -106,11 +108,11 @@
if (dayOfWeek < Calendar.WEDNESDAY) {
cal.add(Calendar.DAY_OF_MONTH, Calendar.WEDNESDAY - dayOfWeek);
} else if (dayOfWeek > Calendar.WEDNESDAY) {
- cal.add(Calendar.DAY_OF_MONTH, (Calendar.WEDNESDAY + 7) - dayOfWeek);
+ cal.add(Calendar.DAY_OF_MONTH, (Calendar.WEDNESDAY + NUMBER_DAYS_IN_WEEK) - dayOfWeek);
}
// go to 3rd wednesday - i.e. move 2 weeks forward
- cal.add(Calendar.DAY_OF_MONTH, 7 * 2);
+ cal.add(Calendar.DAY_OF_MONTH, NUMBER_DAYS_IN_WEEK * 2);
}
public boolean isIMMDate(final Calendar date) {
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -7,8 +7,8 @@
public interface JdkDateCalculatorFactory extends DateCalculatorFactory<Date> {
- public abstract JdkDateCalculator getDateCalculator(final String name, final String holidayHandlerType);
+ JdkDateCalculator getDateCalculator(final String name, final String holidayHandlerType);
- public abstract PeriodCountCalculator<Date> getPeriodCountCalculator();
+ PeriodCountCalculator<Date> getPeriodCountCalculator();
}
\ No newline at end of file
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -14,21 +14,21 @@
private static final JdkCalendarIMMDateCalculator DELEGATE = new JdkCalendarIMMDateCalculator();
@Override
- protected Date getNextIMMDate(boolean requestNextIMM, Date theStartDate, IMMPeriod period) {
+ protected Date getNextIMMDate(final boolean requestNextIMM, final Date theStartDate, final IMMPeriod period) {
return DELEGATE.getNextIMMDate(requestNextIMM, Utils.getCal(theStartDate), period).getTime();
}
- public List<Date> getIMMDates(Date start, Date end, IMMPeriod period) {
+ public List<Date> getIMMDates(final Date start, final Date end, final IMMPeriod period) {
return buildList(DELEGATE.getIMMDates(Utils.getCal(start), Utils.getCal(end), period));
}
- public boolean isIMMDate(Date date) {
+ public boolean isIMMDate(final Date date) {
return DELEGATE.isIMMDate(Utils.getCal(date));
}
- private List<Date> buildList(List<Calendar> dates) {
- List<Date> imms = new ArrayList<Date>();
- for (Calendar date : dates) {
+ private List<Date> buildList(final List<Calendar> dates) {
+ final List<Date> imms = new ArrayList<Date>();
+ for (final Calendar date : dates) {
imms.add(date.getTime());
}
return imms;
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -31,15 +31,15 @@
public static final JodaWorkingWeek DEFAULT = new JodaWorkingWeek();
public JodaWorkingWeek() {
- this(DEFAULT_WORKING_DAYS);
+ super();
}
private JodaWorkingWeek(final byte workingDays) {
- this.workingDays = workingDays;
+ super(workingDays);
}
public JodaWorkingWeek(final WorkingWeek ww) {
- this.workingDays = ww.getWorkingDays();
+ this(ww.getWorkingDays());
}
public boolean isWorkingDay(final LocalDate date) {
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java 2006-09-06 14:41:28 UTC (rev 121)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java 2006-09-06 15:04:38 UTC (rev 122)
@@ -13,22 +13,22 @@
private static final LocalDateIMMDateCalculator DELEGATE = new LocalDateIMMDateCalculator();
- public boolean isIMMDate(YearMonthDay date) {
+ public boolean isIMMDate(final YearMonthDay date) {
return DELEGATE.isIMMDate(date.toLocalDate());
}
@Override
- protected YearMonthDay getNextIMMDate(boolean requestNextIMM, YearMonthDay theStartDate, IMMPeriod period) {
+ protected YearMonthDay getNextIMMDate(final boolean requestNextIMM, final YearMonthDay theStartDate, final IMMPeriod period) {
return new YearMonthDay(DELEGATE.getNextIMMDate(requestNextIMM, theStartDate.toLocalDate(), period));
}
- public List<YearMonthDay> getIMMDates(YearMonthDay start, YearMonthDay end, IMMPeriod period) {
+ public List<YearMonthDay> getIMMDates(final YearMonthDay start, final YearMonthDay end, final IMMPeriod period) {
return buildList(DELEGATE.getIMMDates(start.toLocalDate(), end.toLocalDate(), period));
}
- private List<YearMonthDay> buildList(List<LocalDate> dates) {
- List<YearMonthDay> imms = new ArrayList<YearMonthDay>();
- for (LocalDate date : dates) {
+ private List<YearMonthDay> buildList(final List<LocalDate> dates) {
+ final List<YearMonthDay> imms = new ArrayList<YearMonthDay>();
+ for (final LocalDate date : dates) {
imms.add(new YearMonthDay(date));
}
return imms;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-06 14:41:54
|
Revision: 121
http://svn.sourceforge.net/objectlabkit/?rev=121&view=rev
Author: benoitx
Date: 2006-09-06 07:41:28 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Increase coverage.
Modified Paths:
--------------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractExcelDateUtilTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/CalendarExcelDateUtilTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/DateExcelDateUtilTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateTimeExcelDateUtilTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateExcelDateUtilTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayExcelDateUtilTest.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -5,24 +5,31 @@
public abstract class AbstractExcelDateUtilTest<E> extends TestCase {
protected abstract E createDate(final String str);
- protected abstract E createDateFromExcel(double excelDate);
+ protected abstract E createDateFromExcel(double excelDate, boolean use1904windowing);
public void testExcelDate() {
- checkDate(createDate("1899-12-31"), 0);
- checkDate(createDate("1900-01-01"), 1.0);
- checkDate(createDate("1900-03-01"), 61.0);
- checkDate(createDate("1968-06-11"), 25000.0);
- checkDate(createDate("1978-05-31"), 28641.00);
- checkDate(createDate("1999-12-31"), 36525.00);
- checkDate(createDate("2000-01-01"), 36526.00);
- checkDate(createDate("2000-01-01"), 36526.00);
- checkDate(createDate("2000-02-28"), 36584.00);
- checkDate(createDate("2000-02-29"), 36585.00);
- checkDate(createDate("2000-03-01"), 36586.00);
- checkDate(null, -1.0);
+ checkDate(createDate("1899-12-31"), 0, false);
+ checkDate(createDate("1900-01-01"), 1.0, false);
+ checkDate(createDate("1900-03-01"), 61.0, false);
+ checkDate(createDate("1968-06-11"), 25000.0, false);
+ checkDate(createDate("1978-05-31"), 28641.00, false);
+ checkDate(createDate("1999-12-31"), 36525.00, false);
+ checkDate(createDate("2000-01-01"), 36526.00, false);
+ checkDate(createDate("2000-01-01"), 36526.00, false);
+ checkDate(createDate("2000-02-28"), 36584.00, false);
+ checkDate(createDate("2000-02-29"), 36585.00, false);
+ checkDate(createDate("2000-03-01"), 36586.00, false);
+ checkDate(null, -1.0, false);
}
- private void checkDate(final E date, final double excelDate) {
- assertEquals("excel:" + excelDate, date, createDateFromExcel(excelDate));
+ public void testExcelDateUsing1904Windowing() {
+ checkDate(createDate("1904-01-01"), 0.0, true);
+ checkDate(createDate("1904-01-02"), 1.0, true);
+ checkDate(createDate("1904-03-02"), 61.0, true);
+ checkDate(null, -1.0, false);
}
+
+ private void checkDate(final E date, final double excelDate, final boolean use1904windowing) {
+ assertEquals("excel:" + excelDate, date, createDateFromExcel(excelDate, use1904windowing));
+ }
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/CalendarExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/CalendarExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/CalendarExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -10,7 +10,7 @@
}
@Override
- protected Calendar createDateFromExcel(final double excelDate) {
- return ExcelDateUtil.getJavaCalendar(excelDate, false);
+ protected Calendar createDateFromExcel(final double excelDate, final boolean use1904Windowing) {
+ return ExcelDateUtil.getJavaCalendar(excelDate, use1904Windowing);
}
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/DateExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/DateExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/DateExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -10,7 +10,7 @@
}
@Override
- protected Date createDateFromExcel(final double excelDate) {
- return ExcelDateUtil.getJavaDateOnly(excelDate, false);
+ protected Date createDateFromExcel(final double excelDate, final boolean use1904Windowing) {
+ return ExcelDateUtil.getJavaDateOnly(excelDate, use1904Windowing);
}
}
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -76,4 +76,22 @@
Collections.sort(actual);
assertEquals(expected, actual);
}
+
+ public void testFailCreateDate() {
+ try {
+ Utils.createDate("blablabla");
+ fail("should have thown an IllegalArgumentException");
+ } catch(IllegalArgumentException e) {
+ // all ok
+ }
+ }
+
+ public void testFailCreateCalendar() {
+ try {
+ Utils.createCalendar("blablabla");
+ fail("should have thown an IllegalArgumentException");
+ } catch(IllegalArgumentException e) {
+ // all ok
+ }
+ }
}
Deleted: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-
-import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-import net.objectlab.kit.datecalc.common.Utils;
-
-public class DatePeriodCountCalculatorTest extends AbstractPeriodCountCalculator<Date> {
-
- @Override
- public PeriodCountCalculator<Date> getPeriodCountCalculator() {
- return DefaultJdkDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
- }
-
- @Override
- public Date parseDate(final String string) {
- return Utils.createDate(string);
- }
-
- @Override
- public Date getDate() {
- return new Date();
- }
-
-}
\ No newline at end of file
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -30,6 +30,10 @@
*/
public class LocalDateModifiedPreceedingHandler implements HolidayHandler<LocalDate> {
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_PRECEEDING;
+ }
+
public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) {
LocalDate date = calendar.getCurrentBusinessDate();
final int month = date.getMonthOfYear();
@@ -44,9 +48,4 @@
}
return date;
}
-
- public String getType() {
- return HolidayHandlerType.MODIFIED_PRECEEDING;
- }
-
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -32,6 +32,10 @@
*/
public class YearMonthDayModifiedFollowingHandler implements HolidayHandler<YearMonthDay> {
+ public String getType() {
+ return HolidayHandlerType.MODIFIED_FOLLLOWING;
+ }
+
public YearMonthDay moveCurrentDate(final DateCalculator<YearMonthDay> calendar) {
YearMonthDay date = calendar.getCurrentBusinessDate();
final int month = date.getMonthOfYear();
@@ -47,8 +51,4 @@
return date;
}
- public String getType() {
- return HolidayHandlerType.MODIFIED_FOLLLOWING;
- }
-
}
Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateTimeExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateTimeExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateTimeExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -12,7 +12,7 @@
}
@Override
- protected DateTime createDateFromExcel(final double excelDate) {
- return JodaExcelDateUtil.getDateTime(excelDate, false);
+ protected DateTime createDateFromExcel(final double excelDate, final boolean use1904Windowing) {
+ return JodaExcelDateUtil.getDateTime(excelDate, use1904Windowing);
}
}
Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -12,7 +12,7 @@
}
@Override
- protected LocalDate createDateFromExcel(final double excelDate) {
- return JodaExcelDateUtil.getLocalDate(excelDate, false);
+ protected LocalDate createDateFromExcel(final double excelDate, final boolean use1904Windowing) {
+ return JodaExcelDateUtil.getLocalDate(excelDate, use1904Windowing);
}
}
Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayExcelDateUtilTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayExcelDateUtilTest.java 2006-09-06 14:00:18 UTC (rev 120)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayExcelDateUtilTest.java 2006-09-06 14:41:28 UTC (rev 121)
@@ -12,7 +12,7 @@
}
@Override
- protected YearMonthDay createDateFromExcel(final double excelDate) {
- return JodaExcelDateUtil.getYearMonthDay(excelDate, false);
+ protected YearMonthDay createDateFromExcel(final double excelDate, final boolean use1904Windowing) {
+ return JodaExcelDateUtil.getYearMonthDay(excelDate, use1904Windowing);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-06 14:02:24
|
Revision: 120
http://svn.sourceforge.net/objectlabkit/?rev=120&view=rev
Author: benoitx
Date: 2006-09-06 07:00:18 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
More tests for jdk, bringing total to 123!
Modified Paths:
--------------
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
trunk/datecalc-joda/qalab.xml
Added Paths:
-----------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBackwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarForwardDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedFollowingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedPreceedingDateCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculatorTest.java
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -104,5 +104,4 @@
public JdkCalendarBaseDateCalculator moveByBusinessDays(final int businessDays) {
return (JdkCalendarBaseDateCalculator) super.moveByBusinessDays(businessDays);
}
-
}
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBackwardDateCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBackwardDateCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBackwardDateCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,20 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractBackwardDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarBackwardDateCalculatorTest extends AbstractBackwardDateCalculatorTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<Calendar> getDateCalculatorFactory() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance();
+ }
+}
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarForwardDateCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarForwardDateCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarForwardDateCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,21 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractForwardDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarForwardDateCalculatorTest extends AbstractForwardDateCalculatorTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<Calendar> getDateCalculatorFactory() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance();
+ }
+
+}
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedFollowingDateCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedFollowingDateCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedFollowingDateCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,21 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractModifiedFollowingDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarModifiedFollowingDateCalculatorTest extends AbstractModifiedFollowingDateCalculatorTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<Calendar> getDateCalculatorFactory() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance();
+ }
+
+}
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedPreceedingDateCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedPreceedingDateCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarModifiedPreceedingDateCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,21 @@
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractModifiedPreceedingDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.DateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarModifiedPreceedingDateCalculatorTest extends AbstractModifiedPreceedingDateCalculatorTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected DateCalculatorFactory<Calendar> getDateCalculatorFactory() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance();
+ }
+
+}
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkCalendarPeriodCountCalculatorTest extends AbstractPeriodCountCalculator<Calendar> {
+
+ @Override
+ public PeriodCountCalculator<Calendar> getPeriodCountCalculator() {
+ return DefaultJdkCalendarCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ }
+
+ @Override
+ public Calendar parseDate(final String string) {
+ return Utils.createCalendar(string);
+ }
+
+ @Override
+ public Calendar getDate() {
+ return Calendar.getInstance();
+ }
+
+}
\ No newline at end of file
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePeriodCountCalculatorTest.java 2006-09-06 14:00:18 UTC (rev 120)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.Utils;
+
+public class JdkDatePeriodCountCalculatorTest extends AbstractPeriodCountCalculator<Date> {
+
+ @Override
+ public PeriodCountCalculator<Date> getPeriodCountCalculator() {
+ return DefaultJdkDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ }
+
+ @Override
+ public Date parseDate(final String string) {
+ return Utils.createDate(string);
+ }
+
+ @Override
+ public Date getDate() {
+ return new Date();
+ }
+
+}
\ No newline at end of file
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-06 12:28:21 UTC (rev 119)
+++ trunk/datecalc-joda/qalab.xml 2006-09-06 14:00:18 UTC (rev 120)
@@ -59,6 +59,9 @@
<summaryresult date="2006-09-05" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="91" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
+ <summaryresult date="2006-09-06" filecount="4" statvalue="40" type="simian"/>
+ <summaryresult date="2006-09-06" filecount="19" statvalue="95" type="cobertura-line"/>
+ <summaryresult date="2006-09-06" filecount="19" statvalue="96" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_joda_package.html" path="net/objectlab/kit/datecalc/joda/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -169,6 +172,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_BackwardHandler.java" path="net/objectlab/kit/datecalc/joda/BackwardHandler.java">
<result date="2006-08-08" statvalue="28" type="cobertura-line"/>
@@ -299,6 +304,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_DefaultLocalDatePeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/DefaultLocalDatePeriodCountCalculator.java">
@@ -308,6 +315,8 @@
<result date="2006-09-04" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="81" type="cobertura-line"/>
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="81" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="84" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_DefaultYearMonthDayCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java">
@@ -317,6 +326,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_DefaultYearMonthDayPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java">
@@ -326,6 +337,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_HolidayHandlerYearMonthDayWrapper.java" path="net/objectlab/kit/datecalc/joda/HolidayHandlerYearMonthDayWrapper.java">
@@ -335,6 +348,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="83" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="83" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateBackwardHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateBackwardHandler.java">
@@ -344,6 +359,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_LocalDateCalculator.java" path="net/objectlab/kit/datecalc/joda/LocalDateCalculator.java">
<result date="2006-09-02" statvalue="100" type="cobertura-line"/>
@@ -353,6 +370,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateForwardHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateForwardHandler.java">
@@ -362,6 +381,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java">
@@ -371,6 +392,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_LocalDateModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/LocalDateModifiedPreceedingHandler.java">
@@ -380,6 +403,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayBackwardHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayBackwardHandler.java">
@@ -389,6 +414,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayDateCalculator.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java">
@@ -398,6 +425,8 @@
<result date="2006-09-04" statvalue="71" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="64" type="cobertura-line"/>
<result date="2006-09-05" statvalue="71" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayForwardHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayForwardHandler.java">
@@ -407,6 +436,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java">
@@ -416,6 +447,8 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_YearMonthDayModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayModifiedPreceedingHandler.java">
@@ -425,9 +458,23 @@
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_joda_JodaExcelDateUtil.java" path="net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java">
<result date="2006-09-05" statvalue="85" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-06" statvalue="85" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_LocalDateIMMDateCalculator.java" path="net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_joda_YearMonthDayIMMDateCalculator.java" path="net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java">
+ <result date="2006-09-06" statvalue="100" type="cobertura-line"/>
+ <result date="2006-09-06" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-06 12:29:07
|
Revision: 119
http://svn.sourceforge.net/objectlabkit/?rev=119&view=rev
Author: benoitx
Date: 2006-09-06 05:28:21 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Separated the IMM calculator from the main DateCalendar, as suggested by Marcin (not everyone would use this).
It is implemented in similar fashion to the PeriodCountCalculator.
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/TenorTest.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayCalculatorFactory.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
Added Paths:
-----------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarCalculatorFactory.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPeriodCountCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateCalculator.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarIMMDateTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDateIMMDateTest.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateCalculator.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -19,7 +19,6 @@
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
/**
@@ -36,9 +35,9 @@
*/
public abstract class AbstractDateCalculator<E> implements DateCalculator<E> {
- protected static final int MONTHS_IN_QUARTER = 3;
+// protected static final int MONTHS_IN_QUARTER = 3;
- protected static final int MONTH_IN_YEAR = 12;
+// protected static final int MONTH_IN_YEAR = 12;
protected static final int DAYS_IN_WEEK = 7;
@@ -111,9 +110,6 @@
return moveByDays(tenor.getUnits());
case WEEK:
return moveByDays(tenor.getUnits() * DAYS_IN_WEEK);
- case IMM:
- setCurrentBusinessDate(getNextIMMDate());
- return this;
default:
throw new UnsupportedOperationException("Sorry not yet...");
}
@@ -212,57 +208,6 @@
return cal;
}
- /**
- * @return the next IMMDate based on current date.
- */
- public E getNextIMMDate() {
- return getNextIMMDate(true, currentBusinessDate, IMMPeriod.QUARTERLY);
- }
-
- /**
- * @param period
- * specify when the "next" IMM is, if quarterly then it is the
- * conventional algorithm.
- * @return the next IMMDate based on current date.
- */
- public E getNextIMMDate(final IMMPeriod period) {
- return getNextIMMDate(true, currentBusinessDate, period);
- }
-
- /**
- * @return the previous IMMDate based on current date.
- */
- public E getPreviousIMMDate() {
- return getNextIMMDate(false, currentBusinessDate, IMMPeriod.QUARTERLY);
- }
-
- /**
- * @param period
- * specify when the "previous" IMM is, if quarterly then it is
- * the conventional algorithm.
- * @return the previous IMMDate based on current date.
- */
- public E getPreviousIMMDate(final IMMPeriod period) {
- return getNextIMMDate(false, currentBusinessDate, period);
- }
-
- /**
- * Returns a list of IMM dates between 2 dates, it will exclude the start
- * date if it is an IMM date but would include the end date if it is an IMM
- * (same as IMMPeriod.QUARTERLY).
- *
- * @param start
- * start of the interval, excluded
- * @param end
- * end of the interval, may be included.
- * @return list of IMM dates
- */
- public List<E> getIMMDates(final E start, final E end) {
- return getIMMDates(start, end, IMMPeriod.QUARTERLY);
- }
-
- protected abstract E getNextIMMDate(final boolean requestNextIMM, final E theStartDate, final IMMPeriod period);
-
protected abstract DateCalculator<E> createNewCalcultaor(String calcName, E theStartDate, Set<E> holidays,
HolidayHandler<E> handler);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -33,9 +33,9 @@
protected final ConcurrentMap<String, Set<E>> holidays = new ConcurrentHashMap<String, Set<E>>();
- public abstract DateCalculator<E> getDateCalculator(String name, String holidayHandlerType);
+// public abstract DateCalculator<E> getDateCalculator(String name, String holidayHandlerType);
- public abstract PeriodCountCalculator<E> getPeriodCountCalculator();
+// public abstract PeriodCountCalculator<E> getPeriodCountCalculator();
/**
* Use this method to register a set of holidays for a given calendar, it
@@ -51,5 +51,4 @@
public void registerHolidays(final String name, final Set<E> holidaysSet) {
this.holidays.put(name, holidaysSet);
}
-
}
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -0,0 +1,96 @@
+/*
+ * $Id: AbstractDateCalculator.java 108 2006-09-05 10:13:01Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.List;
+
+/**
+ * Abstract implementation in order to encapsulate all the common functionality
+ * between Jdk and Joda implementations. It is parametrized on <code><E></code>
+ * but basically <code>Date</code> and <code>LocalDate</code> are the only
+ * viable values for it for now.
+ *
+ * @author Marcin Jekot
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 108 $ $Date: 2006-09-05 11:13:01 +0100 (Tue, 05 Sep 2006) $
+ *
+ * @param <E>
+ */
+public abstract class AbstractIMMDateCalculator<E> implements IMMDateCalculator<E> {
+
+ protected static final int MONTHS_IN_QUARTER = 3;
+
+ protected static final int MONTH_IN_YEAR = 12;
+
+ protected static final int DAYS_IN_WEEK = 7;
+
+ /**
+ * @param startDate
+ * @return the next IMMDate based on current date.
+ */
+ public E getNextIMMDate(final E startDate) {
+ return getNextIMMDate(true, startDate, IMMPeriod.QUARTERLY);
+ }
+
+ /**
+ * @param startDate
+ * @param period
+ * specify when the "next" IMM is, if quarterly then it is the
+ * conventional algorithm.
+ * @return the next IMMDate based on current date.
+ */
+ public E getNextIMMDate(final E startDate, final IMMPeriod period) {
+ return getNextIMMDate(true, startDate, period);
+ }
+
+ /**
+ * @param startDate
+ * @return the previous IMMDate based on current date.
+ */
+ public E getPreviousIMMDate(final E startDate) {
+ return getNextIMMDate(false, startDate, IMMPeriod.QUARTERLY);
+ }
+
+ /**
+ * @param startDate
+ * @param period
+ * specify when the "previous" IMM is, if quarterly then it is
+ * the conventional algorithm.
+ * @return the previous IMMDate based on current date.
+ */
+ public E getPreviousIMMDate(final E startDate, final IMMPeriod period) {
+ return getNextIMMDate(false, startDate, period);
+ }
+
+ /**
+ * Returns a list of IMM dates between 2 dates, it will exclude the start
+ * date if it is an IMM date but would include the end date if it is an IMM
+ * (same as IMMPeriod.QUARTERLY).
+ *
+ * @param start
+ * start of the interval, excluded
+ * @param end
+ * end of the interval, may be included.
+ * @return list of IMM dates
+ */
+ public List<E> getIMMDates(final E start, final E end) {
+ return getIMMDates(start, end, IMMPeriod.QUARTERLY);
+ }
+
+ protected abstract E getNextIMMDate(final boolean requestNextIMM, final E theStartDate, final IMMPeriod period);
+}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -17,7 +17,6 @@
*/
package net.objectlab.kit.datecalc.common;
-import java.util.List;
import java.util.Set;
/**
@@ -193,81 +192,4 @@
* calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();)
*/
DateCalculator<E> moveByTenor(final Tenor tenor);
-
- /**
- * Checks if a given date is an official IMM Date (3rd Wednesdays of
- * March/June/Sept/Dec.
- *
- * @param date
- * @return true if that date is an IMM date.
- */
- boolean isIMMDate(E date);
-
- /**
- * Starting from the current business date, it will return the next IMM
- * Date, even if the current business date is an IMM date (same as calling
- * getNextIMMDate(IMMPeriod.QUARTERLY)).
- *
- * @return the next IMMDate based on current business date.
- */
- E getNextIMMDate();
-
- /**
- * Starting from the current business date, it will return the next IMM Date
- * based on the IMMPeriod, even if the current business date is an IMM date.
- *
- * @param period
- * specify when the "next" IMM is, if quarterly then it is the
- * conventional algorithm.
- * @return the next IMMDate based on current date.
- */
- E getNextIMMDate(IMMPeriod period);
-
- /**
- * Starting from the current business date, it will return the previous IMM
- * Date, even if the current business date is an IMM date.
- *
- * @return the previous IMMDate based on current date.
- */
- E getPreviousIMMDate();
-
- /**
- * Starting from the current business date, it will return the previous IMM
- * Date based on the IMMPeriod, even if the current business date is an IMM
- * date.
- *
- * @param period
- * specify when the "previous" IMM is, if quarterly then it is
- * the conventional algorithm.
- * @return the previous IMMDate based on current date.
- */
- E getPreviousIMMDate(IMMPeriod period);
-
- /**
- * Returns a list of IMM dates between 2 dates, it will exclude the start
- * date if it is an IMM date but would include the end date if it is an IMM
- * (same as as calling getIMMDates(start,end,IMMPeriod.QUARTERLY)).
- *
- * @param start
- * start of the interval, excluded
- * @param end
- * end of the interval, may be included.
- * @return list of IMM dates
- */
- List<E> getIMMDates(final E start, final E end);
-
- /**
- * Returns a list of IMM dates between 2 dates, it will exclude the start
- * date if it is an IMM date but would include the end date if it is an IMM.
- *
- * @param start
- * start of the interval, excluded
- * @param end
- * end of the interval, may be included.
- * @param period
- * specify when the "next" IMM is, if quarterly then it is the
- * conventional algorithm.
- * @return list of IMM dates
- */
- List<E> getIMMDates(final E start, final E end, final IMMPeriod period);
}
\ No newline at end of file
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorFactory.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -60,4 +60,9 @@
* @return a PeriodCountCalculator
*/
PeriodCountCalculator<E> getPeriodCountCalculator();
+
+ /**
+ * @return an IMMDateCalculator
+ */
+ IMMDateCalculator<E> getIMMDateCalculator();
}
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -0,0 +1,109 @@
+/*
+ * $Id: DateCalculator.java 109 2006-09-05 11:16:39Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.List;
+
+/**
+ * The IMMDates are defined
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 109 $ $Date: 2006-09-05 12:16:39 +0100 (Tue, 05 Sep 2006) $
+ */
+public interface IMMDateCalculator<E> {
+ /**
+ * Checks if a given date is an official IMM Date (3rd Wednesdays of
+ * March/June/Sept/Dec.
+ *
+ * @param date
+ * @return true if that date is an IMM date.
+ */
+ boolean isIMMDate(final E date);
+
+ /**
+ * Starting from the current business date, it will return the next IMM
+ * Date, even if the current business date is an IMM date (same as calling
+ * getNextIMMDate(IMMPeriod.QUARTERLY)).
+ *
+ * @param startDate
+ * @return the next IMMDate based on current business date.
+ */
+ E getNextIMMDate(final E startDate);
+
+ /**
+ * Starting from the current business date, it will return the next IMM Date
+ * based on the IMMPeriod, even if the current business date is an IMM date.
+ *
+ * @param startDate
+ * @param period
+ * specify when the "next" IMM is, if quarterly then it is the
+ * conventional algorithm.
+ * @return the next IMMDate based on current date.
+ */
+ E getNextIMMDate(final E startDate, final IMMPeriod period);
+
+ /**
+ * Starting from the current business date, it will return the previous IMM
+ * Date, even if the current business date is an IMM date.
+ *
+ * @param startDate
+ * @return the previous IMMDate based on current date.
+ */
+ E getPreviousIMMDate(final E startDate);
+
+ /**
+ * Starting from the current business date, it will return the previous IMM
+ * Date based on the IMMPeriod, even if the current business date is an IMM
+ * date.
+ *
+ * @param period
+ * specify when the "previous" IMM is, if quarterly then it is
+ * the conventional algorithm.
+ * @return the previous IMMDate based on current date.
+ */
+ E getPreviousIMMDate(final E startDate, final IMMPeriod period);
+
+ /**
+ * Returns a list of IMM dates between 2 dates, it will exclude the start
+ * date if it is an IMM date but would include the end date if it is an IMM
+ * (same as as calling getIMMDates(start,end,IMMPeriod.QUARTERLY)).
+ *
+ * @param start
+ * start of the interval, excluded
+ * @param end
+ * end of the interval, may be included.
+ * @return list of IMM dates
+ */
+ List<E> getIMMDates(final E start, final E end);
+
+ /**
+ * Returns a list of IMM dates between 2 dates, it will exclude the start
+ * date if it is an IMM date but would include the end date if it is an IMM.
+ *
+ * @param start
+ * start of the interval, excluded
+ * @param end
+ * end of the interval, may be included.
+ * @param period
+ * specify when the "next" IMM is, if quarterly then it is the
+ * conventional algorithm.
+ * @return list of IMM dates
+ */
+ List<E> getIMMDates(final E start, final E end, final IMMPeriod period);
+}
\ No newline at end of file
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -28,17 +28,17 @@
*/
public interface PeriodCountCalculator<E> {
- final int YEAR_360 = 360;
+ int YEAR_360 = 360;
- final int MONTHS_IN_YEAR = 12;
+ int MONTHS_IN_YEAR = 12;
- final double YEAR_365_0 = 365.0;
+ double YEAR_365_0 = 365.0;
- final double YEAR_360_0 = 360.0;
+ double YEAR_360_0 = 360.0;
- final int MONTH_31_DAYS = 31;
+ int MONTH_31_DAYS = 31;
- final int MONTH_30_DAYS = 30;
+ int MONTH_30_DAYS = 30;
int dayDiff(final E start, final E end, PeriodCountBasis basis);
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -69,6 +69,4 @@
public static final Tenor T_30Y = new Tenor(30, TenorCode.YEAR);
public static final Tenor T_50Y = new Tenor(50, TenorCode.YEAR);
-
- public static final Tenor IMM = new Tenor(0, TenorCode.IMM);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -17,7 +17,7 @@
public enum TenorCode {
OVERNIGHT("ON", false), TOMNEXT("TN", false), SPOT("SP", false), SPOTNEXT("SN", false), SPOTWEEK("SW", false), DAY("D", true), WEEK(
- "W", true), MONTH("M", true), YEAR("Y", true), IMM("IMM", false);
+ "W", true), MONTH("M", true), YEAR("Y", true);
private final String code;
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Version.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -0,0 +1,68 @@
+/*
+ * $Id: org.eclipse.jdt.ui.prefs 99 2006-09-04 20:30:25Z marchy $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+
+import java.io.*;
+
+/**
+ *
+ * @author xhensevb
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class Version {
+ public static void main(String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Usage: java version <.class file>");
+ System.exit(1);
+ }
+
+ if (!new File(args[0]).exists()) {
+ System.err.println(args[0] + " does not exist!");
+ System.exit(2);
+ }
+
+ DataInputStream dis = new DataInputStream(new FileInputStream(args[0]));
+ int magic = dis.readInt();
+ if (magic != 0xcafebabe) {
+ System.err.println(args[0] + " is not a .class file");
+ System.exit(3);
+ }
+
+ int minor = dis.readShort();
+ int major = dis.readShort();
+ System.out.println("class file version is " + major + "." + minor);
+
+ String version = null;
+
+ if (major < 48) {
+ version = "1.3.1";
+ } else if (major == 48) {
+ version = "1.4.2";
+ } else if (major == 49) {
+ version = "1.5";
+ } else if (major == 50) {
+ version = "6";
+ } else {
+ version = "7";
+ }
+ System.out.println("You need to use JDK " + version + " or above");
+ }
+}
\ No newline at end of file
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractIMMDateTest.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -7,145 +7,135 @@
public abstract class AbstractIMMDateTest<E> extends TestCase {
- private DateCalculator<E> cal;
+ private IMMDateCalculator<E> cal;
public void setUp() {
cal = getDateCalculator("bla");
}
- protected abstract DateCalculator<E> getDateCalculator(String name);
+ protected abstract IMMDateCalculator<E> getDateCalculator(String name);
protected abstract E parseDate(String string);
- private void checkImm(final DateCalculator<E> cal, final E date, final boolean expected) {
+ private void checkImm(final IMMDateCalculator<E> cal, final E date, final boolean expected) {
assertEquals("check " + date, expected, cal.isIMMDate(date));
}
- public void testSanityCheck() {
- Assert.assertEquals("Name", "bla", cal.getName());
- Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size());
- }
-
public void testNextIMM() {
- final E startDate = parseDate("2006-08-01");
- cal.setStartDate(startDate);
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
+ E startDate = parseDate("2006-08-01");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-01-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-02-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-03-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getNextIMMDate());
+ startDate = parseDate("2006-01-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-02-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-03-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-04-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-05-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-06-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
+ startDate = parseDate("2006-04-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-05-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-06-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-07-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-08-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-09-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
+ startDate = parseDate("2006-07-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-08-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-09-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-10-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-11-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-12-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
+ startDate = parseDate("2006-10-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-11-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-12-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-03-14"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-03-15"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-03-16"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
+ startDate = parseDate("2006-03-14");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-03-15");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-03-16");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-06-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-06-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-06-22"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
+ startDate = parseDate("2006-06-20");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-06-21");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-06-22");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-09-19"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-09-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-09-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
+ startDate = parseDate("2006-09-19");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-09-20");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-09-21");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-12-19"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-12-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2007-03-21"), cal.getNextIMMDate());
- cal.setStartDate(parseDate("2006-12-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2007-03-21"), cal.getNextIMMDate());
+ startDate = parseDate("2006-12-19");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-12-20");
+ Assert.assertEquals("From " + startDate, parseDate("2007-03-21"), cal.getNextIMMDate(startDate));
+ startDate = parseDate("2006-12-21");
+ Assert.assertEquals("From " + startDate, parseDate("2007-03-21"), cal.getNextIMMDate(startDate));
- cal.setStartDate(parseDate("2006-03-15"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getNextIMMDate());
+ startDate = parseDate("2006-03-15");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getNextIMMDate(startDate));
}
public void testNextIMMWithPeriod() {
- final E startDate = parseDate("2006-08-01");
- cal.setStartDate(startDate);
+ E startDate = parseDate("2006-08-01");
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getNextIMMDate());
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getNextIMMDate(startDate));
IMMPeriod period = IMMPeriod.QUARTERLY;
- cal.setStartDate(parseDate("2006-01-09"));
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-03-15"), cal
- .getNextIMMDate(period));
+ startDate = parseDate("2006-01-09");
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-03-15"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_JUN_DEC;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-06-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-06-21"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_MAR_SEP;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-03-15"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-03-15"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.ANNUALLY;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2007-03-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2007-03-21"), cal.getNextIMMDate(startDate,
+ period));
- cal.setStartDate(parseDate("2006-03-20"));
+ startDate = parseDate("2006-03-20");
period = IMMPeriod.QUARTERLY;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-06-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-06-21"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_JUN_DEC;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-06-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-06-21"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_MAR_SEP;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-09-20"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-09-20"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.ANNUALLY;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2007-06-20"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2007-06-20"), cal.getNextIMMDate(startDate,
+ period));
- cal.setStartDate(parseDate("2006-03-15"));
+ startDate = parseDate("2006-03-15");
period = IMMPeriod.QUARTERLY;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-06-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-06-21"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_JUN_DEC;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-06-21"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-06-21"), cal.getNextIMMDate(startDate,
+ period));
period = IMMPeriod.BI_ANNUALY_MAR_SEP;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2006-09-20"), cal
- .getNextIMMDate(period));
- cal.setStartDate(parseDate("2006-03-15"));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2006-09-20"), cal.getNextIMMDate(startDate,
+ period));
+ startDate = parseDate("2006-03-15");
period = IMMPeriod.ANNUALLY;
- Assert.assertEquals("From " + cal.getStartDate() + " period:" + period, parseDate("2007-06-20"), cal
- .getNextIMMDate(period));
+ Assert.assertEquals("From " + startDate + " period:" + period, parseDate("2007-06-20"), cal.getNextIMMDate(startDate,
+ period));
}
public void testIfIMMDate() {
- final E startDate = parseDate("2006-08-01");
- cal.setStartDate(startDate);
-
checkImm(cal, parseDate("2006-08-01"), false);
checkImm(cal, parseDate("2006-03-14"), false);
@@ -165,89 +155,69 @@
checkImm(cal, parseDate("2006-12-21"), false);
}
- public void testMoveByIMMTenor() {
- final E startDate = parseDate("2006-04-01");
- cal.setStartDate(startDate);
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.moveByTenor(StandardTenor.IMM)
- .getCurrentBusinessDate());
- }
-
- public void testMoveByNullTenor() {
- final E startDate = parseDate("2006-04-01");
- cal.setStartDate(startDate);
-
- try {
- cal.moveByTenor(null);
- Assert.fail("Should have thrown IllegalArgumentException");
- } catch (final IllegalArgumentException e) {
- // ok
- }
- }
-
public void testPreviousIMM() {
- final E startDate = parseDate("2006-08-01");
- cal.setStartDate(startDate);
+ E startDate = parseDate("2006-08-01");
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-01-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2005-12-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-02-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2005-12-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-03-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2005-12-21"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-01-09");
+ Assert.assertEquals("From " + startDate, parseDate("2005-12-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-02-09");
+ Assert.assertEquals("From " + startDate, parseDate("2005-12-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-03-09");
+ Assert.assertEquals("From " + startDate, parseDate("2005-12-21"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-04-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-05-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-06-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-04-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-05-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-06-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-07-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-08-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-09-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-07-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-08-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-09-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-10-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-11-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-12-09"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-10-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-11-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-12-09");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
// close to dates
- cal.setStartDate(parseDate("2006-03-14"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2005-12-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-03-15"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2005-12-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-03-16"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-03-14");
+ Assert.assertEquals("From " + startDate, parseDate("2005-12-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-03-15");
+ Assert.assertEquals("From " + startDate, parseDate("2005-12-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-03-16");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-06-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-06-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-03-15"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-06-22"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-06-20");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-06-21");
+ Assert.assertEquals("From " + startDate, parseDate("2006-03-15"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-06-22");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-09-19"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-09-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-06-21"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-09-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-09-19");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-09-20");
+ Assert.assertEquals("From " + startDate, parseDate("2006-06-21"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-09-21");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
- cal.setStartDate(parseDate("2006-12-19"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-12-20"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-09-20"), cal.getPreviousIMMDate());
- cal.setStartDate(parseDate("2006-12-21"));
- Assert.assertEquals("From " + cal.getStartDate(), parseDate("2006-12-20"), cal.getPreviousIMMDate());
+ startDate = parseDate("2006-12-19");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-12-20");
+ Assert.assertEquals("From " + startDate, parseDate("2006-09-20"), cal.getPreviousIMMDate(startDate));
+ startDate = parseDate("2006-12-21");
+ Assert.assertEquals("From " + startDate, parseDate("2006-12-20"), cal.getPreviousIMMDate(startDate));
}
public void testIMMLists() {
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/TenorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/TenorTest.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/TenorTest.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -50,7 +50,6 @@
checkValidTenor("ON", false, TenorCode.OVERNIGHT, 0);
checkValidTenor("SW", false, TenorCode.SPOTWEEK, 0);
checkValidTenor("SN", false, TenorCode.SPOTNEXT, 0);
- checkValidTenor("IMM", false, TenorCode.IMM, 0);
checkValidTenor("TN", false, TenorCode.TOMNEXT, 0);
checkValidTenor("1D", true, TenorCode.DAY, 1);
@@ -79,7 +78,6 @@
checkToString("ON");
checkToString("SW");
checkToString("SN");
- checkToString("IMM");
checkToString("TN");
checkToString("1D");
checkToString("1W");
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkCalendarCalculatorFactory.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -0,0 +1,89 @@
+/*
+ * $Id: DefaultJdkDateCalculatorFactory.java 96 2006-09-04 15:01:20Z benoitx $
+ *
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.jdk;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.IMMDateCalculator;
+
+/**
+ * TODO add javadoc
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 96 $ $Date: 2006-09-04 16:01:20 +0100 (Mon, 04 Sep 2006) $
+ *
+ */
+public class DefaultJdkCalendarCalculatorFactory extends AbstractDateCalculatorFactory<Calendar> implements JdkCalendarCalculatorFactory {
+
+ private static final DefaultJdkCalendarCalculatorFactory DEFAULT = new DefaultJdkCalendarCalculatorFactory();
+
+ private static final CalendarPeriodCountCalculator PCC = new CalendarPeriodCountCalculator();
+
+ private static final JdkCalendarIMMDateCalculator IMMDC = new JdkCalendarIMMDateCalculator();
+
+ public static JdkCalendarCalculatorFactory getDefaultInstance() {
+ return DEFAULT;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
+ * java.lang.String)
+ */
+ public JdkCalendarDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
+ final JdkCalendarBaseDateCalculator cal = new JdkCalendarBaseDateCalculator();
+ cal.setName(name);
+ if (holidays.containsKey(name)) {
+ cal.setNonWorkingDays(holidays.get(name));
+ }
+
+ if (holidayHandlerType == null) {
+ return cal;
+ } else if (HolidayHandlerType.FORWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new ForwardHandler());
+ } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new BackwardHandler());
+ } else if (HolidayHandlerType.MODIFIED_FOLLLOWING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new ModifiedFollowingHandler());
+ } else if (HolidayHandlerType.MODIFIED_PRECEEDING.equals(holidayHandlerType)) {
+ cal.setHolidayHandler(new ModifiedPreceedingHandler());
+ } else {
+ throw new UnsupportedOperationException("Unsupported HolidayHandler: " + holidayHandlerType);
+ }
+
+ return cal;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
+ */
+ public CalendarPeriodCountCalculator getPeriodCountCalculator() {
+ return PCC;
+ }
+
+ public IMMDateCalculator<Calendar> getIMMDateCalculator() {
+ return IMMDC;
+ }
+
+}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultJdkDateCalculatorFactory.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -21,6 +21,7 @@
import net.objectlab.kit.datecalc.common.AbstractDateCalculatorFactory;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+import net.objectlab.kit.datecalc.common.IMMDateCalculator;
/**
* TODO add javadoc
@@ -36,6 +37,8 @@
private static final JdkDatePeriodCountCalculator PCC = new DatePeriodCountCalculator();
+ private static final JdkDateIMMDateCalculator IMMDC = new JdkDateIMMDateCalculator();
+
public static JdkDateCalculatorFactory getDefaultInstance() {
return DEFAULT;
}
@@ -46,7 +49,6 @@
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getDateCalculator(java.lang.String,
* java.lang.String)
*/
- @Override
public JdkDateCalculator getDateCalculator(final String name, final String holidayHandlerType) {
final JdkDateBaseDateCalculator cal = new JdkDateBaseDateCalculator();
cal.setName(name);
@@ -76,9 +78,12 @@
*
* @see net.objectlab.kit.datecalc.jdk.JdkDateCalculatorFactory#getPeriodCountCalculator()
*/
- @Override
public JdkDatePeriodCountCalculator getPeriodCountCalculator() {
return PCC;
}
+ public IMMDateCalculator<Date> getIMMDateCalculator() {
+ return IMMDC;
+ }
+
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-06 09:58:04 UTC (rev 118)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/JdkCalendarBaseDateCalculator.java 2006-09-06 12:28:21 UTC (rev 119)
@@ -17,16 +17,13 @@
*/
package net.objectlab.kit.datecalc.jdk;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
-import java.util.List;
import java.util.Set;
import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandler;
-import net.objectlab.kit.datecalc.common.IMMPeriod;
import net.objectlab.kit.datecalc.common.Tenor;
import net.objectlab.kit.datecalc.common.WorkingWeek;
@@ -93,123 +90,7 @@
return new JdkCalendarBaseDateCalculator(name, startDate, holidays, handler);
}
- /**
- * Returns a list of IMM dates between 2 dates, it will exclude the start
- * date if it is an IMM date but would include the end date if it is an IMM.
- *
- * @param start
- * start of the interval, excluded
- * @param end
- * end of the interval, may be included.
- * @param period
- * specify when the "next" IMM is, if quarterly then it is the
- * conventional algorithm.
- * @return list of IMM dates
- */
- public List<Calendar> getIMMDates(final Calendar start, final Calendar end, final IMMPeriod period) {
-
- final List<Calendar> dates = new ArrayList<Calendar>();
- Calendar cal = (Calendar) start.clone();
- while (true) {
- cal = getNextIMMDate(true, cal, period);
- if (!cal.after(end)) {
- dates.add(cal);
- } else {
- break;
- }
- }
-
- return dates;
- }
-
@Override
- protected Calendar getNextIMMDate(final boolean requestNextIMM, final Calendar startDate, final IMMPeriod period) {
-
- Calendar cal = (Calendar) startDate.clone();
-
- if (isIMMMonth(cal)) {
- moveToIMMDay(cal);
- // TODO simplify this if condition
-// if (forward ^ cal.getTime().before(startDate) ||
-// cal.getTime().equals(startDate)) {
- if ((requestNextIMM && cal.after(startDate)) || (!requestNextIMM && cal.before(startDate))) {
- return cal;
- }
- }
-
- final int delta = (requestNextIMM ? 1 : -1);
- do {
- cal.add(Calendar.MONTH, delta);
- } while (!isIMMMonth(cal));
-
- moveToIMMDay(cal);
-
- final int month = cal.get(Calendar.MONTH);
- if ( (period == IMMPeriod.BI_ANNUALY_JUN_DEC
- && (Calendar.MARCH == month || Calendar.SEPTEMBER==month) )
- ||
- ( period == IMMPeriod.BI_ANNUALY_MAR_SEP
- && (Calendar.JUNE == month || Calendar.DECEMBER==month) ) ) {
- // need to move to the next one.
- cal = getNextIMMDate(requestNextIMM, cal, period);
- } else if (period == IMMPeriod.ANNUALLY) {
- // second jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // third jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // fourth jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- // fifth jump
- cal = getNextIMMDate(requestNextIMM, cal, IMMPeriod.QUARTERLY);
- }
-
-
- return cal;
- }
-
- private boolean isIMMMonth(final Calendar cal) {
- final int month = cal.get(Calendar.MONTH);
-
- switch (month) {
- case Calendar.MARCH:
- case Calendar.JUNE:
- case Calendar.SEPTEMBER:
- case Calendar.DECEMBER:
- return true;
- }
-
- return false;
- }
-
- /**
- * Assumes that the month is correct, get the day for the 3rd wednesday.
- *
- * @param first
- * @return
- */
- private void moveToIMMDay(final Calendar cal) {
- cal.set(Calendar.DAY_OF_MONTH, 1);
-
- // go to 1st wed
- final int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
- if (dayOfWeek < Calendar.WEDNESDAY) {
- cal.add(Calendar.DA...
[truncated message content] |
|
From: <be...@us...> - 2006-09-06 09:58:24
|
Revision: 118
http://svn.sourceforge.net/objectlabkit/?rev=118&view=rev
Author: benoitx
Date: 2006-09-06 02:58:04 -0700 (Wed, 06 Sep 2006)
Log Message:
-----------
Add doco (package) and clarify some use on home page.
Modified Paths:
--------------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
trunk/src/site/index.xml
Added Paths:
-----------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/package.html
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/package.html
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/package.html
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/package.html (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/package.html 2006-09-06 09:58:04 UTC (rev 118)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<p>This package provides functionalities that are used by both JDK and Joda implementation,
+it is not released alone but included in the datecalc-jdk or datecalc-joda JARs.</p>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-05 23:24:58 UTC (rev 117)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/UtilsTest.java 2006-09-06 09:58:04 UTC (rev 118)
@@ -13,15 +13,12 @@
import junit.framework.TestCase;
public class UtilsTest extends TestCase {
+ private SimpleDateFormat sdf;
- SimpleDateFormat sdf;
+ private Set<Calendar> calendarSet;
- Calendar cal;
+ private Set<Date> dateSet;
- Set<Calendar> calendarSet;
-
- Set<Date> dateSet;
-
@Override
protected void setUp() throws Exception {
sdf = new SimpleDateFormat("yyyy-MM-dd");
Added: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/package.html
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/package.html (rev 0)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/package.html 2006-09-06 09:58:04 UTC (rev 118)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<p>This package provides a pure JDK implementation of the DateCalculator for both Calendar and Date, it is
+released as a standalone datecalc-jdk JAR.</p>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java 2006-09-05 23:24:58 UTC (rev 117)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java 2006-09-06 09:58:04 UTC (rev 118)
@@ -4,7 +4,6 @@
import net.objectlab.kit.datecalc.common.DateCalculator;
import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-import org.joda.time.LocalDate;
import org.joda.time.YearMonthDay;
public class YearMonthDayIMMDateTest extends AbstractIMMDateTest<YearMonthDay> {
Modified: trunk/src/site/index.xml
===================================================================
--- trunk/src/site/index.xml 2006-09-05 23:24:58 UTC (rev 117)
+++ trunk/src/site/index.xml 2006-09-06 09:58:04 UTC (rev 118)
@@ -79,22 +79,26 @@
should get its own!</li>
<li>when you get a DateCalculator, you can set the startDate, this sets the currentDate too. The startDate does not move. The current date is
the result of your calculations. If the startDate is a non-working day, it may be moved automatically according to the HolidayHandler.</li>
- <li>when you call addDays(..), moveByBusinessDays(..) the currentDate is moved in the Calculator.</li>
+ <li>when you call moveByDays(..), moveByBusinessDays(..) the currentDate is moved in the Calculator.</li>
</ul>
<pre>
// create or get the Holidays
final Set<LocalDate> holidays = new HashSet<LocalDate>();
holidays.add(new LocalDate("2006-08-28"));
+ // register the holidays (any calculator with name "UK" asked from now on will receive a reference to this set
DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", holidays);
+ // ask for a LocalDate calculator for "UK" (even if a new set of holidays is registered, this one calculator is not affected
DateCalculator<LocalDate> cal = DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD);
cal.setStartDate(new LocalDate("2006-08-28)); // this also sets the current business date.
// the startDate stays 28 Aug 06 BUT the currentDate has moved,
// according to Forward handler to 29 Aug 2006.
- cal.getStartDate(); // 28 Aug 06
- cal.getCurrentBusinessDate(); // 29 Aug 06
+ LocalDate start = cal.getStartDate(); // 28 Aug 06
+ LocalDate current = cal.getCurrentBusinessDate(); // 29 Aug 06
+
+ LocalDate newCurrent = cal.moveByDays(4).getCurrentBusinessDate(); // 4 Sept 06 due to weekend!
</pre>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 23:25:19
|
Revision: 117
http://svn.sourceforge.net/objectlabkit/?rev=117&view=rev
Author: benoitx
Date: 2006-09-05 16:24:58 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Added IMMDate test for YearMonthDay (thanks for doing the generic bit Marcin).
Modified Paths:
--------------
trunk/datecalc-joda/qalab.xml
Added Paths:
-----------
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
Removed Paths:
-------------
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-05 21:56:09 UTC (rev 116)
+++ trunk/datecalc-joda/qalab.xml 2006-09-05 23:24:58 UTC (rev 117)
@@ -57,7 +57,7 @@
<summaryresult date="2006-09-04" filecount="17" statvalue="84" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="17" statvalue="87" type="cobertura-branch"/>
<summaryresult date="2006-09-05" filecount="4" statvalue="40" type="simian"/>
- <summaryresult date="2006-09-05" filecount="17" statvalue="90" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="17" statvalue="91" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_joda_package.html" path="net/objectlab/kit/datecalc/joda/package.html">
@@ -315,7 +315,7 @@
<result date="2006-09-02" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="94" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="94" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file
@@ -324,7 +324,7 @@
<result date="2006-09-02" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="40" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="40" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java 2006-09-05 21:56:09 UTC (rev 116)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java 2006-09-05 23:24:58 UTC (rev 117)
@@ -1,20 +0,0 @@
-package net.objectlab.kit.datecalc.joda;
-
-import net.objectlab.kit.datecalc.common.AbstractIMMDateTest;
-import net.objectlab.kit.datecalc.common.DateCalculator;
-import net.objectlab.kit.datecalc.common.HolidayHandlerType;
-
-import org.joda.time.LocalDate;
-
-public class IMMDateTest extends AbstractIMMDateTest<LocalDate> {
-
- @Override
- protected DateCalculator<LocalDate> getDateCalculator(final String name) {
- return DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator(name, HolidayHandlerType.FORWARD);
- }
-
- @Override
- protected LocalDate parseDate(final String string) {
- return new LocalDate(string);
- }
-}
\ No newline at end of file
Copied: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java (from rev 113, trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java)
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateTest.java 2006-09-05 23:24:58 UTC (rev 117)
@@ -0,0 +1,20 @@
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractIMMDateTest;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+import org.joda.time.LocalDate;
+
+public class LocalDateIMMDateTest extends AbstractIMMDateTest<LocalDate> {
+
+ @Override
+ protected DateCalculator<LocalDate> getDateCalculator(final String name) {
+ return DefaultLocalDateCalculatorFactory.getDefaultInstance().getDateCalculator(name, HolidayHandlerType.FORWARD);
+ }
+
+ @Override
+ protected LocalDate parseDate(final String string) {
+ return new LocalDate(string);
+ }
+}
\ No newline at end of file
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayIMMDateTest.java 2006-09-05 23:24:58 UTC (rev 117)
@@ -0,0 +1,21 @@
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractIMMDateTest;
+import net.objectlab.kit.datecalc.common.DateCalculator;
+import net.objectlab.kit.datecalc.common.HolidayHandlerType;
+
+import org.joda.time.LocalDate;
+import org.joda.time.YearMonthDay;
+
+public class YearMonthDayIMMDateTest extends AbstractIMMDateTest<YearMonthDay> {
+
+ @Override
+ protected DateCalculator<YearMonthDay> getDateCalculator(final String name) {
+ return DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getDateCalculator(name, HolidayHandlerType.FORWARD);
+ }
+
+ @Override
+ protected YearMonthDay parseDate(final String string) {
+ return new YearMonthDay(string);
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 21:56:38
|
Revision: 116
http://svn.sourceforge.net/objectlabkit/?rev=116&view=rev
Author: benoitx
Date: 2006-09-05 14:56:09 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Added YearMonthDay Period count test.
Modified Paths:
--------------
trunk/datecalc-joda/qalab.xml
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
Added Paths:
-----------
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculatorTest.java
Removed Paths:
-------------
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-05 20:34:26 UTC (rev 115)
+++ trunk/datecalc-joda/qalab.xml 2006-09-05 21:56:09 UTC (rev 116)
@@ -56,7 +56,6 @@
<summaryresult date="2006-09-04" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-04" filecount="17" statvalue="84" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="17" statvalue="87" type="cobertura-branch"/>
- <summaryresult date="2006-09-05" filecount="18" statvalue="2" type="checkstyle"/>
<summaryresult date="2006-09-05" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="90" type="cobertura-line"/>
<summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
@@ -352,7 +351,6 @@
<result date="2006-09-04" statvalue="4" type="checkstyle"/>
<result date="2006-09-04" statvalue="100" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java 2006-09-05 20:34:26 UTC (rev 115)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultYearMonthDayPeriodCountCalculator.java 2006-09-05 21:56:09 UTC (rev 116)
@@ -18,6 +18,6 @@
}
public double yearDiff(final YearMonthDay start, final YearMonthDay end, final PeriodCountBasis basis) {
- return DELEGATE.monthDiff(start.toLocalDate(), end.toLocalDate(), basis);
+ return DELEGATE.yearDiff(start.toLocalDate(), end.toLocalDate(), basis);
}
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-05 20:34:26 UTC (rev 115)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2006-09-05 21:56:09 UTC (rev 116)
@@ -114,6 +114,29 @@
LocalDate date = start;
final int month = date.getMonthOfYear();
+ date = calculateIMMMonth(requestNextIMM, date, month);
+
+ LocalDate imm = calculate3rdWednesday(date);
+ final int immMonth = imm.getMonthOfYear();
+ final boolean isMarchSept = DateTimeConstants.MARCH == immMonth || DateTimeConstants.SEPTEMBER == immMonth;
+
+ if (period == IMMPeriod.BI_ANNUALY_JUN_DEC && isMarchSept || period == IMMPeriod.BI_ANNUALY_MAR_SEP && !isMarchSept) {
+ imm = getNextIMMDate(requestNextIMM, imm, period);
+ } else if (period == IMMPeriod.ANNUALLY) {
+ // second jump
+ imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
+ // third jump
+ imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
+ // fourth jump
+ imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
+ // fifth jump
+ imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
+ }
+
+ return imm;
+ }
+
+ private LocalDate calculateIMMMonth(final boolean requestNextIMM, LocalDate date, final int month) {
int monthOffset = 0;
switch (month) {
@@ -139,26 +162,7 @@
}
break;
}
-
- LocalDate imm = calculate3rdWednesday(date);
- final int immMonth = imm.getMonthOfYear();
- final boolean isMarchSept = DateTimeConstants.MARCH == immMonth || DateTimeConstants.SEPTEMBER == immMonth;
-
- if ( period == IMMPeriod.BI_ANNUALY_JUN_DEC && isMarchSept
- || period == IMMPeriod.BI_ANNUALY_MAR_SEP && !isMarchSept) {
- imm = getNextIMMDate(requestNextIMM, imm, period);
- } else if (period == IMMPeriod.ANNUALLY) {
- // second jump
- imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
- // third jump
- imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
- // fourth jump
- imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
- // fifth jump
- imm = getNextIMMDate(requestNextIMM, imm, IMMPeriod.QUARTERLY);
- }
-
- return imm;
+ return date;
}
/**
@@ -176,20 +180,20 @@
}
return firstWed.plusWeeks(2);
}
-
+
/**
* @param date
* @return true if that date is an IMM date.
*/
public boolean isIMMDate(final LocalDate date) {
boolean same = false;
-
+
final List<LocalDate> dates = getIMMDates(date.minusDays(1), date, IMMPeriod.QUARTERLY);
if (!dates.isEmpty()) {
same = date.equals(dates.get(0));
}
-
+
return same;
}
}
Copied: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculatorTest.java (from rev 113, trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java)
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculatorTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculatorTest.java 2006-09-05 21:56:09 UTC (rev 116)
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ * Copyright 2006 the original author or authors.
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+
+import org.joda.time.LocalDate;
+
+public class LocalDatePeriodCountCalculatorTest extends AbstractPeriodCountCalculator<LocalDate> {
+
+ @Override
+ public PeriodCountCalculator<LocalDate> getPeriodCountCalculator() {
+ return DefaultLocalDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ }
+
+ @Override
+ public LocalDate parseDate(final String string) {
+ return new LocalDate(string);
+ }
+
+ @Override
+ public LocalDate getDate() {
+ return new LocalDate();
+ }
+
+}
\ No newline at end of file
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java 2006-09-05 20:34:26 UTC (rev 115)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java 2006-09-05 21:56:09 UTC (rev 116)
@@ -1,42 +0,0 @@
-/*
- * $Id$
- * Copyright 2006 the original author or authors.
- * Copyright 2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package net.objectlab.kit.datecalc.joda;
-
-import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
-import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
-
-import org.joda.time.LocalDate;
-
-public class PeriodCountCalculatorTest extends AbstractPeriodCountCalculator<LocalDate> {
-
- @Override
- public PeriodCountCalculator<LocalDate> getPeriodCountCalculator() {
- return DefaultLocalDateCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
- }
-
- @Override
- public LocalDate parseDate(final String string) {
- return new LocalDate(string);
- }
-
- @Override
- public LocalDate getDate() {
- return new LocalDate();
- }
-
-}
\ No newline at end of file
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculatorTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPeriodCountCalculatorTest.java 2006-09-05 21:56:09 UTC (rev 116)
@@ -0,0 +1,42 @@
+/*
+ * $Id: LocalDatePeriodCountCalculatorTest.java 109 2006-09-05 11:16:39Z benoitx $
+ * Copyright 2006 the original author or authors.
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.joda;
+
+import net.objectlab.kit.datecalc.common.AbstractPeriodCountCalculator;
+import net.objectlab.kit.datecalc.common.PeriodCountCalculator;
+
+import org.joda.time.YearMonthDay;
+
+public class YearMonthDayPeriodCountCalculatorTest extends AbstractPeriodCountCalculator<YearMonthDay> {
+
+ @Override
+ public PeriodCountCalculator<YearMonthDay> getPeriodCountCalculator() {
+ return DefaultYearMonthDayCalculatorFactory.getDefaultInstance().getPeriodCountCalculator();
+ }
+
+ @Override
+ public YearMonthDay parseDate(final String string) {
+ return new YearMonthDay(string);
+ }
+
+ @Override
+ public YearMonthDay getDate() {
+ return new YearMonthDay();
+ }
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 20:36:38
|
Revision: 115
http://svn.sourceforge.net/objectlabkit/?rev=115&view=rev
Author: benoitx
Date: 2006-09-05 13:34:26 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
updated by latest build.
Modified Paths:
--------------
trunk/datecalc-jdk/qalab.xml
trunk/datecalc-joda/qalab.xml
Modified: trunk/datecalc-jdk/qalab.xml
===================================================================
--- trunk/datecalc-jdk/qalab.xml 2006-09-05 20:23:07 UTC (rev 114)
+++ trunk/datecalc-jdk/qalab.xml 2006-09-05 20:34:26 UTC (rev 115)
@@ -53,8 +53,8 @@
<summaryresult date="2006-09-04" filecount="16" statvalue="77" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="16" statvalue="79" type="cobertura-branch"/>
<summaryresult date="2006-09-05" filecount="16" statvalue="14" type="checkstyle"/>
- <summaryresult date="2006-09-05" filecount="24" statvalue="63" type="cobertura-line"/>
- <summaryresult date="2006-09-05" filecount="24" statvalue="88" type="cobertura-branch"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="83" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="87" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_jdk_package.html" path="net/objectlab/kit/datecalc/jdk/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -251,7 +251,7 @@
<result date="2006-09-02" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="79" type="cobertura-line"/>
<result date="2006-09-04" statvalue="84" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="78" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="79" type="cobertura-line"/>
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
</file>
<file
@@ -321,7 +321,7 @@
id="net_objectlab_kit_datecalc_jdk_JdkDateBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java">
<result date="2006-09-04" statvalue="91" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="92" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="91" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java">
@@ -338,38 +338,20 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file
- id="net_objectlab_kit_datecalc_jdk_AbstractDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_AbstractDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_DateCalculatorFactoryTest.java" path="net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_DateCalculatorFactoryTest.java" path="net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
- <file id="net_objectlab_kit_datecalc_jdk_IMMDateTest.java" path="net/objectlab/kit/datecalc/jdk/IMMDateTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java"/>
+ <file id="net_objectlab_kit_datecalc_jdk_IMMDateTest.java" path="net/objectlab/kit/datecalc/jdk/IMMDateTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_JdkDateBackwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBackwardDateCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_JdkDateBackwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBackwardDateCalculatorTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_JdkDateDateCalculatorCombinationTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateDateCalculatorCombinationTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_JdkDateDateCalculatorCombinationTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateDateCalculatorCombinationTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_JdkDateForwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateForwardDateCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_JdkDateForwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateForwardDateCalculatorTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedFollowingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedFollowingDateCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedFollowingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedFollowingDateCalculatorTest.java"/>
<file
- id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedPreceedingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedPreceedingDateCalculatorTest.java">
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
- </file>
+ id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedPreceedingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedPreceedingDateCalculatorTest.java"/>
</qalab>
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-05 20:23:07 UTC (rev 114)
+++ trunk/datecalc-joda/qalab.xml 2006-09-05 20:34:26 UTC (rev 115)
@@ -398,7 +398,7 @@
<result date="2006-09-02" statvalue="83" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="64" type="cobertura-line"/>
<result date="2006-09-04" statvalue="71" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="66" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="64" type="cobertura-line"/>
<result date="2006-09-05" statvalue="71" type="cobertura-branch"/>
</file>
<file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 20:23:27
|
Revision: 114
http://svn.sourceforge.net/objectlabkit/?rev=114&view=rev
Author: benoitx
Date: 2006-09-05 13:23:07 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Fix build as the package changed! Marcin, you must update.
Modified Paths:
--------------
trunk/common-build/project.properties
trunk/datecalc-common/qalab.xml
trunk/datecalc-jdk/project.xml
trunk/datecalc-joda/project.xml
Modified: trunk/common-build/project.properties
===================================================================
--- trunk/common-build/project.properties 2006-09-05 17:59:19 UTC (rev 113)
+++ trunk/common-build/project.properties 2006-09-05 20:23:07 UTC (rev 114)
@@ -23,7 +23,7 @@
maven.compile.target=5
# Source code is 1.5
maven.compile.source=1.5
-maven.compile.verbose=true
+#maven.compile.verbose=true
maven.multiproject.ignoreFailures=true
Modified: trunk/datecalc-common/qalab.xml
===================================================================
--- trunk/datecalc-common/qalab.xml 2006-09-05 17:59:19 UTC (rev 113)
+++ trunk/datecalc-common/qalab.xml 2006-09-05 20:23:07 UTC (rev 114)
@@ -52,8 +52,8 @@
<summaryresult date="2006-09-04" filecount="14" statvalue="64" type="cobertura-branch"/>
<summaryresult date="2006-09-05" filecount="16" statvalue="9" type="checkstyle"/>
<summaryresult date="2006-09-05" filecount="1" statvalue="1" type="findbugs"/>
- <summaryresult date="2006-09-05" filecount="15" statvalue="64" type="cobertura-line"/>
- <summaryresult date="2006-09-05" filecount="15" statvalue="69" type="cobertura-branch"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="63" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="67" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_common_package.html" path="net/objectlab/kit/datecalc/common/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -273,7 +273,7 @@
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
<result date="2006-09-04" statvalue="90" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="84" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="85" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMPeriod.java" path="net/objectlab/kit/datecalc/common/IMMPeriod.java">
@@ -281,7 +281,7 @@
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/common/ExcelDateUtil.java">
- <result date="2006-09-05" statvalue="87" type="cobertura-line"/>
- <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ <result date="2006-09-05" statvalue="84" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="83" type="cobertura-branch"/>
</file>
</qalab>
Modified: trunk/datecalc-jdk/project.xml
===================================================================
--- trunk/datecalc-jdk/project.xml 2006-09-05 17:59:19 UTC (rev 113)
+++ trunk/datecalc-jdk/project.xml 2006-09-05 20:23:07 UTC (rev 114)
@@ -28,7 +28,7 @@
</repository>
<dependencies>
<dependency>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc-common</artifactId>
<version>${pom.currentVersion}</version>
<type>jar</type>
Modified: trunk/datecalc-joda/project.xml
===================================================================
--- trunk/datecalc-joda/project.xml 2006-09-05 17:59:19 UTC (rev 113)
+++ trunk/datecalc-joda/project.xml 2006-09-05 20:23:07 UTC (rev 114)
@@ -21,7 +21,7 @@
</repository>
<dependencies>
<dependency>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<artifactId>datecalc-common</artifactId>
<version>${pom.currentVersion}</version>
<type>jar</type>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 17:59:44
|
Revision: 113
http://svn.sourceforge.net/objectlabkit/?rev=113&view=rev
Author: benoitx
Date: 2006-09-05 10:59:19 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Work around a bug in JDK 6 compiler (target must be 5 and not 1.5 as per doc).
Modified Paths:
--------------
trunk/common-build/project.properties
trunk/common-build/project.xml
trunk/datecalc-common/qalab.xml
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
trunk/datecalc-jdk/qalab.xml
trunk/datecalc-joda/qalab.xml
trunk/maven.xml
Modified: trunk/common-build/project.properties
===================================================================
--- trunk/common-build/project.properties 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/common-build/project.properties 2006-09-05 17:59:19 UTC (rev 113)
@@ -20,18 +20,19 @@
maven.junit.format = plain
# Target 1.5 JVMs
-maven.compile.target = 1.5
+maven.compile.target=5
# Source code is 1.5
-maven.compile.source = 1.5
+maven.compile.source=1.5
+maven.compile.verbose=true
-maven.aspectj.source=1.5
+maven.multiproject.ignoreFailures=true
-maven.aspectj.reweavable=true
-
# Deprecation compilation
maven.compile.deprecation=on
maven.javadoc.debug=true
-internal_javadoc_needed=true
+#pom.package=net.objectlab.kit.*
+#maven.javadoc.extrasourcepath=../datecalc-jdk/src/main/java/**.java
+#internal_javadoc_needed=true
# -------------------------------------------------------------------
# T E S T P R O P E R T I E S
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/common-build/project.xml 2006-09-05 17:59:19 UTC (rev 113)
@@ -107,11 +107,11 @@
<reports>
<report>maven-checkstyle-plugin</report>
- <!--<report>maven-findbugs-plugin</report>-->
+ <report>maven-findbugs-plugin</report>
<report>maven-pmd-plugin</report>
<report>maven-simian-plugin</report>
- <!--<report>maven-cobertura-plugin</report>-->
- <!--<report>maven-qalab-plugin</report>-->
+ <report>maven-cobertura-plugin</report>
+ <report>maven-qalab-plugin</report>
<report>maven-javadoc-plugin</report>
<report>maven-jdepend-plugin</report>
<report>maven-faq-plugin</report>
Modified: trunk/datecalc-common/qalab.xml
===================================================================
--- trunk/datecalc-common/qalab.xml 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-common/qalab.xml 2006-09-05 17:59:19 UTC (rev 113)
@@ -50,10 +50,10 @@
<summaryresult date="2006-09-04" filecount="1" statvalue="1" type="findbugs"/>
<summaryresult date="2006-09-04" filecount="14" statvalue="61" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="14" statvalue="64" type="cobertura-branch"/>
- <summaryresult date="2006-09-05" filecount="15" statvalue="12" type="checkstyle"/>
+ <summaryresult date="2006-09-05" filecount="16" statvalue="9" type="checkstyle"/>
<summaryresult date="2006-09-05" filecount="1" statvalue="1" type="findbugs"/>
- <summaryresult date="2006-09-05" filecount="14" statvalue="61" type="cobertura-line"/>
- <summaryresult date="2006-09-05" filecount="14" statvalue="64" type="cobertura-branch"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="64" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="15" statvalue="69" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_common_package.html" path="net/objectlab/kit/datecalc/common/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -241,7 +241,7 @@
<result date="2006-09-02" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="2" type="checkstyle"/>
+ <result date="2006-09-05" statvalue="1" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file
@@ -273,12 +273,15 @@
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
<result date="2006-09-04" statvalue="90" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="2" type="checkstyle"/>
- <result date="2006-09-05" statvalue="90" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="84" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_common_IMMPeriod.java" path="net/objectlab/kit/datecalc/common/IMMPeriod.java">
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
+ <file id="net_objectlab_kit_datecalc_common_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/common/ExcelDateUtil.java">
+ <result date="2006-09-05" statvalue="87" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactory.java 2006-09-05 17:59:19 UTC (rev 113)
@@ -48,8 +48,8 @@
* @param holidays
* the set of holidays (non-working days).
*/
- public void registerHolidays(final String name, final Set<E> holidays) {
- this.holidays.put(name, holidays);
+ public void registerHolidays(final String name, final Set<E> holidaysSet) {
+ this.holidays.put(name, holidaysSet);
}
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/ExcelDateUtil.java 2006-09-05 17:59:19 UTC (rev 113)
@@ -30,7 +30,7 @@
* @version $Revision: 99 $ $Date: 2006-09-04 21:30:25 +0100 (Mon, 04 Sep 2006) $
*
*/
-public class ExcelDateUtil {
+public final class ExcelDateUtil {
private static final double HALF_MILLISEC = 0.5;
private static final int EXCEL_FUDGE_19000229 = 61;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-05 17:59:19 UTC (rev 113)
@@ -28,17 +28,17 @@
*/
public interface PeriodCountCalculator<E> {
- static final int YEAR_360 = 360;
+ final int YEAR_360 = 360;
- static final int MONTHS_IN_YEAR = 12;
+ final int MONTHS_IN_YEAR = 12;
- static final double YEAR_365_0 = 365.0;
+ final double YEAR_365_0 = 365.0;
- static final double YEAR_360_0 = 360.0;
+ final double YEAR_360_0 = 360.0;
- static final int MONTH_31_DAYS = 31;
+ final int MONTH_31_DAYS = 31;
- static final int MONTH_30_DAYS = 30;
+ final int MONTH_30_DAYS = 30;
int dayDiff(final E start, final E end, PeriodCountBasis basis);
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-05 17:59:19 UTC (rev 113)
@@ -33,11 +33,13 @@
* @version $Revision$ $Date$
*
*/
-public class Utils {
+public final class Utils {
private static final String DATE_PATTERN = "yyyy-MM-dd";
private static final SimpleDateFormat SDF = new SimpleDateFormat(DATE_PATTERN);
+
+ private Utils() {}
public static Calendar getCal(final Date date) {
final Calendar cal = Calendar.getInstance();
@@ -50,7 +52,13 @@
return cal;
}
- public static Date createDate(final String str) throws IllegalArgumentException {
+ /**
+ *
+ * @param str string
+ * @return
+ * @throws IllegalArgumentException if the string cannot be parsed.
+ */
+ public static Date createDate(final String str) {
try {
final Date date = SDF.parse(str);
final Calendar cal = getCal(date);
@@ -60,7 +68,13 @@
}
}
- public static Calendar createCalendar(final String str) throws IllegalArgumentException {
+ /**
+ *
+ * @param str string
+ * @return
+ * @throws IllegalArgumentException if the string cannot be parsed.
+ */
+ public static Calendar createCalendar(final String str) {
try {
final Date date = SDF.parse(str);
final Calendar cal = getCal(date);
Modified: trunk/datecalc-jdk/qalab.xml
===================================================================
--- trunk/datecalc-jdk/qalab.xml 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-jdk/qalab.xml 2006-09-05 17:59:19 UTC (rev 113)
@@ -52,9 +52,9 @@
<summaryresult date="2006-09-04" filecount="17" statvalue="18" type="checkstyle"/>
<summaryresult date="2006-09-04" filecount="16" statvalue="77" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="16" statvalue="79" type="cobertura-branch"/>
- <summaryresult date="2006-09-05" filecount="17" statvalue="18" type="checkstyle"/>
- <summaryresult date="2006-09-05" filecount="16" statvalue="77" type="cobertura-line"/>
- <summaryresult date="2006-09-05" filecount="16" statvalue="79" type="cobertura-branch"/>
+ <summaryresult date="2006-09-05" filecount="16" statvalue="14" type="checkstyle"/>
+ <summaryresult date="2006-09-05" filecount="24" statvalue="63" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="24" statvalue="88" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_jdk_package.html" path="net/objectlab/kit/datecalc/jdk/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -251,7 +251,7 @@
<result date="2006-09-02" statvalue="84" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="79" type="cobertura-line"/>
<result date="2006-09-04" statvalue="84" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="79" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="78" type="cobertura-line"/>
<result date="2006-09-05" statvalue="84" type="cobertura-branch"/>
</file>
<file
@@ -269,7 +269,6 @@
<file id="net_objectlab_kit_datecalc_jdk_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/jdk/ExcelDateUtil.java">
<result date="2006-09-02" statvalue="4" type="checkstyle"/>
<result date="2006-09-04" statvalue="4" type="checkstyle"/>
- <result date="2006-09-05" statvalue="4" type="checkstyle"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_ModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/jdk/ModifiedFollowingHandler.java">
@@ -292,8 +291,8 @@
<result date="2006-09-04" statvalue="86" type="cobertura-line"/>
<result date="2006-09-04" statvalue="85" type="cobertura-branch"/>
<result date="2006-09-05" statvalue="8" type="checkstyle"/>
- <result date="2006-09-05" statvalue="86" type="cobertura-line"/>
- <result date="2006-09-05" statvalue="85" type="cobertura-branch"/>
+ <result date="2006-09-05" statvalue="87" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="86" type="cobertura-branch"/>
</file>
<file
id="net_objectlab_kit_datecalc_jdk_JdkDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculatorFactory.java">
@@ -322,7 +321,7 @@
id="net_objectlab_kit_datecalc_jdk_JdkDateBaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBaseDateCalculator.java">
<result date="2006-09-04" statvalue="91" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="91" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="92" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
<file id="net_objectlab_kit_datecalc_jdk_JdkDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/JdkDateCalculator.java">
@@ -338,4 +337,39 @@
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_AbstractDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DateCalculatorFactoryTest.java" path="net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_DatePeriodCountCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/DatePeriodCountCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file id="net_objectlab_kit_datecalc_jdk_IMMDateTest.java" path="net/objectlab/kit/datecalc/jdk/IMMDateTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateBackwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateBackwardDateCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateDateCalculatorCombinationTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateDateCalculatorCombinationTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateForwardDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateForwardDateCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedFollowingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedFollowingDateCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
+ <file
+ id="net_objectlab_kit_datecalc_jdk_JdkDateModifiedPreceedingDateCalculatorTest.java" path="net/objectlab/kit/datecalc/jdk/JdkDateModifiedPreceedingDateCalculatorTest.java">
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/datecalc-joda/qalab.xml
===================================================================
--- trunk/datecalc-joda/qalab.xml 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/datecalc-joda/qalab.xml 2006-09-05 17:59:19 UTC (rev 113)
@@ -56,10 +56,10 @@
<summaryresult date="2006-09-04" filecount="4" statvalue="40" type="simian"/>
<summaryresult date="2006-09-04" filecount="17" statvalue="84" type="cobertura-line"/>
<summaryresult date="2006-09-04" filecount="17" statvalue="87" type="cobertura-branch"/>
- <summaryresult date="2006-09-05" filecount="18" statvalue="10" type="checkstyle"/>
+ <summaryresult date="2006-09-05" filecount="18" statvalue="2" type="checkstyle"/>
<summaryresult date="2006-09-05" filecount="4" statvalue="40" type="simian"/>
- <summaryresult date="2006-09-05" filecount="17" statvalue="84" type="cobertura-line"/>
- <summaryresult date="2006-09-05" filecount="17" statvalue="87" type="cobertura-branch"/>
+ <summaryresult date="2006-09-05" filecount="17" statvalue="90" type="cobertura-line"/>
+ <summaryresult date="2006-09-05" filecount="17" statvalue="93" type="cobertura-branch"/>
</summary>
<file id="net_objectlab_kit_datecalc_joda_package.html" path="net/objectlab/kit/datecalc/joda/package.html">
<result date="2006-08-08" statvalue="1" type="checkstyle"/>
@@ -168,7 +168,6 @@
<result date="2006-09-04" statvalue="2" type="checkstyle"/>
<result date="2006-09-04" statvalue="100" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
@@ -292,7 +291,6 @@
<file id="net_objectlab_kit_datecalc_joda_ExcelDateUtil.java" path="net/objectlab/kit/datecalc/joda/ExcelDateUtil.java">
<result date="2006-09-02" statvalue="4" type="checkstyle"/>
<result date="2006-09-04" statvalue="4" type="checkstyle"/>
- <result date="2006-09-05" statvalue="4" type="checkstyle"/>
</file>
<file
id="net_objectlab_kit_datecalc_joda_DefaultLocalDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DefaultLocalDateCalculatorFactory.java">
@@ -354,7 +352,7 @@
<result date="2006-09-04" statvalue="4" type="checkstyle"/>
<result date="2006-09-04" statvalue="100" type="cobertura-line"/>
<result date="2006-09-04" statvalue="100" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="4" type="checkstyle"/>
+ <result date="2006-09-05" statvalue="2" type="checkstyle"/>
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
@@ -400,7 +398,7 @@
<result date="2006-09-02" statvalue="83" type="cobertura-branch"/>
<result date="2006-09-04" statvalue="64" type="cobertura-line"/>
<result date="2006-09-04" statvalue="71" type="cobertura-branch"/>
- <result date="2006-09-05" statvalue="64" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="66" type="cobertura-line"/>
<result date="2006-09-05" statvalue="71" type="cobertura-branch"/>
</file>
<file
@@ -430,4 +428,8 @@
<result date="2006-09-05" statvalue="100" type="cobertura-line"/>
<result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
</file>
+ <file id="net_objectlab_kit_datecalc_joda_JodaExcelDateUtil.java" path="net/objectlab/kit/datecalc/joda/JodaExcelDateUtil.java">
+ <result date="2006-09-05" statvalue="85" type="cobertura-line"/>
+ <result date="2006-09-05" statvalue="100" type="cobertura-branch"/>
+ </file>
</qalab>
Modified: trunk/maven.xml
===================================================================
--- trunk/maven.xml 2006-09-05 15:52:39 UTC (rev 112)
+++ trunk/maven.xml 2006-09-05 17:59:19 UTC (rev 113)
@@ -33,6 +33,11 @@
<attainGoal name="multiproject:goal" />
</goal>
+ <goal name="kit:site">
+ <attainGoal name="dist:multiproject-bin" />
+ <attainGoal name="dist:multiproject-src" />
+ </goal>
+
<goal name="kit:clean" prereqs="multiproject:clean,clean" />
<goal name="kit:generate" prereqs="multiproject:projects-init">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 16:05:38
|
Revision: 112
http://svn.sourceforge.net/objectlabkit/?rev=112&view=rev
Author: benoitx
Date: 2006-09-05 08:52:39 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Tidy up for consolidated javadoc and better site.
Modified Paths:
--------------
trunk/common-build/project.xml
trunk/datecalc-common/project.xml
trunk/datecalc-jdk/project.xml
trunk/datecalc-joda/project.xml
trunk/src/site/algo.xml
trunk/src/site/navigation.xml
Modified: trunk/common-build/project.xml
===================================================================
--- trunk/common-build/project.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/common-build/project.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -10,7 +10,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/3.0.0 http://maven.apache.org/maven-v3_0_0.xsd">
<pomVersion>3</pomVersion>
- <groupId>net.objectlab.kit</groupId>
+ <groupId>net.objectlab.kit.datecalc</groupId>
<currentVersion>1.0</currentVersion>
<organization>
<name>ObjectLab Financial Ltd</name>
@@ -105,6 +105,21 @@
<defaultGoal>kit:build</defaultGoal>
</build>
+ <reports>
+ <report>maven-checkstyle-plugin</report>
+ <!--<report>maven-findbugs-plugin</report>-->
+ <report>maven-pmd-plugin</report>
+ <report>maven-simian-plugin</report>
+ <!--<report>maven-cobertura-plugin</report>-->
+ <!--<report>maven-qalab-plugin</report>-->
+ <report>maven-javadoc-plugin</report>
+ <report>maven-jdepend-plugin</report>
+ <report>maven-faq-plugin</report>
+ <report>maven-junit-report-plugin</report>
+ <report>maven-jxr-plugin</report>
+ <report>maven-tasklist-plugin</report>
+ </reports>
+
<versions>
<version>
<id>1.0</id>
Modified: trunk/datecalc-common/project.xml
===================================================================
--- trunk/datecalc-common/project.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/datecalc-common/project.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -12,7 +12,7 @@
<extend>../common-build/project.xml</extend>
<name>DateCalc Common</name>
<artifactId>datecalc-common</artifactId>
- <package>net.objectlab.kit.common</package>
+ <package>net.objectlab.kit.datecalc</package>
<shortDescription>DateCalc Common library</shortDescription>
<description>
DateCalc Common library is the library used by both JDK and JODA
@@ -28,21 +28,6 @@
</repository>
<dependencies></dependencies>
- <reports>
- <report>maven-checkstyle-plugin</report>
- <report>maven-findbugs-plugin</report>
- <report>maven-pmd-plugin</report>
- <report>maven-simian-plugin</report>
- <report>maven-cobertura-plugin</report>
- <report>maven-qalab-plugin</report>
- <report>maven-ydoc-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-faq-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-tasklist-plugin</report>
- </reports>
-
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
Modified: trunk/datecalc-jdk/project.xml
===================================================================
--- trunk/datecalc-jdk/project.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/datecalc-jdk/project.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -12,7 +12,7 @@
<extend>../common-build/project.xml</extend>
<name>DateCalc JDK</name>
<artifactId>datecalc-jdk</artifactId>
- <package>net.objectlab.kit</package>
+ <package>net.objectlab.kit.datecalc</package>
<shortDescription>DateCalc JDK library</shortDescription>
<description>
This library provides pure JDK implementation of the Date
@@ -35,20 +35,6 @@
</dependency>
</dependencies>
- <reports>
- <report>maven-checkstyle-plugin</report>
- <report>maven-findbugs-plugin</report>
- <report>maven-pmd-plugin</report>
- <report>maven-simian-plugin</report>
- <report>maven-cobertura-plugin</report>
- <report>maven-qalab-plugin</report>
- <report>maven-ydoc-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-faq-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-tasklist-plugin</report>
- </reports>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
Modified: trunk/datecalc-joda/project.xml
===================================================================
--- trunk/datecalc-joda/project.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/datecalc-joda/project.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -12,7 +12,7 @@
<extend>../common-build/project.xml</extend>
<name>DateCalc Joda</name>
<artifactId>datecalc-joda</artifactId>
- <package>net.objectlab.kit</package>
+ <package>net.objectlab.kit.datecalc</package>
<shortDescription>DateCalc JDK library</shortDescription>
<description>This library provides a JODA-time implementation of the Date Calculator.</description>
<repository>
@@ -34,22 +34,7 @@
</dependency>
</dependencies>
- <reports>
- <report>maven-checkstyle-plugin</report>
- <report>maven-findbugs-plugin</report>
- <report>maven-pmd-plugin</report>
- <report>maven-simian-plugin</report>
- <report>maven-cobertura-plugin</report>
- <report>maven-qalab-plugin</report>
- <report>maven-ydoc-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-faq-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-tasklist-plugin</report>
- </reports>
-
- <build>
+ <build>
<sourceDirectory>src/main/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<!-- TODO: to be removed as it is not generic -->
Modified: trunk/src/site/algo.xml
===================================================================
--- trunk/src/site/algo.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/src/site/algo.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -15,17 +15,17 @@
<img src="forward.png"/>
</subsection>
- <subsection name="backward">
- <p>If the date is a non-working day, move backward to the previous working day.</p>
- <img src="backward.png"/>
- </subsection>
-
<subsection name="Modified Following">
<p>If the date is a non-working day, move forward to the next working day,
UNLESS it crosses over a new month, in which case we revert to find the last working day of the current month.</p>
<img src="modif-following.png"/>
</subsection>
+ <subsection name="Backward">
+ <p>If the date is a non-working day, move backward to the previous working day.</p>
+ <img src="backward.png"/>
+ </subsection>
+
<subsection name="Modified Preceeding">
<p>If the date is a non-working day, move backward to the previous working day,
UNLESS it crosses over a new month, in which case we revert to find the next working day of the current month.</p>
Modified: trunk/src/site/navigation.xml
===================================================================
--- trunk/src/site/navigation.xml 2006-09-05 15:44:30 UTC (rev 111)
+++ trunk/src/site/navigation.xml 2006-09-05 15:52:39 UTC (rev 112)
@@ -13,6 +13,7 @@
<item name="DateCalc JDK" href="multiproject/datecalc-jdk/index.html"/>
<item name="DateCalc JODA" href="multiproject/datecalc-joda/index.html"/>
<item name="Holiday Handler" href="algo.html"/>
+ <item name="JavaDoc" href="apidocs/index.html"/>
</menu>
<!--
<menu name="Related Projects">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 15:44:41
|
Revision: 111
http://svn.sourceforge.net/objectlabkit/?rev=111&view=rev
Author: benoitx
Date: 2006-09-05 08:44:30 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Typo...
Added Paths:
-----------
trunk/src/site/algo.xml
Added: trunk/src/site/algo.xml
===================================================================
--- trunk/src/site/algo.xml (rev 0)
+++ trunk/src/site/algo.xml 2006-09-05 15:44:30 UTC (rev 111)
@@ -0,0 +1,38 @@
+<document>
+ <properties>
+ <author email="Ki...@ob...">Benoit Xhenseval</author>
+ <title>ObjectLab Kit - Holiday Handler Algorithms</title>
+ </properties>
+ <head>
+
+ </head>
+ <body>
+ <!-- The body of the document contains a number of sections -->
+ <section name="Holiday Handler Algorithms">
+
+ <subsection name="Forward">
+ <p>If the date is a non-working day, move forward to the next working day.</p>
+ <img src="forward.png"/>
+ </subsection>
+
+ <subsection name="backward">
+ <p>If the date is a non-working day, move backward to the previous working day.</p>
+ <img src="backward.png"/>
+ </subsection>
+
+ <subsection name="Modified Following">
+ <p>If the date is a non-working day, move forward to the next working day,
+ UNLESS it crosses over a new month, in which case we revert to find the last working day of the current month.</p>
+ <img src="modif-following.png"/>
+ </subsection>
+
+ <subsection name="Modified Preceeding">
+ <p>If the date is a non-working day, move backward to the previous working day,
+ UNLESS it crosses over a new month, in which case we revert to find the next working day of the current month.</p>
+ <img src="modif-preceeding.png"/>
+ </subsection>
+
+ </section>
+
+ </body>
+</document>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-05 15:05:29
|
Revision: 110
http://svn.sourceforge.net/objectlabkit/?rev=110&view=rev
Author: benoitx
Date: 2006-09-05 08:05:17 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Improve doc with some diagrams for holiday handler algorithms.
Modified Paths:
--------------
trunk/src/site/index.xml
trunk/src/site/navigation.xml
Added Paths:
-----------
trunk/src/site/backward.png
trunk/src/site/calendar.vsd
trunk/src/site/forward.png
trunk/src/site/modif-following.png
trunk/src/site/modif-preceeding.png
Added: trunk/src/site/backward.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/backward.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/calendar.vsd
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/calendar.vsd
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/forward.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/forward.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/index.xml
===================================================================
--- trunk/src/site/index.xml 2006-09-05 11:16:39 UTC (rev 109)
+++ trunk/src/site/index.xml 2006-09-05 15:05:17 UTC (rev 110)
@@ -48,6 +48,7 @@
<li><strong>Modified Preceeding</strong>, if the date is a non-working day, move backward to the previous working day,
UNLESS it crosses over a new month, in which case we revert to find the next working day of the current month.</li>
</ol>
+ <p>See this page for some <a href="algo.html">examples</a>.</p>
</subsection>
<subsection name="Main interfaces">
Added: trunk/src/site/modif-following.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/modif-following.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/modif-preceeding.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/modif-preceeding.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/site/navigation.xml
===================================================================
--- trunk/src/site/navigation.xml 2006-09-05 11:16:39 UTC (rev 109)
+++ trunk/src/site/navigation.xml 2006-09-05 15:05:17 UTC (rev 110)
@@ -12,6 +12,7 @@
<item name="DateCalc Common" href="multiproject/datecalc-common/index.html"/>
<item name="DateCalc JDK" href="multiproject/datecalc-jdk/index.html"/>
<item name="DateCalc JODA" href="multiproject/datecalc-joda/index.html"/>
+ <item name="Holiday Handler" href="algo.html"/>
</menu>
<!--
<menu name="Related Projects">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|