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: <ma...@us...> - 2006-08-26 09:08:45
|
Revision: 60 Author: marchy Date: 2006-08-26 02:08:30 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=60&view=rev Log Message: ----------- Added the Apache 2.0 licence to the project code template Added Paths: ----------- trunk/datecalc-common/.settings/ trunk/datecalc-common/.settings/org.eclipse.jdt.ui.prefs trunk/datecalc-jdk/.settings/ trunk/datecalc-jdk/.settings/org.eclipse.jdt.ui.prefs Added: trunk/datecalc-common/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/datecalc-common/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/datecalc-common/.settings/org.eclipse.jdt.ui.prefs 2006-08-26 09:08:30 UTC (rev 60) @@ -0,0 +1,3 @@ +#Sat Aug 26 10:57:38 CAT 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * $$Id$$\r\n * \r\n * Copyright 2006 the original author or authors.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r\n * use this file except in compliance with the License. You may obtain a copy of\r\n * the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n * License for the specific language governing permissions and limitations under\r\n * the License.\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n *\r\n * @author Marcin Jekot\r\n * @author $$LastChangedBy$$\r\n * @version $$Revision$$ $$Date$$\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> Added: trunk/datecalc-jdk/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/datecalc-jdk/.settings/org.eclipse.jdt.ui.prefs (rev 0) +++ trunk/datecalc-jdk/.settings/org.eclipse.jdt.ui.prefs 2006-08-26 09:08:30 UTC (rev 60) @@ -0,0 +1,3 @@ +#Sat Aug 26 10:58:00 CAT 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * $$Id$$\r\n * \r\n * Copyright 2006 the original author or authors.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r\n * use this file except in compliance with the License. You may obtain a copy of\r\n * the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n * License for the specific language governing permissions and limitations under\r\n * the License.\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n *\r\n * @author Marcin Jekot\r\n * @author $$LastChangedBy$$\r\n * @version $$Revision$$ $$Date$$\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 09:06:50
|
Revision: 59 Author: marchy Date: 2006-08-26 02:06:39 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=59&view=rev Log Message: ----------- Added the Apache 2.0 licence to the project code template Modified Paths: -------------- trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs Property Changed: ---------------- trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs Modified: trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs 2006-08-26 09:04:48 UTC (rev 58) +++ trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs 2006-08-26 09:06:39 UTC (rev 59) @@ -1,3 +1,3 @@ -#Mon Aug 07 14:57:38 BST 2006 +#Sat Aug 26 10:58:16 CAT 2006 eclipse.preferences.version=1 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/> +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return Returns the ${bare_field_name}.\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} The ${bare_field_name} to set.\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * $$Id$$\r\n * \r\n * Copyright 2006 the original author or authors.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r\n * use this file except in compliance with the License. You may obtain a copy of\r\n * the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n * License for the specific language governing permissions and limitations under\r\n * the License.\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n *\r\n * @author Marcin Jekot\r\n * @author $$LastChangedBy$$\r\n * @version $$Revision$$ $$Date$$\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> Property changes on: trunk/datecalc-joda/.settings/org.eclipse.jdt.ui.prefs ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 09:04:56
|
Revision: 58 Author: marchy Date: 2006-08-26 02:04:48 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=58&view=rev Log Message: ----------- Added licence, and javadoc Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.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-08-26 08:44:37 UTC (rev 57) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-26 09:04:48 UTC (rev 58) @@ -1,3 +1,20 @@ +/* + * $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.Collections; @@ -4,6 +21,18 @@ import java.util.HashSet; import java.util.Set; +/** + * 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$ + * @version $Revision$ $Date$ + * + * @param <E> + */ public abstract class AbstractDateCalculator<E> implements DateCalculator<E> { protected static final int MONTHS_IN_QUARTER = 3; @@ -22,7 +51,8 @@ private HolidayHandler<E> holidayHandler; - protected AbstractDateCalculator(final String name, final Set<E> nonWorkingDays, final HolidayHandler<E> holidayHandler) { + protected AbstractDateCalculator(final String name, + final Set<E> nonWorkingDays, final HolidayHandler<E> holidayHandler) { this.name = name; this.nonWorkingDays = nonWorkingDays; this.holidayHandler = holidayHandler; @@ -149,9 +179,13 @@ return this; } - if (holidayHandler == null && calendar.getHolidayHandlerType() != null || holidayHandler != null - && !holidayHandler.getType().equals(calendar.getHolidayHandlerType())) { - throw new IllegalArgumentException("Combined Calendars cannot have different handler types"); + if (holidayHandler == null + && calendar.getHolidayHandlerType() != null + || holidayHandler != null + && !holidayHandler.getType().equals( + calendar.getHolidayHandlerType())) { + throw new IllegalArgumentException( + "Combined Calendars cannot have different handler types"); } final Set<E> newSet = new HashSet<E>(); @@ -162,8 +196,8 @@ newSet.addAll(calendar.getNonWorkingDays()); } - final DateCalculator<E> cal = createNewCalcultaor(getName() + "/" + calendar.getName(), getStartDate(), newSet, - holidayHandler); + final DateCalculator<E> cal = createNewCalcultaor(getName() + "/" + + calendar.getName(), getStartDate(), newSet, holidayHandler); return cal; } @@ -182,8 +216,9 @@ return getNextIMMDate(false, currentBusinessDate); } - protected abstract E getNextIMMDate(final boolean forward, final E theStartDate); + protected abstract E getNextIMMDate(final boolean forward, + final E theStartDate); - protected abstract DateCalculator<E> createNewCalcultaor(String calcName, E theStartDate, Set<E> holidays, - HolidayHandler<E> handler); + protected abstract DateCalculator<E> createNewCalcultaor(String calcName, + E theStartDate, Set<E> holidays, HolidayHandler<E> handler); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 08:46:38
|
Revision: 57 Author: marchy Date: 2006-08-26 01:44:37 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=57&view=rev Log Message: ----------- Adding keyword expansion to all the java files. Property Changed: ---------------- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultPeriodCountCalculator.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/PeriodCountCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/Utils.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.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/ForwardDateCalculatorTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.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/ModifiedFollowingHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculator.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/BackwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeekTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultPeriodCountCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/Utils.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/AbstractDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/AbstractDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeekTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/PeriodCountCalculatorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 08:20:25
|
Revision: 56 Author: marchy Date: 2006-08-26 01:19:28 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=56&view=rev Log Message: ----------- Set the keyword substitution property on. I propose we use the standard $Id$ $Revision$ $Date$ and $LastModifiedBy$ tags on .java files Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java Property Changed: ---------------- 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/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandlerType.java trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.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/Tenor.java trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.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/TenorTest.java trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/WorkingWeekTest.java Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision 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-08-26 07:49:40 UTC (rev 55) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-26 08:19:28 UTC (rev 56) @@ -1,5 +1,6 @@ /* * $Id$ + * * Copyright 2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -27,12 +28,7 @@ * * @author Benoit Xhenseval * @author $LastChangedBy$ - * @version $Revision$ - * $LastChangedRevision $ - * $Date$ - * $LastChangedDate$ - * $Date$ - * $LastChangedDate$ + * @version $Revision$ $Date$ */ public interface DateCalculator<E> { Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java ___________________________________________________________________ Name: svn:keywords - HeadURL Id LastChangedBy LastChangedDate LastChangedRevision + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandlerType.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/TenorTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision Property changes on: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/WorkingWeekTest.java ___________________________________________________________________ Name: svn:keywords + Id LastChangedBy LastChangedDate LastChangedRevision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 07:50:07
|
Revision: 55 Author: marchy Date: 2006-08-26 00:49:40 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=55&view=rev Log Message: ----------- ditto Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java Property Changed: ---------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 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-08-26 07:45:13 UTC (rev 54) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-26 07:49:40 UTC (rev 55) @@ -1,4 +1,5 @@ /* + * $Id$ * Copyright 2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -27,10 +28,11 @@ * @author Benoit Xhenseval * @author $LastChangedBy$ * @version $Revision$ + * $LastChangedRevision $ * $Date$ * $LastChangedDate$ - * $Date: $ - * $LastChangedDate: $ + * $Date$ + * $LastChangedDate$ */ public interface DateCalculator<E> { Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java ___________________________________________________________________ Name: svn:keywords - LastChangedBy LastChangedRevision + HeadURL Id LastChangedBy LastChangedDate LastChangedRevision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 07:45:30
|
Revision: 54 Author: marchy Date: 2006-08-26 00:45:13 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=54&view=rev Log Message: ----------- c'mon, work for me buddy Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 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-08-26 07:29:57 UTC (rev 53) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-26 07:45:13 UTC (rev 54) @@ -25,9 +25,12 @@ * moveByBusinessDays methods are called. * * @author Benoit Xhenseval - * @author $Author$ $Author $ - * @version $Revision$, $Version: $ $Revision$ $Date$ - * $LastChangedDate$ $LastChangedBy$ + * @author $LastChangedBy$ + * @version $Revision$ + * $Date$ + * $LastChangedDate$ + * $Date: $ + * $LastChangedDate: $ */ public interface DateCalculator<E> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 07:30:14
|
Revision: 53 Author: marchy Date: 2006-08-26 00:29:57 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=53&view=rev Log Message: ----------- just doing some tests on keywords Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java Property Changed: ---------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 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-08-26 07:00:17 UTC (rev 52) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-26 07:29:57 UTC (rev 53) @@ -25,8 +25,9 @@ * moveByBusinessDays methods are called. * * @author Benoit Xhenseval - * @author $Author: $ - * @version $Revision: $, $Version: $ + * @author $Author$ $Author $ + * @version $Revision$, $Version: $ $Revision$ $Date$ + * $LastChangedDate$ $LastChangedBy$ */ public interface DateCalculator<E> { Property changes on: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java ___________________________________________________________________ Name: svn:keywords + LastChangedBy LastChangedRevision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-26 07:00:27
|
Revision: 52 Author: marchy Date: 2006-08-26 00:00:17 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=52&view=rev Log Message: ----------- Added javadoc, and licence Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 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-08-24 22:17:05 UTC (rev 51) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-26 07:00:17 UTC (rev 52) @@ -1,3 +1,18 @@ +/* + * 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; @@ -3,4 +18,14 @@ import java.util.Set; +/** + * A DateCalculator is a lightweight container with a reference(optional) to a + * set of holidays, a WorkingWeek (Mon-Fri by default), a startDate and a + * current date. The CurrentDate date is changed everytime that the addDays or + * moveByBusinessDays methods are called. + * + * @author Benoit Xhenseval + * @author $Author: $ + * @version $Revision: $, $Version: $ + */ public interface DateCalculator<E> { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 22:18:09
|
Revision: 51 Author: benoitx Date: 2006-08-24 15:17:05 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=51&view=rev Log Message: ----------- Removed Checkstyle issues. new stats. Modified Paths: -------------- 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/DateCalculator.java trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java trunk/datecalc-jdk/qalab.xml trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.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/ForwardDateCalculatorTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java trunk/datecalc-joda/qalab.xml trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java Modified: trunk/datecalc-common/qalab.xml =================================================================== --- trunk/datecalc-common/qalab.xml 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-common/qalab.xml 2006-08-24 22:17:05 UTC (rev 51) @@ -37,6 +37,9 @@ <summaryresult date="2006-08-23" filecount="10" statvalue="25" type="checkstyle"/> <summaryresult date="2006-08-23" filecount="9" statvalue="74" type="cobertura-line"/> <summaryresult date="2006-08-23" filecount="9" statvalue="87" type="cobertura-branch"/> + <summaryresult date="2006-08-24" filecount="10" statvalue="1" type="checkstyle"/> + <summaryresult date="2006-08-24" filecount="9" statvalue="62" type="cobertura-line"/> + <summaryresult date="2006-08-24" filecount="9" statvalue="65" 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"/> @@ -45,6 +48,7 @@ <result date="2006-08-19" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> <result date="2006-08-23" statvalue="1" type="checkstyle"/> + <result date="2006-08-24" statvalue="1" type="checkstyle"/> </file> <file id="net_objectlab_kit_datecalc_common_Tenor.java" path="net/objectlab/kit/datecalc/common/Tenor.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -62,6 +66,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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"/> @@ -80,6 +86,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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"/> @@ -94,6 +102,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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"/> @@ -102,12 +112,14 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" 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"/> <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" 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"/> @@ -121,6 +133,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="92" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="92" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java"> @@ -132,9 +146,13 @@ <result date="2006-08-23" statvalue="19" type="checkstyle"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-24 22:17:05 UTC (rev 51) @@ -14,13 +14,13 @@ private String name; - protected E startDate; + private E startDate; - protected E currentDate; + private E currentBusinessDate; - protected Set<E> nonWorkingDays; + private Set<E> nonWorkingDays; - protected HolidayHandler<E> holidayHandler; + private HolidayHandler<E> holidayHandler; protected AbstractDateCalculator(final String name, final Set<E> nonWorkingDays, final HolidayHandler<E> holidayHandler) { this.name = name; @@ -46,8 +46,8 @@ setCurrentBusinessDate(startDate); } - public E getCurrentDate() { - return currentDate; + public E getCurrentBusinessDate() { + return currentBusinessDate; } public Set<E> getNonWorkingDays() { @@ -106,15 +106,15 @@ } public boolean isCurrentDateNonWorking() { - return isNonWorkingDay(currentDate); + return isNonWorkingDay(currentBusinessDate); } public E setCurrentBusinessDate(final E date) { - currentDate = date; + currentBusinessDate = date; if (holidayHandler != null && date != null) { - currentDate = holidayHandler.moveCurrentDate(this); + currentBusinessDate = holidayHandler.moveCurrentDate(this); } - return currentDate; + return currentBusinessDate; } protected HolidayHandler<E> getHolidayHandler() { @@ -134,7 +134,7 @@ /** * Allows DateCalculators to be combined into a new one, the startDate and - * currentDate will be the ones from the existing calendar (not the + * currentBusinessDate will be the ones from the existing calendar (not the * parameter one). The name will be combined name1+"/"+calendar.getName(). * * @param calendar, @@ -172,17 +172,18 @@ * @return the next IMMDate based on current date. */ public E getNextIMMDate() { - return getNextIMMDate(true, currentDate); + return getNextIMMDate(true, currentBusinessDate); } /** * @return the previous IMMDate based on current date. */ public E getPreviousIMMDate() { - return getNextIMMDate(false, currentDate); + return getNextIMMDate(false, currentBusinessDate); } - protected abstract E getNextIMMDate(final boolean forward, final E startDate); + protected abstract E getNextIMMDate(final boolean forward, final E theStartDate); - protected abstract DateCalculator<E> createNewCalcultaor(String name, E startDate, Set<E> holidays, HolidayHandler<E> handler); + 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/DateCalculator.java =================================================================== --- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-24 22:17:05 UTC (rev 51) @@ -28,7 +28,7 @@ * @param currentDate * held by the calendar. */ - E getCurrentDate(); + E getCurrentBusinessDate(); /** * is the given date on a weekend, according to the WorkingWeek 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-08-24 22:17:05 UTC (rev 51) @@ -39,11 +39,10 @@ private static final byte SUNDAY = 64; - private static final byte DEFAULT_WORKING_DAYS = (byte) (MONDAY + TUESDAY - + WEDNESDAY + THURSDAY + FRIDAY); + private static final byte DEFAULT_WORKING_DAYS = (byte) (MONDAY + TUESDAY + WEDNESDAY + THURSDAY + FRIDAY); - private static final byte[] WORKING_WEEK_DAYS_OFFSET = new byte[] { SUNDAY, - MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }; + private static final byte[] WORKING_WEEK_DAYS_OFFSET = new byte[] { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, + SATURDAY }; public static final WorkingWeek DEFAULT = new WorkingWeek(); @@ -51,7 +50,7 @@ * Default Working Week Monday -> Friday. */ public WorkingWeek() { - this((byte) DEFAULT_WORKING_DAYS); + this(DEFAULT_WORKING_DAYS); } private WorkingWeek(final byte workingDays) { Modified: trunk/datecalc-jdk/qalab.xml =================================================================== --- trunk/datecalc-jdk/qalab.xml 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/qalab.xml 2006-08-24 22:17:05 UTC (rev 51) @@ -35,6 +35,10 @@ <summaryresult date="2006-08-23" filecount="1" statvalue="1" type="pmd"/> <summaryresult date="2006-08-23" filecount="7" statvalue="81" type="cobertura-line"/> <summaryresult date="2006-08-23" filecount="7" statvalue="79" type="cobertura-branch"/> + <summaryresult date="2006-08-24" filecount="8" statvalue="6" type="checkstyle"/> + <summaryresult date="2006-08-24" filecount="1" statvalue="1" type="pmd"/> + <summaryresult date="2006-08-24" filecount="7" statvalue="86" type="cobertura-line"/> + <summaryresult date="2006-08-24" filecount="7" statvalue="81" 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"/> @@ -42,6 +46,7 @@ <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> <result date="2006-08-23" statvalue="1" type="checkstyle"/> + <result date="2006-08-24" statvalue="1" type="checkstyle"/> </file> <file id="net_objectlab_kit_datecalc_jdk_BaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -62,6 +67,10 @@ <result date="2006-08-23" statvalue="1" type="pmd"/> <result date="2006-08-23" statvalue="78" type="cobertura-line"/> <result date="2006-08-23" statvalue="76" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="3" type="checkstyle"/> + <result date="2006-08-24" statvalue="1" type="pmd"/> + <result date="2006-08-24" statvalue="84" type="cobertura-line"/> + <result date="2006-08-24" statvalue="76" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java"> @@ -74,6 +83,9 @@ <result date="2006-08-23" statvalue="1" type="checkstyle"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="1" type="checkstyle"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlab-kit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlab-kit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"> @@ -102,6 +114,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_HolidayHandler.java" path="net/objectlab/kit/datecalc/jdk/HolidayHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -124,6 +138,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/DefaultPeriodCountCalculator.java"> @@ -134,6 +150,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="50" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="50" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlabkit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlabkit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"/> @@ -144,11 +162,16 @@ <result date="2006-08-23" statvalue="1" type="checkstyle"/> <result date="2006-08-23" statvalue="75" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="1" type="checkstyle"/> + <result date="2006-08-24" statvalue="75" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_ForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/ForwardHandler.java"> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> </qalab> Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-24 22:17:05 UTC (rev 51) @@ -35,7 +35,7 @@ * @author Benoit Xhenseval */ public class BaseDateCalculator extends AbstractDateCalculator<Date> { - + private WorkingWeek workingWeek = WorkingWeek.DEFAULT; @SuppressWarnings("unchecked") @@ -62,32 +62,31 @@ } public DateCalculator<Date> moveByDays(final int days) { - if (currentDate == null) { + if (getCurrentBusinessDate() == null) { initialise(); } - - final Calendar cal = Utils.getCal(currentDate); + + final Calendar cal = Utils.getCal(getCurrentBusinessDate()); cal.add(Calendar.DAY_OF_MONTH, days); setCurrentBusinessDate(cal.getTime()); - + return this; } private void initialise() { - if (startDate == null) { + if (getStartDate() == null) { setStartDate(new Date()); - } else if (currentDate == null) { + } else if (getCurrentBusinessDate() == null) { setCurrentBusinessDate(new Date()); } } @Override - protected DateCalculator<Date> createNewCalcultaor(final String name, final Date startDate, final Set<Date> holidays, + protected DateCalculator<Date> createNewCalcultaor(final String name, final Date startDate, final Set<Date> holidays, final HolidayHandler<Date> handler) { return new BaseDateCalculator(name, startDate, holidays, handler); } - - + /** * Calculates IMMDates between a start and end dates the 3rd wednesday of * Mar/Jun/Sep/Dec when a lot of derivative contracts expire @@ -95,7 +94,7 @@ * @return a List of Dates */ public List<Date> getIMMDates(final Date start, final Date end) { - + final List<Date> dates = new ArrayList<Date>(); Date date = start; while (true) { @@ -106,39 +105,37 @@ break; } } - - return dates; + + return dates; } @Override protected Date getNextIMMDate(final boolean forward, final Date startDate) { - + final Calendar cal = Utils.getCal(startDate); if (isIMMMonth(cal)) { moveToIMMDay(cal); // TODO simplify this if condition - if ((forward && cal.getTime().after(startDate)) || - (!forward && cal.getTime().before(startDate))) { + if ((forward && cal.getTime().after(startDate)) || (!forward && cal.getTime().before(startDate))) { return cal.getTime(); } } - + final int delta = (forward ? 1 : -1); do { cal.add(Calendar.MONTH, delta); } while (!isIMMMonth(cal)); - + moveToIMMDay(cal); return cal.getTime(); } private boolean isIMMMonth(final Calendar cal) { final int month = cal.get(Calendar.MONTH); - return (month == Calendar.MARCH || month == Calendar.JUNE || - month == Calendar.SEPTEMBER || month == Calendar.DECEMBER); + return (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER || month == Calendar.DECEMBER); } - + /** * Assumes that the month is correct, get the day for the 3rd wednesday. * @@ -147,7 +144,7 @@ */ 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) { @@ -157,7 +154,7 @@ } else { cal.add(Calendar.DAY_OF_MONTH, (Calendar.WEDNESDAY + 7) - dayOfWeek); } - + // go to 3rd wednesday - i.e. move 2 weeks forward cal.add(Calendar.DAY_OF_MONTH, 7 * 2); } Modified: 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java 2006-08-24 22:17:05 UTC (rev 51) @@ -31,7 +31,7 @@ public Date moveCurrentDate(final DateCalculator<Date> calendar) { - final Calendar cal = Utils.getCal(calendar.getCurrentDate()); + final Calendar cal = Utils.getCal(calendar.getCurrentBusinessDate()); while (calendar.isNonWorkingDay(cal.getTime())) { cal.add(Calendar.DAY_OF_MONTH, 1); Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -3,7 +3,6 @@ import java.util.Date; import junit.framework.Assert; - import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; @@ -62,7 +61,7 @@ Assert.assertEquals("Combo name", "bla/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); - Assert.assertEquals("currentDate", Date, combo.getCurrentDate()); + Assert.assertEquals("currentDate", Date, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 4, combo.getNonWorkingDays().size()); } @@ -80,7 +79,7 @@ Assert.assertEquals("Combo name", "UK/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); - Assert.assertEquals("currentDate", Date, combo.getCurrentDate()); + Assert.assertEquals("currentDate", Date, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 4, combo.getNonWorkingDays().size()); } @@ -98,7 +97,7 @@ Assert.assertEquals("Combo name", "US/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); - Assert.assertEquals("currentDate", Date, combo.getCurrentDate()); + Assert.assertEquals("currentDate", Date, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 6, combo.getNonWorkingDays().size()); } @@ -114,7 +113,7 @@ Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); - Assert.assertEquals("currentDate", Date, combo.getCurrentDate()); + Assert.assertEquals("currentDate", Date, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 3, combo.getNonWorkingDays().size()); } @@ -130,7 +129,7 @@ Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); - Assert.assertEquals("currentDate", Date, combo.getCurrentDate()); + Assert.assertEquals("currentDate", Date, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 3, combo.getNonWorkingDays().size()); } } 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -4,7 +4,6 @@ import java.util.Set; import junit.framework.Assert; - import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -1,12 +1,11 @@ package net.objectlab.kit.datecalc.jdk; import java.util.Calendar; -import java.util.HashSet; import java.util.Date; +import java.util.HashSet; 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.WorkingWeek; @@ -199,6 +198,6 @@ } private void checkDate(final String string, final DateCalculator calendar, final String string2) { - Assert.assertEquals(string, createDate(string2), calendar.getCurrentDate()); + Assert.assertEquals(string, createDate(string2), calendar.getCurrentBusinessDate()); } } Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JodaWorkingWeekTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -17,10 +17,9 @@ import java.util.Calendar; -import net.objectlab.kit.datecalc.common.WorkingWeek; - import junit.framework.Assert; import junit.framework.TestCase; +import net.objectlab.kit.datecalc.common.WorkingWeek; /** * @author Benoit Xhenseval Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/PeriodCountCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -19,7 +19,6 @@ import java.util.Date; import junit.framework.Assert; - import net.objectlab.kit.datecalc.common.PeriodCountBasis; public class PeriodCountCalculatorTest extends AbstractDateCalculatorTest { @@ -278,8 +277,8 @@ Assert.assertEquals(name + " Basis:" + pcount + " start:" + start + " dayDiff", dayDiff, cal.dayDiff(start, end, pcount)); final BigDecimal yearDiff = new BigDecimal(cal.yearDiff(start, end, pcount)).setScale(6, BigDecimal.ROUND_HALF_UP); - Assert.assertTrue(name + " Basis:" + pcount + " yearDiff expected:" + test[5] + " got:" + yearDiff, (new BigDecimal(test[5])) - .compareTo(yearDiff) == 0); + Assert.assertTrue(name + " Basis:" + pcount + " yearDiff expected:" + test[5] + " got:" + yearDiff, (new BigDecimal( + test[5])).compareTo(yearDiff) == 0); } } \ No newline at end of file Modified: trunk/datecalc-joda/qalab.xml =================================================================== --- trunk/datecalc-joda/qalab.xml 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/qalab.xml 2006-08-24 22:17:05 UTC (rev 51) @@ -43,6 +43,8 @@ <summaryresult date="2006-08-23" filecount="11" statvalue="1" type="checkstyle"/> <summaryresult date="2006-08-23" filecount="10" statvalue="93" type="cobertura-line"/> <summaryresult date="2006-08-23" filecount="10" statvalue="95" type="cobertura-branch"/> + <summaryresult date="2006-08-24" filecount="10" statvalue="93" type="cobertura-line"/> + <summaryresult date="2006-08-24" filecount="10" statvalue="94" 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"/> @@ -73,6 +75,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="97" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java"> @@ -91,6 +95,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DefaultPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java"> @@ -112,6 +118,8 @@ <result date="2006-08-20" statvalue="84" type="cobertura-branch"/> <result date="2006-08-23" statvalue="81" type="cobertura-line"/> <result date="2006-08-23" statvalue="84" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="81" type="cobertura-line"/> + <result date="2006-08-24" statvalue="84" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_JodaWorkingWeek.java" path="net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -129,6 +137,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" 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"/> @@ -140,6 +150,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DateCalculator.java" path="net/objectlab/kit/datecalc/joda/DateCalculator.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -167,6 +179,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ForwardHandler.java" path="net/objectlab/kit/datecalc/joda/ForwardHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -181,6 +195,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_HolidayHandler.java" path="net/objectlab/kit/datecalc/joda/HolidayHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -208,6 +224,8 @@ <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java"> @@ -217,6 +235,8 @@ <result date="2006-08-20" statvalue="16" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="100" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java"> @@ -226,5 +246,7 @@ <result date="2006-08-20" statvalue="16" type="cobertura-line"/> <result date="2006-08-23" statvalue="75" type="cobertura-line"/> <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-24" statvalue="75" type="cobertura-line"/> + <result date="2006-08-24" statvalue="100" type="cobertura-branch"/> </file> </qalab> Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java 2006-08-24 22:17:05 UTC (rev 51) @@ -30,7 +30,7 @@ public class BackwardHandler implements HolidayHandler<LocalDate> { public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { - LocalDate date = calendar.getCurrentDate(); + LocalDate date = calendar.getCurrentBusinessDate(); while (calendar.isNonWorkingDay(date)) { date = date.minusDays(1); } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 22:17:05 UTC (rev 51) @@ -65,22 +65,22 @@ } public DateCalculator<LocalDate> moveByDays(final int days) { - if (currentDate == null) { + if (getCurrentBusinessDate() == null) { initialise(); } - currentDate = currentDate.plusDays(days); + setCurrentBusinessDate(getCurrentBusinessDate().plusDays(days)); - if (holidayHandler != null) { - currentDate = holidayHandler.moveCurrentDate(this); + if (getHolidayHandler() != null) { + setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this)); } return this; } private void initialise() { - if (startDate == null) { + if (getStartDate() == null) { setStartDate(new LocalDate()); - } else if (currentDate == null) { + } else if (getCurrentBusinessDate() == null) { setCurrentBusinessDate(new LocalDate()); } } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java 2006-08-24 22:17:05 UTC (rev 51) @@ -30,7 +30,7 @@ public class ForwardHandler implements HolidayHandler<LocalDate> { public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { - LocalDate date = calendar.getCurrentDate(); + LocalDate date = calendar.getCurrentBusinessDate(); while (calendar.isNonWorkingDay(date)) { date = date.plusDays(1); } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java 2006-08-24 22:17:05 UTC (rev 51) @@ -31,7 +31,7 @@ public class ModifiedFollowingHandler implements HolidayHandler<LocalDate> { public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { - LocalDate date = calendar.getCurrentDate(); + LocalDate date = calendar.getCurrentBusinessDate(); final int month = date.getMonthOfYear(); int step = 1; while (calendar.isNonWorkingDay(date)) { Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java 2006-08-24 22:17:05 UTC (rev 51) @@ -31,7 +31,7 @@ public class ModifiedPreceedingHandler implements HolidayHandler<LocalDate> { public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { - LocalDate date = calendar.getCurrentDate(); + LocalDate date = calendar.getCurrentBusinessDate(); final int month = date.getMonthOfYear(); int step = -1; while (calendar.isNonWorkingDay(date)) { Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -222,7 +222,8 @@ cal.setStartDate(new LocalDate("2006-08-24")); checkDate("Add 1 week", cal.moveByDays(7), "2006-08-31"); cal.setStartDate(new LocalDate("2006-08-24")); -// checkDate("Move by 1W with 1 bank holiday", cal.moveByBusinessDays(7), "2006-09-05"); + // checkDate("Move by 1W with 1 bank holiday", + // cal.moveByBusinessDays(7), "2006-09-05"); } @@ -259,6 +260,6 @@ } private void checkDate(final String string, final DateCalculator calendar, final String string2) { - Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); + Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentBusinessDate()); } } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -61,7 +61,7 @@ Assert.assertEquals("Combo name", "bla/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); - Assert.assertEquals("currentDate", localDate, combo.getCurrentDate()); + Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 4, combo.getNonWorkingDays().size()); } @@ -79,7 +79,7 @@ Assert.assertEquals("Combo name", "UK/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); - Assert.assertEquals("currentDate", localDate, combo.getCurrentDate()); + Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 4, combo.getNonWorkingDays().size()); } @@ -97,7 +97,7 @@ Assert.assertEquals("Combo name", "US/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); - Assert.assertEquals("currentDate", localDate, combo.getCurrentDate()); + Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 6, combo.getNonWorkingDays().size()); } @@ -113,7 +113,7 @@ Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); - Assert.assertEquals("currentDate", localDate, combo.getCurrentDate()); + Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 3, combo.getNonWorkingDays().size()); } @@ -129,7 +129,7 @@ Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); - Assert.assertEquals("currentDate", localDate, combo.getCurrentDate()); + Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 3, combo.getNonWorkingDays().size()); } } Modified: 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -76,16 +76,16 @@ Assert.assertNotNull("No hol", cal1.getNonWorkingDays()); Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty()); - LocalDate date = cal1.moveByDays(0).getCurrentDate(); + LocalDate date = cal1.moveByDays(0).getCurrentBusinessDate(); Assert.assertEquals("default today", new LocalDate(), date); cal1.setStartDate(null); - date = cal1.moveByDays(0).getCurrentDate(); + 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).getCurrentDate(); + date = cal1.moveByDays(0).getCurrentBusinessDate(); Assert.assertEquals("default today", new LocalDate(), date); } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -256,6 +256,6 @@ } private void checkDate(final String string, final DateCalculator calendar, final String string2) { - Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); + Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentBusinessDate()); } } Modified: 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-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -90,7 +90,7 @@ cal.setStartDate(startDate); Assert.assertEquals("From " + cal.getStartDate(), new LocalDate("2006-06-21"), cal.moveByTenor(StandardTenor.IMM) - .getCurrentDate()); + .getCurrentBusinessDate()); } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -254,7 +254,7 @@ cal.setStartDate(new LocalDate("2006-08-08")); checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05"); } - + public void testAddAcrossMonth() { final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.MODIFIED_FOLLLOWING); @@ -265,18 +265,18 @@ cal.moveByDays(1); checkDate("do move to next month", cal, "2006-08-01"); - + // now if it due to roll over: cal.setStartDate(new LocalDate("2006-07-28")); - Set<LocalDate> hol = new HashSet<LocalDate>(); + final Set<LocalDate> hol = new HashSet<LocalDate>(); hol.add(new LocalDate("2006-07-31")); cal.setNonWorkingDays(hol); cal.moveByDays(1); - + checkDate("do NOT move to next month", cal, "2006-07-28"); } private void checkDate(final String string, final DateCalculator calendar, final String string2) { - Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); + Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentBusinessDate()); } } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java 2006-08-24 21:37:58 UTC (rev 50) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java 2006-08-24 22:17:05 UTC (rev 51) @@ -254,7 +254,7 @@ cal.setStartDate(new LocalDate("2006-08-08")); checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05"); } - + public void testAddAcrossMonth() { final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.MODIFIED_FOLLLOWING); @@ -265,18 +265,18 @@ cal.moveByDays(-1); checkDate("do move to next month", cal, "2006-07-31"); - + // now if it due to roll over: cal.setStartDate(new LocalDate("2006-08-02")); - Set<LocalDate> hol = new HashSet<LocalDate>(); + final Set<LocalDate> hol = new HashSet<LocalDate>(); hol.add(new LocalDate("2006-08-01")); cal.setNonWorkingDays(hol); cal.moveByDays(-1); - + checkDate("do NOT move to next month", cal, "2006-08-02"); } private void checkDate(final String string, final DateCalculator calendar, final String string2) { - Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); + Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentBusinessDate()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 21:38:09
|
Revision: 50 Author: benoitx Date: 2006-08-24 14:37:58 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=50&view=rev Log Message: ----------- checkstyle Modified Paths: -------------- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 17:15:26 UTC (rev 49) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 21:37:58 UTC (rev 50) @@ -86,10 +86,11 @@ } @Override - protected DateCalculator<LocalDate> createNewCalcultaor(final String name, final LocalDate startDate,final Set<LocalDate> holidays,final HolidayHandler<LocalDate> handler) { + protected DateCalculator<LocalDate> createNewCalcultaor(final String name, final LocalDate startDate, + final Set<LocalDate> holidays, final HolidayHandler<LocalDate> handler) { return new BaseDateCalculator(name, startDate, holidays, handler); } - + public List<LocalDate> getIMMDates(final LocalDate start, final LocalDate end) { final List<LocalDate> dates = new ArrayList<LocalDate>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 17:31:33
|
Revision: 49 Author: benoitx Date: 2006-08-24 10:15:26 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=49&view=rev Log Message: ----------- here you go... this should take care of my last Checkstyle warning! :-) Added Paths: ----------- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/package.html Added: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/package.html =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/package.html (rev 0) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/package.html 2006-08-24 17:15:26 UTC (rev 49) @@ -0,0 +1,5 @@ +<html> +<body> +<p>This package implements the DateCalculator interfaces using Joda-time <a href="http://joda-time.sourceforge.net">See Joda-time</a></p> +</body> +</html> \ 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-08-24 13:58:15
|
Revision: 48 Author: benoitx Date: 2006-08-24 06:57:57 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=48&view=rev Log Message: ----------- Move more functionality to the AbstractDateCalculator. Got a bit stuck on WorkingWeek, may be that could be <parameterised>... 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-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.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/Utils.java trunk/datecalc-joda/maven.xml trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java Property Changed: ---------------- trunk/datecalc-joda/ 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-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-24 13:57:57 UTC (rev 48) @@ -1,19 +1,33 @@ package net.objectlab.kit.datecalc.common; import java.util.Collections; +import java.util.HashSet; import java.util.Set; 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; - protected String name; + + private String name; + protected E startDate; + protected E currentDate; + protected Set<E> nonWorkingDays; + protected HolidayHandler<E> holidayHandler; - + + protected AbstractDateCalculator(final String name, final Set<E> nonWorkingDays, final HolidayHandler<E> holidayHandler) { + this.name = name; + this.nonWorkingDays = nonWorkingDays; + this.holidayHandler = holidayHandler; + } + public String getName() { return name; } @@ -39,7 +53,7 @@ public Set<E> getNonWorkingDays() { return Collections.unmodifiableSet(nonWorkingDays); } - + public void setNonWorkingDays(final Set<E> holidays) { if (holidays == null) { nonWorkingDays = Collections.emptySet(); @@ -61,7 +75,7 @@ if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } - + switch (tenor.getCode()) { case DAY: return moveByDays(tenor.getUnits()); @@ -73,7 +87,7 @@ default: throw new UnsupportedOperationException("Sorry not yet..."); } - + } public void setHolidayHandler(final HolidayHandler<E> holidayHandler) { @@ -84,4 +98,91 @@ return (holidayHandler != null ? holidayHandler.getType() : null); } + /** + * is the given date a non working day? + */ + public boolean isNonWorkingDay(final E date) { + return (isWeekend(date) || nonWorkingDays.contains(date)); + } + + public boolean isCurrentDateNonWorking() { + return isNonWorkingDay(currentDate); + } + + public E setCurrentBusinessDate(final E date) { + currentDate = date; + if (holidayHandler != null && date != null) { + currentDate = holidayHandler.moveCurrentDate(this); + } + return currentDate; + } + + protected HolidayHandler<E> getHolidayHandler() { + return holidayHandler; + } + + public DateCalculator<E> moveByBusinessDays(final int businessDays) { + final int numberOfStepsLeft = Math.abs(businessDays); + final int step = (businessDays < 0 ? -1 : 1); + + for (int i = 0; i < numberOfStepsLeft; i++) { + moveByDays(step); + } + + return this; + } + + /** + * Allows DateCalculators to be combined into a new one, the startDate and + * currentDate will be the ones from the existing calendar (not the + * parameter one). The name will be combined name1+"/"+calendar.getName(). + * + * @param calendar, + * return the same DateCalculator if calender is null or the + * original calendar (but why would you want to do that?) + * @throws IllegalArgumentException + * if both calendars have different types of HolidayHandlers or + * WorkingWeek; + */ + public DateCalculator<E> combine(final DateCalculator<E> calendar) { + if (calendar == null || calendar == this) { + return this; + } + + if (holidayHandler == null && calendar.getHolidayHandlerType() != null || holidayHandler != null + && !holidayHandler.getType().equals(calendar.getHolidayHandlerType())) { + throw new IllegalArgumentException("Combined Calendars cannot have different handler types"); + } + + final Set<E> newSet = new HashSet<E>(); + if (nonWorkingDays != null) { + newSet.addAll(nonWorkingDays); + } + if (calendar.getNonWorkingDays() != null) { + newSet.addAll(calendar.getNonWorkingDays()); + } + + final DateCalculator<E> cal = createNewCalcultaor(getName() + "/" + calendar.getName(), getStartDate(), newSet, + holidayHandler); + + return cal; + } + + /** + * @return the next IMMDate based on current date. + */ + public E getNextIMMDate() { + return getNextIMMDate(true, currentDate); + } + + /** + * @return the previous IMMDate based on current date. + */ + public E getPreviousIMMDate() { + return getNextIMMDate(false, currentDate); + } + + protected abstract E getNextIMMDate(final boolean forward, final E startDate); + + protected abstract DateCalculator<E> createNewCalcultaor(String name, E startDate, Set<E> holidays, HolidayHandler<E> handler); } 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-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-24 13:57:57 UTC (rev 48) @@ -3,14 +3,13 @@ import java.util.List; import java.util.Set; - public interface DateCalculator<E> { /** * @return Calendar name (Typically the name associated with the holiday * set). */ - public String getName(); + String getName(); /** * @param startDate @@ -18,33 +17,34 @@ * updated and may be moved if it falls on a non working day * (holiday/weekend). */ - public void setStartDate(final E startDate); + void setStartDate(final E startDate); /** * @return startDate the reference date for this calendar. */ - public E getStartDate(); + E getStartDate(); /** - * @param currentDate held by the calendar. + * @param currentDate + * held by the calendar. */ - public E getCurrentDate(); + E getCurrentDate(); /** * is the given date on a weekend, according to the WorkingWeek */ - public boolean isWeekend(final E date); + boolean isWeekend(final E date); /** * is the given date a non working day, i.e. either a "weekend" or a * holiday? */ - public boolean isNonWorkingDay(final E date); + boolean isNonWorkingDay(final E date); /** * @return true if the current date is either a weekend or a holiday. */ - public boolean isCurrentDateNonWorking(); + boolean isCurrentDateNonWorking(); /** * This is typically used at the construction of a DateCalculator. @@ -52,12 +52,12 @@ * @param holidays * the holiday (if null, an empty set will be put in place) */ - public void setNonWorkingDays(final Set<E> holidays); + void setNonWorkingDays(final Set<E> holidays); /** * @return an immutable copy of the holiday set. */ - public Set<E> getNonWorkingDays(); + Set<E> getNonWorkingDays(); /** * Allow user to define what their Working Week should be (default is @@ -65,7 +65,7 @@ * * @param week */ - public void setWorkingWeek(final WorkingWeek week); + void setWorkingWeek(final WorkingWeek week); /** * give a current business date which may be moved if it falls on a non @@ -74,12 +74,12 @@ * @param date * @return new current date if moved. */ - public E setCurrentBusinessDate(final E date); + E setCurrentBusinessDate(final E date); /** * @return the holiday handler type, can be null */ - public String getHolidayHandlerType(); + String getHolidayHandlerType(); /** * move the current date by the number of days and, if it falls on a weekend @@ -91,7 +91,7 @@ * @return the businessCalendar (so one can do * calendar.moveByDays(-2).getCurrentBusinessDate();) */ - public DateCalculator<E> moveByDays(final int days); + DateCalculator<E> moveByDays(final int days); /** * move the current date by a number of business days, this means that if a @@ -102,7 +102,7 @@ * @return the current businessCalendar (so one can do * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) */ - public DateCalculator<E> moveByBusinessDays(final int businessDays); + DateCalculator<E> moveByBusinessDays(final int businessDays); /** * By combining several calendars, we take into account several set of @@ -111,7 +111,7 @@ * @param calendar * @return a new DateCalculator */ - public DateCalculator<E> combine(DateCalculator<E> calendar); + DateCalculator<E> combine(DateCalculator<E> calendar); /** * move the current date by a given tenor, this means that if a date is @@ -122,17 +122,17 @@ * @return the current businessCalendar (so one can do * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) */ - public DateCalculator<E> moveByTenor(final Tenor tenor); + DateCalculator<E> moveByTenor(final Tenor tenor); /** * @return the next IMMDate based on current date. */ - public E getNextIMMDate(); + E getNextIMMDate(); /** * @return the previous IMMDate based on current date. */ - public E getPreviousIMMDate(); + E getPreviousIMMDate(); /** * Returns a list of IMM dates between 2 dates, it will exclude the start @@ -144,6 +144,5 @@ * end of the interval, may be included. * @return list of IMM dates */ - public List<E> getIMMDates(final E start, final E end); - + List<E> getIMMDates(final E start, final E end); } \ No newline at end of file Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-24 13:57:57 UTC (rev 48) @@ -19,7 +19,6 @@ import java.util.Calendar; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.List; import java.util.Set; @@ -44,17 +43,10 @@ this(null, null, Collections.EMPTY_SET, null); } - @SuppressWarnings("unchecked") - public BaseDateCalculator(final HolidayHandler holidayHandler) { - this(null, null, Collections.EMPTY_SET, holidayHandler); - } - public BaseDateCalculator(final String name, final Date startDate, final Set<Date> nonWorkingDays, - final HolidayHandler holidayHandler) { - this.name = name; + final HolidayHandler<Date> holidayHandler) { + super(name, nonWorkingDays, holidayHandler); setStartDate(startDate); - this.nonWorkingDays = nonWorkingDays; - this.holidayHandler = holidayHandler; } public void setWorkingWeek(final WorkingWeek week) { @@ -69,31 +61,12 @@ return !workingWeek.isWorkingDay(date); } - /** - * is the given date a non working day? - */ - public boolean isNonWorkingDay(final Date date) { - return (isWeekend(date) || nonWorkingDays.contains(date)); - } - - public boolean isCurrentDateNonWorking() { - return isNonWorkingDay(currentDate); - } - - public Date setCurrentBusinessDate(final Date date) { - currentDate = date; - if (holidayHandler != null && date != null) { - currentDate = holidayHandler.moveCurrentDate(this); - } - return currentDate; - } - public DateCalculator<Date> moveByDays(final int days) { if (currentDate == null) { initialise(); } - Calendar cal = Utils.getCal(currentDate); + final Calendar cal = Utils.getCal(currentDate); cal.add(Calendar.DAY_OF_MONTH, days); setCurrentBusinessDate(cal.getTime()); @@ -108,62 +81,22 @@ } } - public DateCalculator<Date> moveByBusinessDays(final int businessDays) { - final int numberOfStepsLeft = Math.abs(businessDays); - final int step = (businessDays < 0 ? -1 : 1); - - for (int i = 0; i < numberOfStepsLeft; i++) { - moveByDays(step); - } - - return this; + @Override + protected DateCalculator<Date> createNewCalcultaor(final String name, final Date startDate, final Set<Date> holidays, + final HolidayHandler<Date> handler) { + return new BaseDateCalculator(name, startDate, holidays, handler); } - + + /** - * Allows DateCalculators to be combined into a new one, the startDate and - * currentDate will be the ones from the existing calendar (not the - * parameter one). The name will be combined name1+"/"+calendar.getName(). + * Calculates IMMDates between a start and end dates the 3rd wednesday of + * Mar/Jun/Sep/Dec when a lot of derivative contracts expire * - * @param calendar, - * return the same DateCalculator if calender is null or the - * original calendar (but why would you want to do that?) - * @throws IllegalArgumentException - * if both calendars have different types of HolidayHandlers or - * WorkingWeek; - */ - public DateCalculator<Date> combine(final DateCalculator calendar) { - if (calendar == null || calendar == this) { - return this; - } - - if (holidayHandler == null && calendar.getHolidayHandlerType() != null || holidayHandler != null - && !holidayHandler.getType().equals(calendar.getHolidayHandlerType())) { - throw new IllegalArgumentException("Combined Calendars cannot have different handler types"); - } - - final Set<Date> newSet = new HashSet<Date>(); - if (nonWorkingDays != null) { - newSet.addAll(nonWorkingDays); - } - if (calendar.getNonWorkingDays() != null) { - newSet.addAll(calendar.getNonWorkingDays()); - } - - final DateCalculator cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, - holidayHandler); - - return cal; - } - - /** - * Calculates IMMDates between a start and end dates - * the 3rd wednesday of Mar/Jun/Sep/Dec - * when a lot of derivative contracts expire * @return a List of Dates */ public List<Date> getIMMDates(final Date start, final Date end) { - List<Date> dates = new ArrayList<Date>(); + final List<Date> dates = new ArrayList<Date>(); Date date = start; while (true) { date = getNextIMMDate(true, date); @@ -177,28 +110,21 @@ return dates; } - public Date getNextIMMDate() { - return getNextIMMDate(true, currentDate); - } - - public Date getPreviousIMMDate() { - return getNextIMMDate(false, currentDate); - } - - private Date getNextIMMDate(final boolean forward, final Date startDate) { + @Override + protected Date getNextIMMDate(final boolean forward, final Date startDate) { - Calendar cal = Utils.getCal(startDate); + final Calendar cal = Utils.getCal(startDate); if (isIMMMonth(cal)) { moveToIMMDay(cal); - //TODO simplify this if condition + // TODO simplify this if condition if ((forward && cal.getTime().after(startDate)) || (!forward && cal.getTime().before(startDate))) { return cal.getTime(); } } - int delta = (forward ? 1 : -1); + final int delta = (forward ? 1 : -1); do { cal.add(Calendar.MONTH, delta); } while (!isIMMMonth(cal)); @@ -208,7 +134,7 @@ } private boolean isIMMMonth(final Calendar cal) { - int month = cal.get(Calendar.MONTH); + final int month = cal.get(Calendar.MONTH); return (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER || month == Calendar.DECEMBER); } @@ -223,7 +149,7 @@ cal.set(Calendar.DAY_OF_MONTH, 1); // go to 1st wed - int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); + 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) { @@ -235,5 +161,4 @@ // go to 3rd wednesday - i.e. move 2 weeks forward cal.add(Calendar.DAY_OF_MONTH, 7 * 2); } - } Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-24 13:57:57 UTC (rev 48) @@ -55,9 +55,9 @@ } else { throw new UnsupportedOperationException("only forward supported"); } - + return cal; - + // } else if (HolidayHandlerType.BACKWARD.equals(holidayHandlerType)) { // cal.setHolidayHandler(new BackwardHandler()); // } else if Modified: 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-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java 2006-08-24 13:57:57 UTC (rev 48) @@ -25,18 +25,18 @@ /** * * @author Marcin Jekot - * + * */ public class ForwardHandler implements HolidayHandler<Date> { - public Date moveCurrentDate(DateCalculator<Date> calendar) { - - Calendar cal = Utils.getCal(calendar.getCurrentDate()); + public Date moveCurrentDate(final DateCalculator<Date> calendar) { + final Calendar cal = Utils.getCal(calendar.getCurrentDate()); + while (calendar.isNonWorkingDay(cal.getTime())) { cal.add(Calendar.DAY_OF_MONTH, 1); } - + return cal.getTime(); } Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/Utils.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/Utils.java 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/Utils.java 2006-08-24 13:57:57 UTC (rev 48) @@ -21,14 +21,14 @@ /** * * @author Marcin Jekot - * + * */ public class Utils { public static Calendar getCal(final Date date) { - Calendar cal = Calendar.getInstance(); + final Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } - + } Property changes on: trunk/datecalc-joda ___________________________________________________________________ Name: svn:ignore - target + target .fbwarnings Modified: trunk/datecalc-joda/maven.xml =================================================================== --- trunk/datecalc-joda/maven.xml 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-joda/maven.xml 2006-08-24 13:57:57 UTC (rev 48) @@ -1,31 +1,28 @@ <?xml version="1.0"?> -<!-- -/* - * ======================================================================== - * - * - * ======================================================================== - */ +<!-- + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ --> -<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:artifact="artifact" xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary"> - - <goal name="kit:rebuild" prereqs="kit:build" /> +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" + xmlns:artifact="artifact" + xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary"> - <goal name="kit:build" prereqs="jar:jar"> - <echo>ADD Common to full JAR</echo> - <ant:jar - basedir="target/classes" - jarfile="${maven.build.dir}/${maven.final.name}-full.jar" - update="yes" - > - <fileset dir="${basedir}/../datecalc-common/target/classes" - excludes="**/Test.class" - includes="**/*.class" - /> - </ant:jar> + <goal name="kit:rebuild" prereqs="clean,kit:build" /> - </goal> + <goal name="kit:build" prereqs="jar:jar"> + <echo>ADD Common classes to full JAR</echo> + <ant:jar basedir="target/classes" + jarfile="${maven.build.dir}/${pom.artifactId}-full-${pom.currentVersion}.jar" + update="yes"> + <fileset dir="${basedir}/../datecalc-common/target/classes" + excludes="**/Test.class" includes="**/*.class" /> + </ant:jar> + + </goal> </project> Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-24 13:57:57 UTC (rev 48) @@ -17,7 +17,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; @@ -45,17 +44,10 @@ this(null, null, Collections.EMPTY_SET, null); } - @SuppressWarnings("unchecked") - public BaseDateCalculator(final HolidayHandler holidayHandler) { - this(null, null, Collections.EMPTY_SET, holidayHandler); - } - public BaseDateCalculator(final String name, final LocalDate startDate, final Set<LocalDate> nonWorkingDays, - final HolidayHandler holidayHandler) { - this.name = name; + final HolidayHandler<LocalDate> holidayHandler) { + super(name, nonWorkingDays, holidayHandler); setStartDate(startDate); - this.nonWorkingDays = nonWorkingDays; - this.holidayHandler = holidayHandler; } public void setWorkingWeek(final WorkingWeek week) { @@ -72,25 +64,6 @@ return !workingWeek.isWorkingDay(date); } - /** - * is the given date a non working day? - */ - public boolean isNonWorkingDay(final LocalDate date) { - return (isWeekend(date) || nonWorkingDays.contains(date)); - } - - public boolean isCurrentDateNonWorking() { - return isNonWorkingDay(currentDate); - } - - public LocalDate setCurrentBusinessDate(final LocalDate date) { - currentDate = date; - if (holidayHandler != null && date != null) { - currentDate = holidayHandler.moveCurrentDate(this); - } - return currentDate; - } - public DateCalculator<LocalDate> moveByDays(final int days) { if (currentDate == null) { initialise(); @@ -112,53 +85,11 @@ } } - public DateCalculator<LocalDate> moveByBusinessDays(final int businessDays) { - final int numberOfStepsLeft = Math.abs(businessDays); - final int step = (businessDays < 0 ? -1 : 1); - - for (int i = 0; i < numberOfStepsLeft; i++) { - moveByDays(step); - } - - return this; + @Override + protected DateCalculator<LocalDate> createNewCalcultaor(final String name, final LocalDate startDate,final Set<LocalDate> holidays,final HolidayHandler<LocalDate> handler) { + return new BaseDateCalculator(name, startDate, holidays, handler); } - - /** - * Allows DateCalculators to be combined into a new one, the startDate and - * currentDate will be the ones from the existing calendar (not the - * parameter one). The name will be combined name1+"/"+calendar.getName(). - * - * @param calendar, - * return the same DateCalculator if calender is null or the - * original calendar (but why would you want to do that?) - * @throws IllegalArgumentException - * if both calendars have different types of HolidayHandlers or - * WorkingWeek; - */ - public DateCalculator<LocalDate> combine(final DateCalculator calendar) { - if (calendar == null || calendar == this) { - return this; - } - - if (holidayHandler == null && calendar.getHolidayHandlerType() != null || holidayHandler != null - && !holidayHandler.getType().equals(calendar.getHolidayHandlerType())) { - throw new IllegalArgumentException("Combined Calendars cannot have different handler types"); - } - - final Set<LocalDate> newSet = new HashSet<LocalDate>(); - if (nonWorkingDays != null) { - newSet.addAll(nonWorkingDays); - } - if (calendar.getNonWorkingDays() != null) { - newSet.addAll(calendar.getNonWorkingDays()); - } - - final DateCalculator<LocalDate> cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, - holidayHandler); - - return cal; - } - + public List<LocalDate> getIMMDates(final LocalDate start, final LocalDate end) { final List<LocalDate> dates = new ArrayList<LocalDate>(); @@ -175,23 +106,9 @@ return dates; } - public LocalDate getNextIMMDate() { - return getNextIMMDate(true, currentDate); - } - - public LocalDate getPreviousIMMDate() { - return getNextIMMDate(false, currentDate); - } - - private LocalDate getNextIMMDate(final boolean forward, final LocalDate start) { + @Override + protected LocalDate getNextIMMDate(final boolean forward, final LocalDate start) { LocalDate date = start; - // Monday = 1 -> + 2 for 1st Wed + 14 | 7 + 3 - 1 = 9 - // Tuesday = 2 -> + 1 for 1st Wed + 14 - // Wednesday = 3 -> + 0 for 1st Wed + 14 - // Thursday = 4 -> + 6 for 1st Wed + 14 - // Friday = 5 -> + 5 for 1st Wed + 14 - // Saturday = 6 -> + 4 for 1st Wed + 14 - // Sunday = 7 -> + 3 for 1st Wed + 14 final int month = date.getMonthOfYear(); int monthOffset = 0; @@ -207,17 +124,6 @@ } else if (!forward && !date.isAfter(immDate)) { date = date.minusMonths(MONTHS_IN_QUARTER); } - // - // final int day = date.getDayOfMonth(); - // final int immDay = calculateIMMDay(date); - // if (forward && day >= immDay || !forward && day <= immDay) { - // monthOffset = 3; - // if (forward) { - // date = date.plusMonths(monthOffset); - // } else { - // date = date.minusMonths(monthOffset); - // } - // } break; default: @@ -244,8 +150,6 @@ } return calculate3rdWednesday(date); - - // return date.dayOfMonth().setCopy(calculateIMMDay(date)); } /** @@ -263,5 +167,4 @@ } return firstWed.plusWeeks(2); } - } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java 2006-08-24 13:49:09 UTC (rev 47) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java 2006-08-24 13:57:57 UTC (rev 48) @@ -82,7 +82,7 @@ final int diff1 = new Period(start, endOfStartYear, PeriodType.days()).getDays(); final int diff2 = new Period(startOfEndYear, end, PeriodType.days()).getDays(); - diff = (diff1 + 1.0) / (double) start.dayOfYear().getMaximumValue() + (endYear - startYear - 1.0) + (diff2) + diff = (diff1 + 1.0) / start.dayOfYear().getMaximumValue() + (endYear - startYear - 1.0) + (diff2) / (double) end.dayOfYear().getMaximumValue(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 13:49:14
|
Revision: 47 Author: benoitx Date: 2006-08-24 06:49:09 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=47&view=rev Log Message: ----------- Put Google Analytics on most pages. Modified Paths: -------------- trunk/src/site/index.xml trunk/src/site/navigation.xml Modified: trunk/src/site/index.xml =================================================================== --- trunk/src/site/index.xml 2006-08-24 13:48:39 UTC (rev 46) +++ trunk/src/site/index.xml 2006-08-24 13:49:09 UTC (rev 47) @@ -81,12 +81,5 @@ </section> -<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> -</script> -<script type="text/javascript"> -_uacct = "UA-615747-1"; -urchinTracker(); -</script> - </body> </document> \ No newline at end of file Modified: trunk/src/site/navigation.xml =================================================================== --- trunk/src/site/navigation.xml 2006-08-24 13:48:39 UTC (rev 46) +++ trunk/src/site/navigation.xml 2006-08-24 13:49:09 UTC (rev 47) @@ -24,5 +24,15 @@ img="http://sourceforge.net/sflogo.php?group_id=140880&type=1"/> </menu> --> + + <footer> +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> +</script> +<script type="text/javascript"> +_uacct = "UA-615747-1"; +urchinTracker(); +</script> + + </footer> </body> </project> \ 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-08-24 13:48:44
|
Revision: 46 Author: benoitx Date: 2006-08-24 06:48:39 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=46&view=rev Log Message: ----------- tidy up. Modified Paths: -------------- trunk/datecalc-jdk/maven.xml trunk/datecalc-jdk/pom.xml trunk/datecalc-jdk/project.xml Modified: trunk/datecalc-jdk/maven.xml =================================================================== --- trunk/datecalc-jdk/maven.xml 2006-08-24 13:48:14 UTC (rev 45) +++ trunk/datecalc-jdk/maven.xml 2006-08-24 13:48:39 UTC (rev 46) @@ -1,30 +1,27 @@ <?xml version="1.0"?> -<!-- -/* - * ======================================================================== - * - * - * ======================================================================== - */ ---> +<!-- + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ +--> + +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" + xmlns:artifact="artifact" + xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary"> -<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:artifact="artifact" xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary"> - - <goal name="kit:rebuild" prereqs="kit:build" /> + <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" - update="yes" - > - <fileset dir="${basedir}/../datecalc-common/target/classes" - excludes="**/Test.class" - includes="**/*.class" - /> - </ant:jar> - - </goal> + <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" + update="yes"> + <fileset dir="${basedir}/../datecalc-common/target/classes" + excludes="**/Test.class" includes="**/*.class" /> + </ant:jar> + + </goal> </project> Modified: trunk/datecalc-jdk/pom.xml =================================================================== --- trunk/datecalc-jdk/pom.xml 2006-08-24 13:48:14 UTC (rev 45) +++ trunk/datecalc-jdk/pom.xml 2006-08-24 13:48:39 UTC (rev 46) @@ -1,45 +1,51 @@ <?xml version="1.0" encoding="UTF-8"?> -<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"> +<!-- + /* + * ======================================================================== + * 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> - <artifactId>datecalc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.objectlab.kit</groupId> + <artifactId>datecalc</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> - <artifactId>datecalc-jdk</artifactId> - <packaging>jar</packaging> - <name>Date Calculator for JDK</name> - <description> - Date Calculator methods for JDK - </description> + <artifactId>datecalc-jdk</artifactId> + <packaging>jar</packaging> + <name>Date Calculator for JDK</name> + <description>Date Calculator methods for JDK</description> - <reporting> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jdepend-maven-plugin</artifactId> - </plugin> - </plugins> - </reporting> + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> - <dependencies> - <dependency> - <groupId>net.objectlab.kit</groupId> - <artifactId>datecalc-common</artifactId> - <version>${pom.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>net.objectlab.kit</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> + <!-- TODO test cases should use log4j transparently --> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> - </dependencies> + </dependencies> </project> \ No newline at end of file Modified: trunk/datecalc-jdk/project.xml =================================================================== --- trunk/datecalc-jdk/project.xml 2006-08-24 13:48:14 UTC (rev 45) +++ trunk/datecalc-jdk/project.xml 2006-08-24 13:48:39 UTC (rev 46) @@ -1,94 +1,66 @@ <?xml version="1.0"?> <!-- - /* - * ======================================================================== - * - * ======================================================================== - */ + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ --> <project> - <extend>../common-build/project.xml</extend> - <name>DateCalc JDK</name> - <artifactId>datecalc-jdk</artifactId> - <package>net.objectlab.kit</package> - <shortDescription>DateCalc JDK library</shortDescription> - <description>This library provides pure JDK implementation of the Date Calculator.</description> - <repository> - <connection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-jdk</connection> - <developerConnection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-jdk</developerConnection> - </repository> - <dependencies> - <dependency> - <groupId>net.objectlab.kit</groupId> - <artifactId>datecalc-common</artifactId> - <version>${pom.currentVersion}</version> - <type>jar</type> - </dependency> - </dependencies> + <extend>../common-build/project.xml</extend> + <name>DateCalc JDK</name> + <artifactId>datecalc-jdk</artifactId> + <package>net.objectlab.kit</package> + <shortDescription>DateCalc JDK library</shortDescription> + <description> + This library provides pure JDK implementation of the Date + Calculator. + </description> + <repository> + <connection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-jdk + </connection> + <developerConnection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-jdk + </developerConnection> + </repository> + <dependencies> + <dependency> + <groupId>net.objectlab.kit</groupId> + <artifactId>datecalc-common</artifactId> + <version>${pom.currentVersion}</version> + <type>jar</type> + </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> + <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> - <!-- TODO: to be removed as it is not generic --> - <nagEmailAddress>bx...@ob...</nagEmailAddress> - <unitTest> - <includes> - <include>**/*Test.java</include> - </includes> - <excludes> - <exclude>**/Abstract*.java</exclude> - </excludes> -<!-- <resources> - <resource> - <directory>src/test/conf</directory> - <includes> - <include>*.properties</include> - <include>**/*.xml</include> - </includes> - </resource> - </resources> - --> - </unitTest> -<!-- <resources> - <resource> - <directory>src/conf</directory> - <includes> - <include>*.properties</include> - <include>**/*.xml</include> - <include>*.template</include> - </includes> - </resource> - <resource> - <directory>src/har</directory> - <includes> - <include>**/*.xml</include> - </includes> - </resource> - <resource> - <directory>../common/target</directory> - <includes> - <include>safemargin-common-${pom.currentVersion}.jar</include> - </includes> - </resource> - </resources> - --> - </build> + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory> + <unitTest> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*.java</exclude> + </excludes> + </unitTest> + </build> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 13:48:19
|
Revision: 45 Author: benoitx Date: 2006-08-24 06:48:14 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=45&view=rev Log Message: ----------- tidy up. Modified Paths: -------------- trunk/datecalc-common/maven.xml trunk/datecalc-common/pom.xml trunk/datecalc-common/project.xml Modified: trunk/datecalc-common/maven.xml =================================================================== --- trunk/datecalc-common/maven.xml 2006-08-24 13:47:52 UTC (rev 44) +++ trunk/datecalc-common/maven.xml 2006-08-24 13:48:14 UTC (rev 45) @@ -1,65 +1,60 @@ <?xml version="1.0"?> <!-- - /* - * ======================================================================== - * - * - * ======================================================================== - */ ---> + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ +--> <project xmlns:j="jelly:core" xmlns:core="jelly:core" - xmlns:maven="jelly:maven" xmlns:ant="jelly:ant" - xmlns:define="jelly:define" xmlns:doc="doc" xmlns:util="jelly:util" - xmlns:log="jelly:log"> - - <goal name="kit:build" prereqs="jar:install" /> - <goal name="kit:rebuild" prereqs="kit:build" /> + xmlns:maven="jelly:maven" xmlns:ant="jelly:ant" + xmlns:define="jelly:define" xmlns:doc="doc" xmlns:util="jelly:util" + xmlns:log="jelly:log"> - <goal name="ydoc" prereqs="xdoc:init" - description="Generate API documentation"> - <path id="maven.ydoc.path"> - <path refid="maven.dependency.classpath" /> - <path location="${maven.build.dest}" /> - <path location="${basedir}/../common-build/ydoc.jar" /> - <path location="${basedir}/../common-build/class2svg.jar" /> - <path location="${basedir}/../common-build/styleed.jar" /> - <path location="${maven.ydoc.resources}" /> - </path> - <property name="maven.ydoc.path.property" - refid="maven.ydoc.path" /> - <mkdir dir="${maven.build.dir}/docs/apidocs" /> - <mkdir dir="${maven.build.dir}/ydoc/" /> - <record name="${maven.build.dir}/ydoc/report.txt" - action="start" /> - <echo - message="Generating API docs in ${maven.ydoc.destination}" /> - <javadoc sourcepathref="maven.compile.src.set" - packagenames="net.objectlab.safemargin.*" maxmemory="255m" - destdir="${maven.build.dir}/docs/apidocs" - classpath="${maven.ydoc.path.property}" author="true" - additionalparam="-breakiterator"> - <doclet name="ydoc.doclets.YStandard" - path="${maven.ydoc.path.property}"> - <param name="-generic" /> - <param name="-umlautogen" /> - <param name="-ymode" value="LOG" /> - <param name="-filterpath" - value="${maven.ydoc.path.property}" /> - <param name="-filter" - value="ydoc.filters.ExcludeFilter" /> - <param name="-tag" value="y.precondition" /> - <param name="-tag" value="y.postcondition" /> - <param name="-tag" value="y.complexity" /> - <param name="-tag" value="param" /> - <param name="-tag" value="return" /> - <param name="-tag" value="see" /> - <param name="-tag" value="y.uml" /> - </doclet> - </javadoc> - <ant:record name="${maven.build.dir}/ydoc/report.txt" - action="stop" /> - </goal> + <goal name="kit:build" prereqs="jar:install" /> + <goal name="kit:rebuild" prereqs="clean,kit:build" /> + <goal name="ydoc" prereqs="xdoc:init" + description="Generate API documentation"> + <path id="maven.ydoc.path"> + <path refid="maven.dependency.classpath" /> + <path location="${maven.build.dest}" /> + <path location="${basedir}/../common-build/ydoc.jar" /> + <path location="${basedir}/../common-build/class2svg.jar" /> + <path location="${basedir}/../common-build/styleed.jar" /> + <path location="${maven.ydoc.resources}" /> + </path> + <property name="maven.ydoc.path.property" refid="maven.ydoc.path" /> + <mkdir dir="${maven.build.dir}/docs/apidocs" /> + <mkdir dir="${maven.build.dir}/ydoc/" /> + <record name="${maven.build.dir}/ydoc/report.txt" action="start" /> + <echo message="Generating API docs in ${maven.ydoc.destination}" /> + <javadoc sourcepathref="maven.compile.src.set" + packagenames="net.objectlab.safemargin.*" maxmemory="255m" + destdir="${maven.build.dir}/docs/apidocs" + classpath="${maven.ydoc.path.property}" author="true" + additionalparam="-breakiterator"> + <doclet name="ydoc.doclets.YStandard" + path="${maven.ydoc.path.property}"> + <param name="-generic" /> + <param name="-umlautogen" /> + <param name="-ymode" value="LOG" /> + <param name="-filterpath" + value="${maven.ydoc.path.property}" /> + <param name="-filter" value="ydoc.filters.ExcludeFilter" /> + <param name="-tag" value="y.precondition" /> + <param name="-tag" value="y.postcondition" /> + <param name="-tag" value="y.complexity" /> + <param name="-tag" value="param" /> + <param name="-tag" value="return" /> + <param name="-tag" value="see" /> + <param name="-tag" value="y.uml" /> + </doclet> + </javadoc> + <ant:record name="${maven.build.dir}/ydoc/report.txt" + action="stop" /> + </goal> + </project> Modified: trunk/datecalc-common/pom.xml =================================================================== --- trunk/datecalc-common/pom.xml 2006-08-24 13:47:52 UTC (rev 44) +++ trunk/datecalc-common/pom.xml 2006-08-24 13:48:14 UTC (rev 45) @@ -1,39 +1,46 @@ -<?xml version="1.0" encoding="UTF-8"?> -<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"> +<?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" + 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> - <artifactId>datecalc</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - <artifactId>datecalc-common</artifactId> - <packaging>jar</packaging> - <name>DateCalc commons</name> - <description> - Common Date Calculator methods - </description> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>net.objectlab.kit</groupId> + <artifactId>datecalc</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> - <reporting> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jdepend-maven-plugin</artifactId> - </plugin> - </plugins> - </reporting> + <artifactId>datecalc-common</artifactId> + <packaging>jar</packaging> + <name>DateCalc commons</name> + <description>Common Date Calculator methods</description> - <dependencies> - <!-- TODO test cases should use log4j transparently --> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>test</scope> - </dependency> + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> + </plugin> + </plugins> + </reporting> - </dependencies> + <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-common/project.xml =================================================================== --- trunk/datecalc-common/project.xml 2006-08-24 13:47:52 UTC (rev 44) +++ trunk/datecalc-common/project.xml 2006-08-24 13:48:14 UTC (rev 45) @@ -1,68 +1,59 @@ <?xml version="1.0"?> <!-- - /* - * ======================================================================== - * - * ======================================================================== - */ + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ --> <project> - <extend>../common-build/project.xml</extend> - <name>DateCalc Common</name> - <artifactId>datecalc-common</artifactId> - <package>net.objectlab.kit.common</package> - <shortDescription>DateCalc Common library</shortDescription> - <description> - DateCalc Common library is the library used by both JDK and JODA libraries. - </description> - <repository> - <connection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-common</connection> - <developerConnection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-common</developerConnection> - </repository> - <dependencies> - </dependencies> + <extend>../common-build/project.xml</extend> + <name>DateCalc Common</name> + <artifactId>datecalc-common</artifactId> + <package>net.objectlab.kit.common</package> + <shortDescription>DateCalc Common library</shortDescription> + <description> + DateCalc Common library is the library used by both JDK and JODA + libraries. + </description> + <repository> + <connection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-common + </connection> + <developerConnection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk/datecalc-common + </developerConnection> + </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> + <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> - <!-- TODO: to be removed as it is not generic - <nagEmailAddress>ki...@ob...</nagEmailAddress> --> - <unitTest> - <includes> - <include>**/*Test.java</include> - </includes> - <excludes> - <exclude>**/Abstract*.java</exclude> - </excludes> - </unitTest> - <!-- - <resources> - <resource> - <directory>src/conf</directory> - <includes> - <include>**/auth.conf</include> - </includes> - </resource> - </resources> - <aspectSourceDirectory>src/main/java</aspectSourceDirectory> - --> - </build> + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory> + <unitTest> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*.java</exclude> + </excludes> + </unitTest> + </build> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-24 13:48:01
|
Revision: 44 Author: benoitx Date: 2006-08-24 06:47:52 -0700 (Thu, 24 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=44&view=rev Log Message: ----------- tidy up. Modified Paths: -------------- trunk/common-build/checkstyle_checks.xml trunk/common-build/findbugs-exclude-filter.xml trunk/common-build/objectlab_checks.xml trunk/common-build/project.xml Modified: trunk/common-build/checkstyle_checks.xml =================================================================== --- trunk/common-build/checkstyle_checks.xml 2006-08-23 22:23:12 UTC (rev 43) +++ trunk/common-build/checkstyle_checks.xml 2006-08-24 13:47:52 UTC (rev 44) @@ -2,226 +2,226 @@ <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd"> <!-- - - ObjectLab Checkstyle. - $Id$ - + + ObjectLab Checkstyle. + $Id$ + --> <module name="Checker"> - <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <module name="PackageHtml" /> - <!-- Checks whether files end with a new line. --> - <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> - <module name="NewlineAtEndOfFile" /> - <!-- Checks that property files contain the same keys. --> - <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> - <module name="Translation" /> - <module name="TreeWalker"> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Javadoc comments. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html - -> - <module name="JavadocMethod"> - <property name="scope" value="public"/> - </module> - <module name="JavadocType"/> - <module name="JavadocVariable"/> - --> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Naming Conventions. --> - <!-- See http://checkstyle.sf.net/config_naming.html --> - <module name="ConstantName" /> - <module name="LocalFinalVariableName" /> - <module name="LocalVariableName" /> - <module name="MemberName" /> - <module name="MethodName" /> - <module name="PackageName" /> - <module name="ParameterName" /> - <module name="StaticVariableName" /> - <module name="TypeName" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Headers --> - <!-- See http://checkstyle.sf.net/config_header.html --> - <!-- <module name="Header"> --> - <!-- The follow property value demonstrates the ability --> - <!-- to have access to ANT properties. In this case it uses --> - <!-- the ${basedir} property to allow Checkstyle to be run --> - <!-- from any directory within a project. --> - <!-- <property name="headerFile" value="${basedir}/java.header"/> - </module> - --> - <!-- Following interprets the header file as regular expressions. --> - <!-- <module name="RegexpHeader"/> --> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for imports --> - <!-- See http://checkstyle.sf.net/config_import.html --> - <module name="AvoidStarImport" /> - <module name="IllegalImport" /> - <!-- defaults to sun.* packages --> - <module name="RedundantImport" /> - <module name="UnusedImports" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Size Violations. --> - <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength" /> - <module name="LineLength"> - <property name="max" value="150" /> - </module> - <module name="MethodLength"> - <property name="max" value="200" /> - </module> - <module name="ParameterNumber"> - <property name="max" value="8" /> - </module> - <module name="AnonInnerLength"> - <property name="max" value="25" /> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for whitespace --> - <!-- See http://checkstyle.sf.net/config_whitespace.html --> - <module name="EmptyForIteratorPad" /> - <!-- <module name="NoWhitespaceAfter"/> - <module name="NoWhitespaceBefore"/> - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"/> - --> - <module name="OperatorWrap" /> - <module name="ParenPad" /> - <module name="TypecastParenPad" /> - <module name="TabCharacter" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Modifier Checks --> - <!-- See http://checkstyle.sf.net/config_modifiers.html --> - <module name="ModifierOrder" /> - <module name="RedundantModifier" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for blocks. You know, those {}'s --> - <!-- See http://checkstyle.sf.net/config_blocks.html --> - <module name="AvoidNestedBlocks" /> - <module name="EmptyBlock" /> - <module name="LeftCurly" /> - <module name="NeedBraces" /> - <module name="RightCurly" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for common coding problems --> - <!-- See http://checkstyle.sf.net/config_coding.html --> - <!-- <module name="AvoidInlineConditionals"/> --> - <module name="DoubleCheckedLocking" /> - <module name="EmptyStatement" /> - <module name="EqualsHashCode" /> - <module name="HiddenField"> - <property name="ignoreSetter" value="true" /> - <property name="ignoreConstructorParameter" value="true" /> - </module> - <module name="IllegalInstantiation" /> - <module name="InnerAssignment" /> - <module name="MagicNumber" /> - <module name="MissingSwitchDefault" /> - <module name="RedundantThrows" /> - <module name="SimplifyBooleanExpression" /> - <module name="SimplifyBooleanReturn" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for class design --> - <!-- See http://checkstyle.sf.net/config_design.html --> - <!-- <module name="DesignForExtension"/> --> - <module name="MutableException" /> - <module name="FinalClass" /> - <module name="HideUtilityClassConstructor" /> - <module name="InterfaceIsType" /> - <module name="VisibilityModifier" /> - <module name="ThrowsCount"> - <property name="max" value="5" /> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- Miscellaneous other checks. --> - <!-- See http://checkstyle.sf.net/config_misc.html --> - <module name="ArrayTypeStyle" /> - <module name="FinalParameters"> - <property name="tokens" value="CTOR_DEF" /> - </module> - <module name="GenericIllegalRegexp"> - <!-- . matches any character, so we need to escape it and use \. to match dots. --> - <property name="format" value="System\.out\.println" /> - </module> - <module name="GenericIllegalRegexp"> - <!-- . matches any character, so we need to escape it and use \. to match dots. --> - <property name="format" value="System\.err\.println" /> - </module> - <module name="TodoComment" /> - <module name="UpperEll" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- New Tests with 3.2 --> - <module name="CyclomaticComplexity"> - <property name="max" value="15" /> - <!-- <property name="severity" value="ignore"/> --> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- See http://checkstyle.sf.net/config_usage.html --> - <!-- <module name="usage.OneMethodPrivateField"/> - <module name="usage.UnusedLocalVariable" /> - <module name="usage.UnusedParameter"> - <property name="ignoreFormat" value="^ignore" /> - </module> - <module name="usage.UnusedPrivateField"> - <property name="ignoreFormat" value="serialVersionUID" /> - </module> - <module name="usage.UnusedPrivateMethod"> - <property name="ignoreFormat" - value="readObject$|writeObject$|readResolve$" /> - </module>--> - <module name="StringLiteralEquality" /> - <module name="SuperClone" /> - <module name="SuperFinalize" /> - <module name="NestedIfDepth"> - <property name="max" value="3" /> - </module> - <module name="NestedTryDepth" /> - <module name="ReturnCount"> - <property name="max" value="3" /> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- j2ee stuff --> - <module name="j2ee.FinalStatic" /> - <module name="j2ee.LocalHomeInterface" /> - <module name="j2ee.LocalInterface" /> - <module name="j2ee.MessageBean" /> - <module name="j2ee.RemoteHomeInterface" /> - <module name="j2ee.RemoteInterface" /> - <module name="j2ee.SessionBean" /> - <module name="j2ee.ThisParameter" /> - <module name="j2ee.ThisReturn" /> - <!-- ============================== --> - <!-- ============================== --> - <!-- New 3.4 tests --> - <module name="BooleanExpressionComplexity"> - <property name="max" value="7" /> - </module> - <module name="ClassDataAbstractionCoupling"> - <property name="max" value="13" /> - </module> - <module name="NPathComplexity" /> - <module name="FallThrough" /> - <module name="MultipleVariableDeclarations" /> - <!-- <module name="UnnecessaryParentheses"/> --> - <!-- New 3.4 tests --> - </module> - <!-- <module name="SuppressionFilter"> - <property name="file" value="lib/build/checkstyle-suppressions.xml"/> - </module> - --> + <!-- Checks that a package.html file exists for each package. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> + <module name="PackageHtml" /> + <!-- Checks whether files end with a new line. --> + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> + <module name="NewlineAtEndOfFile" /> + <!-- Checks that property files contain the same keys. --> + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> + <module name="Translation" /> + <module name="TreeWalker"> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html - -> + <module name="JavadocMethod"> + <property name="scope" value="public"/> + </module> + <module name="JavadocType"/> + <module name="JavadocVariable"/> + --> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Naming Conventions. --> + <!-- See http://checkstyle.sf.net/config_naming.html --> + <module name="ConstantName" /> + <module name="LocalFinalVariableName" /> + <module name="LocalVariableName" /> + <module name="MemberName" /> + <module name="MethodName" /> + <module name="PackageName" /> + <module name="ParameterName" /> + <module name="StaticVariableName" /> + <module name="TypeName" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Headers --> + <!-- See http://checkstyle.sf.net/config_header.html --> + <!-- <module name="Header"> --> + <!-- The follow property value demonstrates the ability --> + <!-- to have access to ANT properties. In this case it uses --> + <!-- the ${basedir} property to allow Checkstyle to be run --> + <!-- from any directory within a project. --> + <!-- <property name="headerFile" value="${basedir}/java.header"/> + </module> + --> + <!-- Following interprets the header file as regular expressions. --> + <!-- <module name="RegexpHeader"/> --> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for imports --> + <!-- See http://checkstyle.sf.net/config_import.html --> + <module name="AvoidStarImport" /> + <module name="IllegalImport" /> + <!-- defaults to sun.* packages --> + <module name="RedundantImport" /> + <module name="UnusedImports" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="FileLength" /> + <module name="LineLength"> + <property name="max" value="150" /> + </module> + <module name="MethodLength"> + <property name="max" value="200" /> + </module> + <module name="ParameterNumber"> + <property name="max" value="8" /> + </module> + <module name="AnonInnerLength"> + <property name="max" value="25" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="EmptyForIteratorPad" /> + <!-- <module name="NoWhitespaceAfter"/> + <module name="NoWhitespaceBefore"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + --> + <module name="OperatorWrap" /> + <module name="ParenPad" /> + <module name="TypecastParenPad" /> + <module name="TabCharacter" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Modifier Checks --> + <!-- See http://checkstyle.sf.net/config_modifiers.html --> + <module name="ModifierOrder" /> + <module name="RedundantModifier" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for blocks. You know, those {}'s --> + <!-- See http://checkstyle.sf.net/config_blocks.html --> + <module name="AvoidNestedBlocks" /> + <module name="EmptyBlock" /> + <module name="LeftCurly" /> + <module name="NeedBraces" /> + <module name="RightCurly" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for common coding problems --> + <!-- See http://checkstyle.sf.net/config_coding.html --> + <!-- <module name="AvoidInlineConditionals"/> --> + <module name="DoubleCheckedLocking" /> + <module name="EmptyStatement" /> + <module name="EqualsHashCode" /> + <module name="HiddenField"> + <property name="ignoreSetter" value="true" /> + <property name="ignoreConstructorParameter" value="true" /> + </module> + <module name="IllegalInstantiation" /> + <module name="InnerAssignment" /> + <module name="MagicNumber" /> + <module name="MissingSwitchDefault" /> + <module name="RedundantThrows" /> + <module name="SimplifyBooleanExpression" /> + <module name="SimplifyBooleanReturn" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for class design --> + <!-- See http://checkstyle.sf.net/config_design.html --> + <!-- <module name="DesignForExtension"/> --> + <module name="MutableException" /> + <module name="FinalClass" /> + <module name="HideUtilityClassConstructor" /> + <module name="InterfaceIsType" /> + <module name="VisibilityModifier" /> + <module name="ThrowsCount"> + <property name="max" value="5" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- Miscellaneous other checks. --> + <!-- See http://checkstyle.sf.net/config_misc.html --> + <module name="ArrayTypeStyle" /> + <module name="FinalParameters"> + <property name="tokens" value="CTOR_DEF" /> + </module> + <module name="GenericIllegalRegexp"> + <!-- . matches any character, so we need to escape it and use \. to match dots. --> + <property name="format" value="System\.out\.println" /> + </module> + <module name="GenericIllegalRegexp"> + <!-- . matches any character, so we need to escape it and use \. to match dots. --> + <property name="format" value="System\.err\.println" /> + </module> + <module name="TodoComment" /> + <module name="UpperEll" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- New Tests with 3.2 --> + <module name="CyclomaticComplexity"> + <property name="max" value="15" /> + <!-- <property name="severity" value="ignore"/> --> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- See http://checkstyle.sf.net/config_usage.html --> + <!-- <module name="usage.OneMethodPrivateField"/> + <module name="usage.UnusedLocalVariable" /> + <module name="usage.UnusedParameter"> + <property name="ignoreFormat" value="^ignore" /> + </module> + <module name="usage.UnusedPrivateField"> + <property name="ignoreFormat" value="serialVersionUID" /> + </module> + <module name="usage.UnusedPrivateMethod"> + <property name="ignoreFormat" + value="readObject$|writeObject$|readResolve$" /> + </module>--> + <module name="StringLiteralEquality" /> + <module name="SuperClone" /> + <module name="SuperFinalize" /> + <module name="NestedIfDepth"> + <property name="max" value="3" /> + </module> + <module name="NestedTryDepth" /> + <module name="ReturnCount"> + <property name="max" value="3" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- j2ee stuff --> + <module name="j2ee.FinalStatic" /> + <module name="j2ee.LocalHomeInterface" /> + <module name="j2ee.LocalInterface" /> + <module name="j2ee.MessageBean" /> + <module name="j2ee.RemoteHomeInterface" /> + <module name="j2ee.RemoteInterface" /> + <module name="j2ee.SessionBean" /> + <module name="j2ee.ThisParameter" /> + <module name="j2ee.ThisReturn" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- New 3.4 tests --> + <module name="BooleanExpressionComplexity"> + <property name="max" value="7" /> + </module> + <module name="ClassDataAbstractionCoupling"> + <property name="max" value="13" /> + </module> + <module name="NPathComplexity" /> + <module name="FallThrough" /> + <module name="MultipleVariableDeclarations" /> + <!-- <module name="UnnecessaryParentheses"/> --> + <!-- New 3.4 tests --> + </module> + <!-- <module name="SuppressionFilter"> + <property name="file" value="lib/build/checkstyle-suppressions.xml"/> + </module> + --> </module> Modified: trunk/common-build/findbugs-exclude-filter.xml =================================================================== --- trunk/common-build/findbugs-exclude-filter.xml 2006-08-23 22:23:12 UTC (rev 43) +++ trunk/common-build/findbugs-exclude-filter.xml 2006-08-24 13:47:52 UTC (rev 44) @@ -1,6 +1,12 @@ -<!-- $Id$ --> +<!-- + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ +--> <FindBugsFilter> - <Match classregex="net.*" > - <BugCode name="EI,EI2" /> - </Match> + <Match classregex="net.*"> + <BugCode name="EI,EI2" /> + </Match> </FindBugsFilter> Modified: trunk/common-build/objectlab_checks.xml =================================================================== --- trunk/common-build/objectlab_checks.xml 2006-08-23 22:23:12 UTC (rev 43) +++ trunk/common-build/objectlab_checks.xml 2006-08-24 13:47:52 UTC (rev 44) @@ -2,226 +2,225 @@ <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd"> <!-- - - ObjectLab Checkstyle. - $Id$ - + + ObjectLab Checkstyle. --> + <module name="Checker"> - <!-- Checks that a package.html file exists for each package. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> - <module name="PackageHtml"/> - <!-- Checks whether files end with a new line. --> - <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile - <module name="NewlineAtEndOfFile"/>--> - <!-- Checks that property files contain the same keys. --> - <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> - <module name="Translation"/> - <module name="TreeWalker"> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Javadoc comments. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html - -> - <module name="JavadocMethod"> - <property name="scope" value="public"/> - </module> - <module name="JavadocType"/> - <module name="JavadocVariable"/> ---> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Naming Conventions. --> - <!-- See http://checkstyle.sf.net/config_naming.html --> - <module name="ConstantName"/> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"/> - <module name="MethodName"/> - <module name="PackageName"/> - <module name="ParameterName"/> - <module name="StaticVariableName"/> - <module name="TypeName"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Headers --> - <!-- See http://checkstyle.sf.net/config_header.html --> - <!-- <module name="Header"> --> - <!-- The follow property value demonstrates the ability --> - <!-- to have access to ANT properties. In this case it uses --> - <!-- the ${basedir} property to allow Checkstyle to be run --> - <!-- from any directory within a project. --> - <!-- <property name="headerFile" value="${basedir}/java.header"/> - </module> - --> - <!-- Following interprets the header file as regular expressions. --> - <!-- <module name="RegexpHeader"/> --> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for imports --> - <!-- See http://checkstyle.sf.net/config_import.html --> - <module name="AvoidStarImport"/> - <module name="IllegalImport"/> - <!-- defaults to sun.* packages --> - <module name="RedundantImport"/> - <module name="UnusedImports"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for Size Violations. --> - <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="FileLength"/> - <module name="LineLength"> - <property name="max" value="150"/> - </module> - <module name="MethodLength"> - <property name="max" value="200"/> - </module> - <module name="ParameterNumber"> - <property name="max" value="8"/> - </module> - <module name="AnonInnerLength"> - <property name="max" value="25"/> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for whitespace --> - <!-- See http://checkstyle.sf.net/config_whitespace.html --> - <module name="EmptyForIteratorPad"/> - <!-- <module name="NoWhitespaceAfter"/> - <module name="NoWhitespaceBefore"/> - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"/> - --> - <module name="OperatorWrap"/> - <module name="ParenPad"/> - <module name="TypecastParenPad"/> - <module name="TabCharacter"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Modifier Checks --> - <!-- See http://checkstyle.sf.net/config_modifiers.html --> - <module name="ModifierOrder"/> - <module name="RedundantModifier"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for blocks. You know, those {}'s --> - <!-- See http://checkstyle.sf.net/config_blocks.html --> - <module name="AvoidNestedBlocks"/> - <module name="EmptyBlock"/> - <module name="LeftCurly"/> - <module name="NeedBraces"/> - <module name="RightCurly"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for common coding problems --> - <!-- See http://checkstyle.sf.net/config_coding.html --> - <!-- <module name="AvoidInlineConditionals"/> --> - <module name="DoubleCheckedLocking"/> - <module name="EmptyStatement"/> - <module name="EqualsHashCode"/> - <module name="HiddenField"> - <property name="ignoreSetter" value="true"/> - <property name="ignoreConstructorParameter" value="true"/> - </module> - <module name="IllegalInstantiation"/> - <module name="InnerAssignment"/> - <module name="MagicNumber"/> - <module name="MissingSwitchDefault"/> - <module name="RedundantThrows"/> - <module name="SimplifyBooleanExpression"/> - <module name="SimplifyBooleanReturn"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- Checks for class design --> - <!-- See http://checkstyle.sf.net/config_design.html --> - <!-- <module name="DesignForExtension"/> --> - <module name="MutableException"/> - <module name="FinalClass"/> - <module name="HideUtilityClassConstructor"/> - <module name="InterfaceIsType"/> - <module name="VisibilityModifier"/> - <module name="ThrowsCount"> - <property name="max" value="5"/> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- Miscellaneous other checks. --> - <!-- See http://checkstyle.sf.net/config_misc.html --> - <module name="ArrayTypeStyle"/> - <module name="FinalParameters"> - <property name="tokens" value="CTOR_DEF"/> - </module> - <module name="GenericIllegalRegexp"> - <!-- . matches any character, so we need to escape it and use \. to match dots. --> - <property name="format" value="System\.out\.println"/> - </module> - <module name="GenericIllegalRegexp"> - <!-- . matches any character, so we need to escape it and use \. to match dots. --> - <property name="format" value="System\.err\.println"/> - </module> - <module name="TodoComment"/> - <module name="UpperEll"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- New Tests with 3.2 --> - <module name="CyclomaticComplexity"> - <property name="max" value="15"/> - <!-- <property name="severity" value="ignore"/> --> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- See http://checkstyle.sf.net/config_usage.html --> - <!-- <module name="usage.OneMethodPrivateField"/> - <module name="usage.UnusedLocalVariable"/> - <module name="usage.UnusedParameter"> - <property name="ignoreFormat" value="^ignore"/> - </module> - <module name="usage.UnusedPrivateField"> - <property name="ignoreFormat" value="serialVersionUID"/> - </module> - <module name="usage.UnusedPrivateMethod"> - <property name="ignoreFormat" value="readObject$|writeObject$|readResolve$"/> - </module>--> - <module name="StringLiteralEquality"/> - <module name="SuperClone"/> - <module name="SuperFinalize"/> - <module name="NestedIfDepth"> - <property name="max" value="3"/> - </module> - <module name="NestedTryDepth"/> - <module name="ReturnCount"> - <property name="max" value="3"/> - </module> - <!-- ============================== --> - <!-- ============================== --> - <!-- j2ee stuff --> - <module name="j2ee.FinalStatic"/> - <module name="j2ee.LocalHomeInterface"/> - <module name="j2ee.LocalInterface"/> - <module name="j2ee.MessageBean"/> - <module name="j2ee.RemoteHomeInterface"/> - <module name="j2ee.RemoteInterface"/> - <module name="j2ee.SessionBean"/> - <module name="j2ee.ThisParameter"/> - <module name="j2ee.ThisReturn"/> - <!-- ============================== --> - <!-- ============================== --> - <!-- New 3.4 tests --> - <module name="BooleanExpressionComplexity"> - <property name="max" value="7"/> - </module> - <module name="ClassDataAbstractionCoupling"> - <property name="max" value="13"/> - </module> - <module name="NPathComplexity"/> - <module name="FallThrough"/> - <module name="MultipleVariableDeclarations"/> - <!-- <module name="UnnecessaryParentheses"/> --> - <!-- New 3.4 tests --> - </module> -<!-- -<module name="SuppressionFilter"> - <property name="file" value="lib/build/checkstyle-suppressions.xml"/> - </module> - --> + <!-- Checks that a package.html file exists for each package. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml --> + <module name="PackageHtml" /> + <!-- Checks whether files end with a new line. --> + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile + <module name="NewlineAtEndOfFile"/>--> + <!-- Checks that property files contain the same keys. --> + <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> + <module name="Translation" /> + <module name="TreeWalker"> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html - -> + <module name="JavadocMethod"> + <property name="scope" value="public"/> + </module> + <module name="JavadocType"/> + <module name="JavadocVariable"/> + --> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Naming Conventions. --> + <!-- See http://checkstyle.sf.net/config_naming.html --> + <module name="ConstantName" /> + <module name="LocalFinalVariableName" /> + <module name="LocalVariableName" /> + <module name="MemberName" /> + <module name="MethodName" /> + <module name="PackageName" /> + <module name="ParameterName" /> + <module name="StaticVariableName" /> + <module name="TypeName" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Headers --> + <!-- See http://checkstyle.sf.net/config_header.html --> + <!-- <module name="Header"> --> + <!-- The follow property value demonstrates the ability --> + <!-- to have access to ANT properties. In this case it uses --> + <!-- the ${basedir} property to allow Checkstyle to be run --> + <!-- from any directory within a project. --> + <!-- <property name="headerFile" value="${basedir}/java.header"/> + </module> + --> + <!-- Following interprets the header file as regular expressions. --> + <!-- <module name="RegexpHeader"/> --> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for imports --> + <!-- See http://checkstyle.sf.net/config_import.html --> + <module name="AvoidStarImport" /> + <module name="IllegalImport" /> + <!-- defaults to sun.* packages --> + <module name="RedundantImport" /> + <module name="UnusedImports" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for Size Violations. --> + <!-- See http://checkstyle.sf.net/config_sizes.html --> + <module name="FileLength" /> + <module name="LineLength"> + <property name="max" value="150" /> + </module> + <module name="MethodLength"> + <property name="max" value="200" /> + </module> + <module name="ParameterNumber"> + <property name="max" value="8" /> + </module> + <module name="AnonInnerLength"> + <property name="max" value="25" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for whitespace --> + <!-- See http://checkstyle.sf.net/config_whitespace.html --> + <module name="EmptyForIteratorPad" /> + <!-- <module name="NoWhitespaceAfter"/> + <module name="NoWhitespaceBefore"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + --> + <module name="OperatorWrap" /> + <module name="ParenPad" /> + <module name="TypecastParenPad" /> + <module name="TabCharacter" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Modifier Checks --> + <!-- See http://checkstyle.sf.net/config_modifiers.html --> + <module name="ModifierOrder" /> + <module name="RedundantModifier" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for blocks. You know, those {}'s --> + <!-- See http://checkstyle.sf.net/config_blocks.html --> + <module name="AvoidNestedBlocks" /> + <module name="EmptyBlock" /> + <module name="LeftCurly" /> + <module name="NeedBraces" /> + <module name="RightCurly" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for common coding problems --> + <!-- See http://checkstyle.sf.net/config_coding.html --> + <!-- <module name="AvoidInlineConditionals"/> --> + <module name="DoubleCheckedLocking" /> + <module name="EmptyStatement" /> + <module name="EqualsHashCode" /> + <module name="HiddenField"> + <property name="ignoreSetter" value="true" /> + <property name="ignoreConstructorParameter" value="true" /> + </module> + <module name="IllegalInstantiation" /> + <module name="InnerAssignment" /> + <module name="MagicNumber" /> + <module name="MissingSwitchDefault" /> + <module name="RedundantThrows" /> + <module name="SimplifyBooleanExpression" /> + <module name="SimplifyBooleanReturn" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- Checks for class design --> + <!-- See http://checkstyle.sf.net/config_design.html --> + <!-- <module name="DesignForExtension"/> --> + <module name="MutableException" /> + <module name="FinalClass" /> + <module name="HideUtilityClassConstructor" /> + <module name="InterfaceIsType" /> + <module name="VisibilityModifier" /> + <module name="ThrowsCount"> + <property name="max" value="5" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- Miscellaneous other checks. --> + <!-- See http://checkstyle.sf.net/config_misc.html --> + <module name="ArrayTypeStyle" /> + <module name="FinalParameters"> + <property name="tokens" value="CTOR_DEF" /> + </module> + <module name="GenericIllegalRegexp"> + <!-- . matches any character, so we need to escape it and use \. to match dots. --> + <property name="format" value="System\.out\.println" /> + </module> + <module name="GenericIllegalRegexp"> + <!-- . matches any character, so we need to escape it and use \. to match dots. --> + <property name="format" value="System\.err\.println" /> + </module> + <module name="TodoComment" /> + <module name="UpperEll" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- New Tests with 3.2 --> + <module name="CyclomaticComplexity"> + <property name="max" value="15" /> + <!-- <property name="severity" value="ignore"/> --> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- See http://checkstyle.sf.net/config_usage.html --> + <!-- <module name="usage.OneMethodPrivateField"/> + <module name="usage.UnusedLocalVariable"/> + <module name="usage.UnusedParameter"> + <property name="ignoreFormat" value="^ignore"/> + </module> + <module name="usage.UnusedPrivateField"> + <property name="ignoreFormat" value="serialVersionUID"/> + </module> + <module name="usage.UnusedPrivateMethod"> + <property name="ignoreFormat" value="readObject$|writeObject$|readResolve$"/> + </module>--> + <module name="StringLiteralEquality" /> + <module name="SuperClone" /> + <module name="SuperFinalize" /> + <module name="NestedIfDepth"> + <property name="max" value="3" /> + </module> + <module name="NestedTryDepth" /> + <module name="ReturnCount"> + <property name="max" value="3" /> + </module> + <!-- ============================== --> + <!-- ============================== --> + <!-- j2ee stuff --> + <module name="j2ee.FinalStatic" /> + <module name="j2ee.LocalHomeInterface" /> + <module name="j2ee.LocalInterface" /> + <module name="j2ee.MessageBean" /> + <module name="j2ee.RemoteHomeInterface" /> + <module name="j2ee.RemoteInterface" /> + <module name="j2ee.SessionBean" /> + <module name="j2ee.ThisParameter" /> + <module name="j2ee.ThisReturn" /> + <!-- ============================== --> + <!-- ============================== --> + <!-- New 3.4 tests --> + <module name="BooleanExpressionComplexity"> + <property name="max" value="7" /> + </module> + <module name="ClassDataAbstractionCoupling"> + <property name="max" value="13" /> + </module> + <module name="NPathComplexity" /> + <module name="FallThrough" /> + <module name="MultipleVariableDeclarations" /> + <!-- <module name="UnnecessaryParentheses"/> --> + <!-- New 3.4 tests --> + </module> + <!-- + <module name="SuppressionFilter"> + <property name="file" value="lib/build/checkstyle-suppressions.xml"/> + </module> + --> </module> Modified: trunk/common-build/project.xml =================================================================== --- trunk/common-build/project.xml 2006-08-23 22:23:12 UTC (rev 43) +++ trunk/common-build/project.xml 2006-08-24 13:47:52 UTC (rev 44) @@ -1,95 +1,116 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /* - * ======================================================================== - * - * - * ======================================================================== - */ + /* + * ======================================================================== + * ObjectLab Financial Ltd, proud sponsor of The Kit. + * ======================================================================== + */ --> <project xmlns="http://maven.apache.org/POM/3.0.0" - 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> - <currentVersion>1.0</currentVersion> - <organization> - <name>ObjectLab Financial Ltd</name> - <url>http://www.objectlab.co.uk</url> - <logo> - http://www.objectlab.co.uk/images/objectlab-web-noblue.gif - </logo> - </organization> - <inceptionYear>2006</inceptionYear> - <url>http://objectlabkit.sourceforge.net</url> - <siteAddress>objectlabkit.sourceforge.net</siteAddress> - <siteDirectory> - /var/www/solutions/website/objectlab.co.uk/ - </siteDirectory> - <repository> - <connection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk</connection> - <developerConnection>scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk</developerConnection> - </repository> - <developers> - <developer> - <name>Benoit Xhenseval</name> - <id>benoitx</id> - <email>kit AT objectlab DOT co dOt uk</email> - <organization>ObjectLab Financial Ltd</organization> - <roles> - <role>Team Leader</role> - <role>Developer</role> - </roles> - <url>http://www.xhenseval.com</url> - <timezone>+0</timezone> - </developer> - <developer> - <name>Marcin Jekot</name> - <id>marchy</id> - <email>marcin at jekot DOt net</email> - <organization>ObjectLab Financial Ltd</organization> - <roles> - <role>Developer</role> - </roles> - <timezone>+0</timezone> - </developer> - </developers> - <!-- any mailing lists for the project --> - <mailingLists> - <mailingList> - <name>Kit Announcements</name> - <subscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</subscribe> - <unsubscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</unsubscribe> - <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-announce</archive> - - </mailingList> - <mailingList> - <name>Kit User</name> - <subscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-user</subscribe> - <unsubscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-user</unsubscribe> - <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-user</archive> - </mailingList> - <mailingList> - <name>Kit Developers (SVN checkins)</name> - <subscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</subscribe> - <unsubscribe>https://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</unsubscribe> - <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-svn</archive> - </mailingList> - </mailingLists> + 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> + <currentVersion>1.0</currentVersion> + <organization> + <name>ObjectLab Financial Ltd</name> + <url>http://www.objectlab.co.uk</url> + <logo> + http://www.objectlab.co.uk/images/objectlab-web-noblue.gif + </logo> + </organization> + <inceptionYear>2006</inceptionYear> + <url>http://objectlabkit.sourceforge.net</url> + <siteAddress>objectlabkit.sourceforge.net</siteAddress> + <siteDirectory> + /var/www/solutions/website/objectlab.co.uk/ + </siteDirectory> + <repository> + <connection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk + </connection> + <developerConnection> + scm:svn:https://svn.sourceforge.net/svnroot/objectlabkit/trunk + </developerConnection> + </repository> + <developers> + <developer> + <name>Benoit Xhenseval</name> + <id>benoitx</id> + <email>kit AT objectlab DOT co dOt uk</email> + <organization>ObjectLab Financial Ltd</organization> + <roles> + <role>Team Leader</role> + <role>Developer</role> + </roles> + <url>http://www.xhenseval.com</url> + <timezone>+0</timezone> + </developer> + <developer> + <name>Marcin Jekot</name> + <id>marchy</id> + <email>marcin at jekot DOt net</email> + <organization>ObjectLab Financial Ltd</organization> + <roles> + <role>Developer</role> + </roles> + <timezone>+0</timezone> + </developer> + </developers> + <!-- any mailing lists for the project --> + <mailingLists> + <mailingList> + <name>Kit Announcements</name> + <subscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-announce + </subscribe> + <unsubscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-announce + </unsubscribe> + <archive> + http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-announce + </archive> - <build> - <!-- We need to put here something other when we release it or I'll receive the emails from - everyone who tries to use the project... --> - <nagEmailAddress>ki...@ob...</nagEmailAddress> - <defaultGoal>kit:build</defaultGoal> - </build> - - <versions> - <version> - <id>1.0</id> - <name>1.0</name> - <tag>KIT_1_0</tag> - </version> - </versions> + </mailingList> + <mailingList> + <name>Kit User</name> + <subscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-user + </subscribe> + <unsubscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-user + </unsubscribe> + <archive> + http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-user + </archive> + </mailingList> + <mailingList> + <name>Kit Developers (SVN checkins)</name> + <subscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-svn + </subscribe> + <unsubscribe> + https://lists.sourceforge.net/lists/listinfo/objectlabkit-svn + </unsubscribe> + <archive> + http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-svn + </archive> + </mailingList> + </mailingLists> + + <build> + <!-- We need to put here something other when we release it or I'll receive the emails from + everyone who tries to use the project... --> + <nagEmailAddress>ki...@ob...</nagEmailAddress> + <defaultGoal>kit:build</defaultGoal> + </build> + + <versions> + <version> + <id>1.0</id> + <name>1.0</name> + <tag>KIT_1_0</tag> + </version> + </versions> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <be...@us...> - 2006-08-23 22:23:44
|
Revision: 43 Author: benoitx Date: 2006-08-23 15:23:12 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=43&view=rev Log Message: ----------- new stats Modified Paths: -------------- trunk/datecalc-common/qalab.xml trunk/datecalc-jdk/qalab.xml trunk/datecalc-joda/qalab.xml Modified: trunk/datecalc-common/qalab.xml =================================================================== --- trunk/datecalc-common/qalab.xml 2006-08-23 22:05:50 UTC (rev 42) +++ trunk/datecalc-common/qalab.xml 2006-08-23 22:23:12 UTC (rev 43) @@ -34,9 +34,9 @@ <summaryresult date="2006-08-20" filecount="7" statvalue="1" type="checkstyle"/> <summaryresult date="2006-08-20" filecount="6" statvalue="90" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="6" statvalue="100" type="cobertura-branch"/> - <summaryresult date="2006-08-23" filecount="9" statvalue="24" type="checkstyle"/> - <summaryresult date="2006-08-23" filecount="8" statvalue="75" type="cobertura-line"/> - <summaryresult date="2006-08-23" filecount="8" statvalue="91" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="10" statvalue="25" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="9" statvalue="74" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="9" statvalue="87" 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"/> @@ -124,12 +124,17 @@ </file> <file id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java"> - <result date="2006-08-23" statvalue="4" type="checkstyle"/> + <result date="2006-08-23" statvalue="5" type="checkstyle"/> </file> <file - id="net_objectlab_kit_datecalc_common_DateCalculatorGeneric.java" path="net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java"> + id="net_objectlab_kit_datecalc_common_DateCalculatorGeneric.java" path="net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java"/> + <file id="net_objectlab_kit_datecalc_common_DateCalculator.java" path="net/objectlab/kit/datecalc/common/DateCalculator.java"> <result date="2006-08-23" statvalue="19" type="checkstyle"/> <result date="2006-08-23" statvalue="100" type="cobertura-line"/> <result date="2006-08-23" 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"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + </file> </qalab> Modified: trunk/datecalc-jdk/qalab.xml =================================================================== --- trunk/datecalc-jdk/qalab.xml 2006-08-23 22:05:50 UTC (rev 42) +++ trunk/datecalc-jdk/qalab.xml 2006-08-23 22:23:12 UTC (rev 43) @@ -31,11 +31,10 @@ <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="findbugs"/> <summaryresult date="2006-08-20" filecount="9" statvalue="77" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="9" statvalue="77" type="cobertura-branch"/> - <summaryresult date="2006-08-23" filecount="10" statvalue="8" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="8" statvalue="8" type="checkstyle"/> <summaryresult date="2006-08-23" filecount="1" statvalue="1" type="pmd"/> - <summaryresult date="2006-08-23" filecount="1" statvalue="1" type="findbugs"/> - <summaryresult date="2006-08-23" filecount="9" statvalue="82" type="cobertura-line"/> - <summaryresult date="2006-08-23" filecount="9" statvalue="80" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="7" statvalue="81" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="7" statvalue="79" 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"/> @@ -61,9 +60,8 @@ <result date="2006-08-20" statvalue="75" type="cobertura-branch"/> <result date="2006-08-23" statvalue="5" type="checkstyle"/> <result date="2006-08-23" statvalue="1" type="pmd"/> - <result date="2006-08-23" statvalue="1" type="findbugs"/> - <result date="2006-08-23" statvalue="79" type="cobertura-line"/> - <result date="2006-08-23" statvalue="77" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="78" type="cobertura-line"/> + <result date="2006-08-23" statvalue="76" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java"> @@ -92,8 +90,6 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> - <result date="2006-08-23" statvalue="100" type="cobertura-line"/> - <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -116,8 +112,6 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> - <result date="2006-08-23" statvalue="100" type="cobertura-line"/> - <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/PeriodCountCalculator.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> Modified: trunk/datecalc-joda/qalab.xml =================================================================== --- trunk/datecalc-joda/qalab.xml 2006-08-23 22:05:50 UTC (rev 42) +++ trunk/datecalc-joda/qalab.xml 2006-08-23 22:23:12 UTC (rev 43) @@ -40,9 +40,9 @@ <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="pmd"/> <summaryresult date="2006-08-20" filecount="12" statvalue="86" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="12" statvalue="88" type="cobertura-branch"/> - <summaryresult date="2006-08-23" filecount="13" statvalue="1" type="checkstyle"/> - <summaryresult date="2006-08-23" filecount="12" statvalue="93" type="cobertura-line"/> - <summaryresult date="2006-08-23" filecount="12" statvalue="95" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="11" statvalue="1" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="10" statvalue="93" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="10" statvalue="95" 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"/> @@ -152,8 +152,6 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> - <result date="2006-08-23" statvalue="100" type="cobertura-line"/> - <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DateCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java"> @@ -195,8 +193,6 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> - <result date="2006-08-23" statvalue="100" type="cobertura-line"/> - <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/PeriodCountCalculator.java"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-23 22:06:07
|
Revision: 42 Author: marchy Date: 2006-08-23 15:05:50 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=42&view=rev Log Message: ----------- changed <DateType> to more conventional <E> 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/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.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-08-23 22:00:20 UTC (rev 41) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-23 22:05:50 UTC (rev 42) @@ -3,16 +3,16 @@ import java.util.Collections; import java.util.Set; -public abstract class AbstractDateCalculator<DateType> implements DateCalculator<DateType> { +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; protected String name; - protected DateType startDate; - protected DateType currentDate; - protected Set<DateType> nonWorkingDays; - protected HolidayHandler<DateType> holidayHandler; + protected E startDate; + protected E currentDate; + protected Set<E> nonWorkingDays; + protected HolidayHandler<E> holidayHandler; public String getName() { return name; @@ -22,25 +22,25 @@ this.name = name; } - public DateType getStartDate() { + public E getStartDate() { return startDate; } /** Set both start date and current date */ - public void setStartDate(final DateType startDate) { + public void setStartDate(final E startDate) { this.startDate = startDate; setCurrentBusinessDate(startDate); } - public DateType getCurrentDate() { + public E getCurrentDate() { return currentDate; } - public Set<DateType> getNonWorkingDays() { + public Set<E> getNonWorkingDays() { return Collections.unmodifiableSet(nonWorkingDays); } - public void setNonWorkingDays(final Set<DateType> holidays) { + public void setNonWorkingDays(final Set<E> holidays) { if (holidays == null) { nonWorkingDays = Collections.emptySet(); } else { @@ -57,7 +57,7 @@ * @return the current businessCalendar (so one can do * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) */ - public DateCalculator<DateType> moveByTenor(final Tenor tenor) { + public DateCalculator<E> moveByTenor(final Tenor tenor) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } @@ -76,7 +76,7 @@ } - public void setHolidayHandler(final HolidayHandler<DateType> holidayHandler) { + public void setHolidayHandler(final HolidayHandler<E> holidayHandler) { this.holidayHandler = holidayHandler; } 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-08-23 22:00:20 UTC (rev 41) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-23 22:05:50 UTC (rev 42) @@ -4,7 +4,7 @@ import java.util.Set; -public interface DateCalculator<DateType> { +public interface DateCalculator<E> { /** * @return Calendar name (Typically the name associated with the holiday @@ -18,28 +18,28 @@ * updated and may be moved if it falls on a non working day * (holiday/weekend). */ - public void setStartDate(final DateType startDate); + public void setStartDate(final E startDate); /** * @return startDate the reference date for this calendar. */ - public DateType getStartDate(); + public E getStartDate(); /** * @param currentDate held by the calendar. */ - public DateType getCurrentDate(); + public E getCurrentDate(); /** * is the given date on a weekend, according to the WorkingWeek */ - public boolean isWeekend(final DateType date); + public boolean isWeekend(final E date); /** * is the given date a non working day, i.e. either a "weekend" or a * holiday? */ - public boolean isNonWorkingDay(final DateType date); + public boolean isNonWorkingDay(final E date); /** * @return true if the current date is either a weekend or a holiday. @@ -52,12 +52,12 @@ * @param holidays * the holiday (if null, an empty set will be put in place) */ - public void setNonWorkingDays(final Set<DateType> holidays); + public void setNonWorkingDays(final Set<E> holidays); /** * @return an immutable copy of the holiday set. */ - public Set<DateType> getNonWorkingDays(); + public Set<E> getNonWorkingDays(); /** * Allow user to define what their Working Week should be (default is @@ -74,7 +74,7 @@ * @param date * @return new current date if moved. */ - public DateType setCurrentBusinessDate(final DateType date); + public E setCurrentBusinessDate(final E date); /** * @return the holiday handler type, can be null @@ -91,7 +91,7 @@ * @return the businessCalendar (so one can do * calendar.moveByDays(-2).getCurrentBusinessDate();) */ - public DateCalculator<DateType> moveByDays(final int days); + public DateCalculator<E> moveByDays(final int days); /** * move the current date by a number of business days, this means that if a @@ -102,7 +102,7 @@ * @return the current businessCalendar (so one can do * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) */ - public DateCalculator<DateType> moveByBusinessDays(final int businessDays); + public DateCalculator<E> moveByBusinessDays(final int businessDays); /** * By combining several calendars, we take into account several set of @@ -111,7 +111,7 @@ * @param calendar * @return a new DateCalculator */ - public DateCalculator<DateType> combine(DateCalculator<DateType> calendar); + public DateCalculator<E> combine(DateCalculator<E> calendar); /** * move the current date by a given tenor, this means that if a date is @@ -122,17 +122,17 @@ * @return the current businessCalendar (so one can do * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) */ - public DateCalculator<DateType> moveByTenor(final Tenor tenor); + public DateCalculator<E> moveByTenor(final Tenor tenor); /** * @return the next IMMDate based on current date. */ - public DateType getNextIMMDate(); + public E getNextIMMDate(); /** * @return the previous IMMDate based on current date. */ - public DateType getPreviousIMMDate(); + public E getPreviousIMMDate(); /** * Returns a list of IMM dates between 2 dates, it will exclude the start @@ -144,6 +144,6 @@ * end of the interval, may be included. * @return list of IMM dates */ - public List<DateType> getIMMDates(final DateType start, final DateType end); + public List<E> getIMMDates(final E start, final E end); } \ No newline at end of file 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-08-23 22:00:20 UTC (rev 41) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-08-23 22:05:50 UTC (rev 42) @@ -21,8 +21,8 @@ * * @author Benoit Xhenseval */ -public interface HolidayHandler<DateType> { - DateType moveCurrentDate(DateCalculator<DateType> calendar); +public interface HolidayHandler<E> { + E moveCurrentDate(DateCalculator<E> calendar); String getType(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-23 22:02:32
|
Revision: 41 Author: marchy Date: 2006-08-23 15:00:20 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=41&view=rev Log Message: ----------- More generics refactoring. Managed to pull in HolidayHandler. Next is will be the calendar factories. Modified Paths: -------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.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/ForwardDateCalculatorTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/IMMDateTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java Added Paths: ----------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java Removed Paths: ------------- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandler.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/HolidayHandler.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-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -3,7 +3,7 @@ import java.util.Collections; import java.util.Set; -public abstract class AbstractDateCalculator<DateType> implements DateCalculatorGeneric<DateType> { +public abstract class AbstractDateCalculator<DateType> implements DateCalculator<DateType> { protected static final int MONTHS_IN_QUARTER = 3; protected static final int MONTH_IN_YEAR = 12; @@ -12,7 +12,8 @@ protected DateType startDate; protected DateType currentDate; protected Set<DateType> nonWorkingDays; - + protected HolidayHandler<DateType> holidayHandler; + public String getName() { return name; } @@ -56,7 +57,7 @@ * @return the current businessCalendar (so one can do * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) */ - public DateCalculatorGeneric<DateType> moveByTenor(final Tenor tenor) { + public DateCalculator<DateType> moveByTenor(final Tenor tenor) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } @@ -75,4 +76,12 @@ } + public void setHolidayHandler(final HolidayHandler<DateType> holidayHandler) { + this.holidayHandler = holidayHandler; + } + + public String getHolidayHandlerType() { + return (holidayHandler != null ? holidayHandler.getType() : null); + } + } Copied: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java (from rev 39, trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java) =================================================================== --- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java (rev 0) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -0,0 +1,149 @@ +package net.objectlab.kit.datecalc.common; + +import java.util.List; +import java.util.Set; + + +public interface DateCalculator<DateType> { + + /** + * @return Calendar name (Typically the name associated with the holiday + * set). + */ + public String getName(); + + /** + * @param startDate + * the reference date for this calendar, the current date is also + * updated and may be moved if it falls on a non working day + * (holiday/weekend). + */ + public void setStartDate(final DateType startDate); + + /** + * @return startDate the reference date for this calendar. + */ + public DateType getStartDate(); + + /** + * @param currentDate held by the calendar. + */ + public DateType getCurrentDate(); + + /** + * is the given date on a weekend, according to the WorkingWeek + */ + public boolean isWeekend(final DateType date); + + /** + * is the given date a non working day, i.e. either a "weekend" or a + * holiday? + */ + public boolean isNonWorkingDay(final DateType date); + + /** + * @return true if the current date is either a weekend or a holiday. + */ + public boolean isCurrentDateNonWorking(); + + /** + * This is typically used at the construction of a DateCalculator. + * + * @param holidays + * the holiday (if null, an empty set will be put in place) + */ + public void setNonWorkingDays(final Set<DateType> holidays); + + /** + * @return an immutable copy of the holiday set. + */ + public Set<DateType> getNonWorkingDays(); + + /** + * Allow user to define what their Working Week should be (default is + * Mon-Fri). + * + * @param week + */ + public void setWorkingWeek(final WorkingWeek week); + + /** + * give a current business date which may be moved if it falls on a non + * working day. + * + * @param date + * @return new current date if moved. + */ + public DateType setCurrentBusinessDate(final DateType date); + + /** + * @return the holiday handler type, can be null + */ + public String getHolidayHandlerType(); + + /** + * move the current date by the number of days and, if it falls on a weekend + * or holiday, move it according to the HolidayHandler given in this + * DateCalculator. + * + * @param days + * number of day + * @return the businessCalendar (so one can do + * calendar.moveByDays(-2).getCurrentBusinessDate();) + */ + public DateCalculator<DateType> moveByDays(final int days); + + /** + * move the current date by a number of business days, 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. + * + * @param businessDays + * @return the current businessCalendar (so one can do + * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) + */ + public DateCalculator<DateType> moveByBusinessDays(final int businessDays); + + /** + * By combining several calendars, we take into account several set of + * holidays. + * + * @param calendar + * @return a new DateCalculator + */ + public DateCalculator<DateType> combine(DateCalculator<DateType> calendar); + + /** + * 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. + * + * @param businessDays + * @return the current businessCalendar (so one can do + * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) + */ + public DateCalculator<DateType> moveByTenor(final Tenor tenor); + + /** + * @return the next IMMDate based on current date. + */ + public DateType getNextIMMDate(); + + /** + * @return the previous IMMDate based on current date. + */ + public DateType getPreviousIMMDate(); + + /** + * 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. + * @return list of IMM dates + */ + public List<DateType> getIMMDates(final DateType start, final DateType end); + +} \ No newline at end of file Deleted: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java =================================================================== --- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java 2006-08-23 22:00:20 UTC (rev 41) @@ -1,149 +0,0 @@ -package net.objectlab.kit.datecalc.common; - -import java.util.List; -import java.util.Set; - - -public interface DateCalculatorGeneric<DateType> { - - /** - * @return Calendar name (Typically the name associated with the holiday - * set). - */ - public String getName(); - - /** - * @param startDate - * the reference date for this calendar, the current date is also - * updated and may be moved if it falls on a non working day - * (holiday/weekend). - */ - public void setStartDate(final DateType startDate); - - /** - * @return startDate the reference date for this calendar. - */ - public DateType getStartDate(); - - /** - * @param currentDate held by the calendar. - */ - public DateType getCurrentDate(); - - /** - * is the given date on a weekend, according to the WorkingWeek - */ - public boolean isWeekend(final DateType date); - - /** - * is the given date a non working day, i.e. either a "weekend" or a - * holiday? - */ - public boolean isNonWorkingDay(final DateType date); - - /** - * @return true if the current date is either a weekend or a holiday. - */ - public boolean isCurrentDateNonWorking(); - - /** - * This is typically used at the construction of a DateCalculator. - * - * @param holidays - * the holiday (if null, an empty set will be put in place) - */ - public void setNonWorkingDays(final Set<DateType> holidays); - - /** - * @return an immutable copy of the holiday set. - */ - public Set<DateType> getNonWorkingDays(); - - /** - * Allow user to define what their Working Week should be (default is - * Mon-Fri). - * - * @param week - */ - public void setWorkingWeek(final WorkingWeek week); - - /** - * give a current business date which may be moved if it falls on a non - * working day. - * - * @param date - * @return new current date if moved. - */ - public DateType setCurrentBusinessDate(final DateType date); - - /** - * @return the holiday handler type, can be null - */ - public String getHolidayHandlerType(); - - /** - * move the current date by the number of days and, if it falls on a weekend - * or holiday, move it according to the HolidayHandler given in this - * DateCalculator. - * - * @param days - * number of day - * @return the businessCalendar (so one can do - * calendar.moveByDays(-2).getCurrentBusinessDate();) - */ - public DateCalculatorGeneric<DateType> moveByDays(final int days); - - /** - * move the current date by a number of business days, 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) - */ - public DateCalculatorGeneric<DateType> moveByBusinessDays(final int businessDays); - - /** - * By combining several calendars, we take into account several set of - * holidays. - * - * @param calendar - * @return a new DateCalculator - */ - public DateCalculatorGeneric<DateType> combine(DateCalculatorGeneric<DateType> calendar); - - /** - * 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) - */ - public DateCalculatorGeneric<DateType> moveByTenor(final Tenor tenor); - - /** - * @return the next IMMDate based on current date. - */ - public DateType getNextIMMDate(); - - /** - * @return the previous IMMDate based on current date. - */ - public DateType getPreviousIMMDate(); - - /** - * 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. - * @return list of IMM dates - */ - public List<DateType> getIMMDates(final DateType start, final DateType end); - -} \ No newline at end of file Copied: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java (from rev 38, trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandler.java) =================================================================== --- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java (rev 0) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -0,0 +1,28 @@ +/* + * 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; + +/** + * This will be called to determine whether the date should be moved according + * to the special algorithm used. + * + * @author Benoit Xhenseval + */ +public interface HolidayHandler<DateType> { + DateType moveCurrentDate(DateCalculator<DateType> calendar); + + String getType(); +} Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -24,7 +24,8 @@ import java.util.Set; import net.objectlab.kit.datecalc.common.AbstractDateCalculator; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.WorkingWeek; /** @@ -34,12 +35,10 @@ * * @author Benoit Xhenseval */ -public class BaseDateCalculator extends AbstractDateCalculator<Date> implements DateCalculatorGeneric<Date>, DateCalculator { +public class BaseDateCalculator extends AbstractDateCalculator<Date> { private WorkingWeek workingWeek = WorkingWeek.DEFAULT; - private HolidayHandler holidayHandler = null; - @SuppressWarnings("unchecked") public BaseDateCalculator() { this(null, null, Collections.EMPTY_SET, null); @@ -62,16 +61,6 @@ workingWeek = week; } - void setHolidayHandler(final HolidayHandler holidayHandler) { - this.holidayHandler = holidayHandler; - } - - public String getHolidayHandlerType() { - return (holidayHandler != null ? holidayHandler.getType() : null); - } - - // ----------------------------------------------------------------- - /** * is the date a non-working day according to the WorkingWeek? */ @@ -99,7 +88,7 @@ return currentDate; } - public DateCalculatorGeneric<Date> moveByDays(final int days) { + public DateCalculator<Date> moveByDays(final int days) { if (currentDate == null) { initialise(); } @@ -119,7 +108,7 @@ } } - public DateCalculator moveByBusinessDays(final int businessDays) { + public DateCalculator<Date> moveByBusinessDays(final int businessDays) { final int numberOfStepsLeft = Math.abs(businessDays); final int step = (businessDays < 0 ? -1 : 1); @@ -142,7 +131,7 @@ * if both calendars have different types of HolidayHandlers or * WorkingWeek; */ - public DateCalculatorGeneric<Date> combine(final DateCalculatorGeneric calendar) { + public DateCalculator<Date> combine(final DateCalculator calendar) { if (calendar == null || calendar == this) { return this; } @@ -160,7 +149,7 @@ newSet.addAll(calendar.getNonWorkingDays()); } - final DateCalculatorGeneric cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, + final DateCalculator cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, holidayHandler); return cal; Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -1,33 +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.DateCalculatorGeneric; - - - -/** - * A DateCalculator is a lightweight container with a reference(optional) to a - * set of holidays, a WorkingWeek (Mon-Fri by default), a startDate and a - * current date. The CurrentDate date is changed everytime that the addDays or - * moveByBusinessDays methods are called. - * - * @author Benoit Xhenseval - */ -public interface DateCalculator extends DateCalculatorGeneric<Date> { -} Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java 2006-08-23 22:00:20 UTC (rev 41) @@ -18,7 +18,7 @@ import java.util.Date; import java.util.Set; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; /** * Factory will create new instances of DateCalculator, these are lightweight, @@ -43,7 +43,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - DateCalculatorGeneric getDateCalculator(final String name, final String holidayHandlerType); + DateCalculator getDateCalculator(final String name, final String holidayHandlerType); /** * Use this method to register a set of holidays for a given calendar. Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-23 22:00:20 UTC (rev 41) @@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DefaultDateCalculatorFactory implements DateCalculatorFactory { @@ -43,7 +43,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - public DateCalculatorGeneric getDateCalculator(final String name, final String holidayHandlerType) { + public DateCalculator getDateCalculator(final String name, final String holidayHandlerType) { final BaseDateCalculator cal = new BaseDateCalculator(); cal.setName(name); if (holidays.containsKey(name)) { Modified: 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-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/ForwardHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -18,6 +18,8 @@ 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; /** @@ -25,9 +27,9 @@ * @author Marcin Jekot * */ -public class ForwardHandler implements HolidayHandler { +public class ForwardHandler implements HolidayHandler<Date> { - public Date moveCurrentDate(DateCalculator calendar) { + public Date moveCurrentDate(DateCalculator<Date> calendar) { Calendar cal = Utils.getCal(calendar.getCurrentDate()); Deleted: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandler.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/HolidayHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -1,30 +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; - -/** - * This will be called to determine whether the date should be moved according - * to the special algorithm used. - * - * @author Benoit Xhenseval - */ -public interface HolidayHandler { - Date moveCurrentDate(DateCalculator calendar); - - String getType(); -} Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-23 22:00:20 UTC (rev 41) @@ -4,15 +4,15 @@ import junit.framework.Assert; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DateCalculatorCombinationTest extends AbstractDateCalculatorTest { public void testInvalidCombinationDiffHandler() { - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", HolidayHandlerType.FORWARD); try { @@ -24,8 +24,8 @@ } public void testInvalidCombinationNullNotNullHandler() { - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", HolidayHandlerType.FORWARD); try { @@ -37,9 +37,9 @@ } public void testInvalidCombinationNotNullNullHandler() { - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", null); + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", null); try { cal1.combine(cal2); @@ -51,14 +51,14 @@ public void testValidCombinationOneEmptySet() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculatorGeneric combo = cal1.combine(cal2); + final DateCalculator combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "bla/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -69,14 +69,14 @@ public void testValidCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculatorGeneric combo = cal1.combine(cal2); + final DateCalculator combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "UK/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -87,14 +87,14 @@ public void testValidCombination2Sets() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculatorGeneric combo = cal1.combine(cal2); + final DateCalculator combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "US/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -104,12 +104,12 @@ public void testNullCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculatorGeneric combo = cal1.combine(null); + final DateCalculator combo = cal1.combine(null); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); @@ -120,12 +120,12 @@ public void testSameCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculatorGeneric combo = cal1.combine(cal1); + final DateCalculator combo = cal1.combine(cal1); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); 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-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java 2006-08-23 22:00:20 UTC (rev 41) @@ -5,18 +5,18 @@ import junit.framework.Assert; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DateCalculatorFactoryTest extends AbstractDateCalculatorTest { public void testGetCalendarsNoHoliday() { - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal1", cal1); Assert.assertEquals("name", "bla", cal1.getName()); Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty()); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal2", cal2); Assert.assertEquals("name", "bla", cal2.getName()); Assert.assertTrue("no holiday", cal2.getNonWorkingDays().isEmpty()); @@ -27,12 +27,12 @@ final Set<Date> uk = createUKHolidays(); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", uk); - final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal1", cal1); Assert.assertEquals("name", "bla", cal1.getName()); Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty()); - final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", null); + final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", null); Assert.assertNotNull("cal2", cal2); Assert.assertEquals("name cal2", "UK", cal2.getName()); Assert.assertEquals("UK holidays", 4, cal2.getNonWorkingDays().size()); @@ -40,7 +40,7 @@ } public void testGetCorrectAlgo() { - DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNull("No algo", cal1.getHolidayHandlerType()); cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 22:00:20 UTC (rev 41) @@ -7,14 +7,14 @@ import junit.framework.Assert; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.WorkingWeek; public class ForwardDateCalculatorTest extends AbstractDateCalculatorTest { public void testSimpleForwardWithWeekend() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -29,7 +29,7 @@ } public void testSimpleForwardStartDateWithWeekend() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -57,7 +57,7 @@ } public void testSimpleForwardStartDateNoWeekend() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final WorkingWeek ww = new WorkingWeek(); ww.withWorkingDayFromCalendar(true, Calendar.SATURDAY); @@ -89,7 +89,7 @@ } public void testSimpleForwardStartDateWhackyWeek() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -127,7 +127,7 @@ } public void testSimpleForwardStartDateIdealWeekend() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -165,7 +165,7 @@ } public void testSimpleForwardWithHolidays() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final Set<Date> holidays = new HashSet<Date>(); holidays.add(createDate("2006-08-28")); @@ -198,7 +198,7 @@ checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-28"); } - private void checkDate(final String string, final DateCalculatorGeneric calendar, final String string2) { + private void checkDate(final String string, final DateCalculator calendar, final String string2) { Assert.assertEquals(string, createDate(string2), calendar.getCurrentDate()); } } Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java 2006-08-23 22:00:20 UTC (rev 41) @@ -4,7 +4,7 @@ import java.util.List; import junit.framework.Assert; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class IMMDateTest extends AbstractDateCalculatorTest { @@ -12,7 +12,7 @@ } public void testNextIMM() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -80,7 +80,7 @@ } public void testPreviousIMM() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -150,7 +150,7 @@ } public void testIMMLists() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -169,7 +169,7 @@ } public void testEmptyIMMLists() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -182,7 +182,7 @@ } public void testEndOnIMMDateIMMLists() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -197,7 +197,7 @@ } public void testStartOnIMMDateIMMLists() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BackwardHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -15,6 +15,8 @@ */ package net.objectlab.kit.datecalc.joda; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -25,9 +27,9 @@ * * @author Benoit Xhenseval */ -public class BackwardHandler implements HolidayHandler { +public class BackwardHandler implements HolidayHandler<LocalDate> { - public LocalDate moveCurrentDate(final BaseDateCalculator calendar) { + public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { LocalDate date = calendar.getCurrentDate(); while (calendar.isNonWorkingDay(date)) { date = date.minusDays(1); Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -22,7 +22,8 @@ import java.util.Set; import net.objectlab.kit.datecalc.common.AbstractDateCalculator; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.WorkingWeek; import org.joda.time.DateTimeConstants; @@ -35,12 +36,10 @@ * * @author Benoit Xhenseval */ -public class BaseDateCalculator extends AbstractDateCalculator<LocalDate> implements DateCalculator { +public class BaseDateCalculator extends AbstractDateCalculator<LocalDate> { private JodaWorkingWeek workingWeek = JodaWorkingWeek.DEFAULT; - private HolidayHandler holidayHandler = null; - @SuppressWarnings("unchecked") public BaseDateCalculator() { this(null, null, Collections.EMPTY_SET, null); @@ -65,16 +64,6 @@ } } - void setHolidayHandler(final HolidayHandler holidayHandler) { - this.holidayHandler = holidayHandler; - } - - public String getHolidayHandlerType() { - return (holidayHandler != null ? holidayHandler.getType() : null); - } - - // ----------------------------------------------------------------- - /** * is the date a non-working day according to the WorkingWeek? */ @@ -102,7 +91,7 @@ return currentDate; } - public DateCalculator moveByDays(final int days) { + public DateCalculator<LocalDate> moveByDays(final int days) { if (currentDate == null) { initialise(); } @@ -123,7 +112,7 @@ } } - public DateCalculator moveByBusinessDays(final int businessDays) { + public DateCalculator<LocalDate> moveByBusinessDays(final int businessDays) { final int numberOfStepsLeft = Math.abs(businessDays); final int step = (businessDays < 0 ? -1 : 1); @@ -146,7 +135,7 @@ * if both calendars have different types of HolidayHandlers or * WorkingWeek; */ - public DateCalculator combine(final DateCalculatorGeneric calendar) { + public DateCalculator<LocalDate> combine(final DateCalculator calendar) { if (calendar == null || calendar == this) { return this; } @@ -164,7 +153,7 @@ newSet.addAll(calendar.getNonWorkingDays()); } - final DateCalculator cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, + final DateCalculator<LocalDate> cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, holidayHandler); return cal; Deleted: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 22:00:20 UTC (rev 41) @@ -1,32 +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.joda; - -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; - -import org.joda.time.LocalDate; - -/** - * A DateCalculator is a lightweight container with a reference(optional) to a - * set of holidays, a WorkingWeek (Mon-Fri by default), a startDate and a - * current date. The CurrentDate date is changed everytime that the addDays or - * moveByBusinessDays methods are called. - * - * @author Benoit Xhenseval - */ -public interface DateCalculator extends DateCalculatorGeneric<LocalDate> { - -} Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java 2006-08-23 22:00:20 UTC (rev 41) @@ -17,6 +17,8 @@ import java.util.Set; +import net.objectlab.kit.datecalc.common.DateCalculator; + import org.joda.time.LocalDate; /** @@ -42,7 +44,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - DateCalculator getDateCalculator(final String name, final String holidayHandlerType); + DateCalculator<LocalDate> getDateCalculator(final String name, final String holidayHandlerType); /** * Use this method to register a set of holidays for a given calendar. Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java 2006-08-23 22:00:20 UTC (rev 41) @@ -20,6 +20,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -44,7 +45,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - public DateCalculator getDateCalculator(final String name, final String holidayHandlerType) { + public DateCalculator<LocalDate> getDateCalculator(final String name, final String holidayHandlerType) { final BaseDateCalculator cal = new BaseDateCalculator(); cal.setName(name); if (holidays.containsKey(name)) { Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ForwardHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -15,6 +15,8 @@ */ package net.objectlab.kit.datecalc.joda; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -25,9 +27,9 @@ * * @author Benoit Xhenseval */ -public class ForwardHandler implements HolidayHandler { +public class ForwardHandler implements HolidayHandler<LocalDate> { - public LocalDate moveCurrentDate(final BaseDateCalculator calendar) { + public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { LocalDate date = calendar.getCurrentDate(); while (calendar.isNonWorkingDay(date)) { date = date.plusDays(1); Deleted: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/HolidayHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/HolidayHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/HolidayHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -1,30 +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.joda; - -import org.joda.time.LocalDate; - -/** - * This will be called to determine whether the date should be moved according - * to the special algorithm used. - * - * @author Benoit Xhenseval - */ -public interface HolidayHandler { - LocalDate moveCurrentDate(BaseDateCalculator calendar); - - String getType(); -} Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -15,6 +15,8 @@ */ package net.objectlab.kit.datecalc.joda; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -26,9 +28,9 @@ * * @author Benoit Xhenseval */ -public class ModifiedFollowingHandler implements HolidayHandler { +public class ModifiedFollowingHandler implements HolidayHandler<LocalDate> { - public LocalDate moveCurrentDate(final BaseDateCalculator calendar) { + public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { LocalDate date = calendar.getCurrentDate(); final int month = date.getMonthOfYear(); int step = 1; Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java 2006-08-23 22:00:20 UTC (rev 41) @@ -15,6 +15,8 @@ */ package net.objectlab.kit.datecalc.joda; +import net.objectlab.kit.datecalc.common.DateCalculator; +import net.objectlab.kit.datecalc.common.HolidayHandler; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -26,9 +28,9 @@ * * @author Benoit Xhenseval */ -public class ModifiedPreceedingHandler implements HolidayHandler { +public class ModifiedPreceedingHandler implements HolidayHandler<LocalDate> { - public LocalDate moveCurrentDate(final BaseDateCalculator calendar) { + public LocalDate moveCurrentDate(final DateCalculator<LocalDate> calendar) { LocalDate date = calendar.getCurrentDate(); final int month = date.getMonthOfYear(); int step = -1; Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 21:53:02 UTC (rev 40) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 22:00:20 UTC (rev 41) @@ -5,7 +5,7 @@ import junit.framework.Assert; import junit.framework.TestCase; -import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; +import net.objectlab.kit.datecalc.common.DateCalculator; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.StandardTenor; import net.objectlab.kit.datecalc.common.Tenor; @@ -17,7 +17,7 @@ public class BackwardDateCalculatorTest extends TestCase { public void testSimpleForwardWithWeekend() { - final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -258,7 +258,7 @@ checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05"); } - private void checkDate(final String string, final DateCalculatorGeneric calendar, final String string2) { + private void checkDate(final String string, final DateCalculator calendar, final String string2) { Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); } } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java ===============================================================... [truncated message content] |
|
From: <be...@us...> - 2006-08-23 21:54:45
|
Revision: 40 Author: benoitx Date: 2006-08-23 14:53:02 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=40&view=rev Log Message: ----------- Added Google Analytics on main web page and new qalab.xml stats Modified Paths: -------------- trunk/datecalc-common/qalab.xml trunk/datecalc-jdk/qalab.xml trunk/datecalc-joda/qalab.xml trunk/src/site/faq.fml trunk/src/site/index.xml Property Changed: ---------------- trunk/ trunk/datecalc-common/ trunk/datecalc-jdk/ trunk/datecalc-joda/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - target + target *.log Property changes on: trunk/datecalc-common ___________________________________________________________________ Name: svn:ignore - target + target Modified: trunk/datecalc-common/qalab.xml =================================================================== --- trunk/datecalc-common/qalab.xml 2006-08-23 21:22:58 UTC (rev 39) +++ trunk/datecalc-common/qalab.xml 2006-08-23 21:53:02 UTC (rev 40) @@ -34,6 +34,9 @@ <summaryresult date="2006-08-20" filecount="7" statvalue="1" type="checkstyle"/> <summaryresult date="2006-08-20" filecount="6" statvalue="90" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="6" statvalue="100" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="9" statvalue="24" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="8" statvalue="75" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="8" statvalue="91" 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"/> @@ -41,6 +44,7 @@ <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-19" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-23" statvalue="1" type="checkstyle"/> </file> <file id="net_objectlab_kit_datecalc_common_Tenor.java" path="net/objectlab/kit/datecalc/common/Tenor.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -56,6 +60,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" 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"/> @@ -72,6 +78,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" 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"/> @@ -84,6 +92,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" 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"/> @@ -91,11 +101,13 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" 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"/> <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" 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"/> @@ -107,5 +119,17 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="92" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="92" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> + <file + id="net_objectlab_kit_datecalc_common_AbstractDateCalculator.java" path="net/objectlab/kit/datecalc/common/AbstractDateCalculator.java"> + <result date="2006-08-23" statvalue="4" type="checkstyle"/> + </file> + <file + id="net_objectlab_kit_datecalc_common_DateCalculatorGeneric.java" path="net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java"> + <result date="2006-08-23" statvalue="19" type="checkstyle"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> + </file> </qalab> Property changes on: trunk/datecalc-jdk ___________________________________________________________________ Name: svn:ignore - target + target Modified: trunk/datecalc-jdk/qalab.xml =================================================================== --- trunk/datecalc-jdk/qalab.xml 2006-08-23 21:22:58 UTC (rev 39) +++ trunk/datecalc-jdk/qalab.xml 2006-08-23 21:53:02 UTC (rev 40) @@ -31,12 +31,18 @@ <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="findbugs"/> <summaryresult date="2006-08-20" filecount="9" statvalue="77" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="9" statvalue="77" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="10" statvalue="8" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="1" statvalue="1" type="pmd"/> + <summaryresult date="2006-08-23" filecount="1" statvalue="1" type="findbugs"/> + <summaryresult date="2006-08-23" filecount="9" statvalue="82" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="9" statvalue="80" 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"/> <result date="2006-08-09" statvalue="1" type="checkstyle"/> <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-23" statvalue="1" type="checkstyle"/> </file> <file id="net_objectlab_kit_datecalc_jdk_BaseDateCalculator.java" path="net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -53,6 +59,11 @@ <result date="2006-08-20" statvalue="1" type="findbugs"/> <result date="2006-08-20" statvalue="74" type="cobertura-line"/> <result date="2006-08-20" statvalue="75" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="5" type="checkstyle"/> + <result date="2006-08-23" statvalue="1" type="pmd"/> + <result date="2006-08-23" statvalue="1" type="findbugs"/> + <result date="2006-08-23" statvalue="79" type="cobertura-line"/> + <result date="2006-08-23" statvalue="77" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java"> @@ -62,6 +73,9 @@ <result date="2006-08-20" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="1" type="checkstyle"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlab-kit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlab-kit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"> @@ -78,6 +92,8 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -88,6 +104,8 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_HolidayHandler.java" path="net/objectlab/kit/datecalc/jdk/HolidayHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -98,6 +116,8 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/PeriodCountCalculator.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -108,6 +128,8 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/jdk/DefaultPeriodCountCalculator.java"> @@ -116,6 +138,8 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="50" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="50" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlabkit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlabkit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"/> @@ -123,9 +147,14 @@ <result date="2006-08-20" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="75" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="1" type="checkstyle"/> + <result date="2006-08-23" statvalue="75" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_ForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/ForwardHandler.java"> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> </qalab> Property changes on: trunk/datecalc-joda ___________________________________________________________________ Name: svn:ignore - target .fbwarnings + target Modified: trunk/datecalc-joda/qalab.xml =================================================================== --- trunk/datecalc-joda/qalab.xml 2006-08-23 21:22:58 UTC (rev 39) +++ trunk/datecalc-joda/qalab.xml 2006-08-23 21:53:02 UTC (rev 40) @@ -36,9 +36,13 @@ <summaryresult date="2006-08-19" filecount="3" statvalue="6" type="pmd"/> <summaryresult date="2006-08-19" filecount="12" statvalue="89" type="cobertura-line"/> <summaryresult date="2006-08-19" filecount="12" statvalue="92" type="cobertura-branch"/> - <summaryresult date="2006-08-20" filecount="13" statvalue="1" type="checkstyle"/> + <summaryresult date="2006-08-20" filecount="13" statvalue="2" type="checkstyle"/> + <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="pmd"/> <summaryresult date="2006-08-20" filecount="12" statvalue="86" type="cobertura-line"/> <summaryresult date="2006-08-20" filecount="12" statvalue="88" type="cobertura-branch"/> + <summaryresult date="2006-08-23" filecount="13" statvalue="1" type="checkstyle"/> + <summaryresult date="2006-08-23" filecount="12" statvalue="93" type="cobertura-line"/> + <summaryresult date="2006-08-23" filecount="12" statvalue="95" 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"/> @@ -46,6 +50,7 @@ <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-19" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-23" statvalue="1" type="checkstyle"/> </file> <file id="net_objectlab_kit_datecalc_joda_BaseDateCalculator.java" path="net/objectlab/kit/datecalc/joda/BaseDateCalculator.java"> <result date="2006-08-08" statvalue="9" type="checkstyle"/> @@ -62,8 +67,12 @@ <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> <result date="2006-08-19" statvalue="98" type="cobertura-line"/> <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-20" statvalue="1" type="pmd"/> <result date="2006-08-20" statvalue="97" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="97" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DefaultDateCalculatorFactory.java"> @@ -80,6 +89,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DefaultPeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/DefaultPeriodCountCalculator.java"> @@ -99,6 +110,8 @@ <result date="2006-08-19" statvalue="90" type="cobertura-branch"/> <result date="2006-08-20" statvalue="81" type="cobertura-line"/> <result date="2006-08-20" statvalue="84" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="81" type="cobertura-line"/> + <result date="2006-08-23" statvalue="84" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_JodaWorkingWeek.java" path="net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java"> <result date="2006-08-08" statvalue="1" type="checkstyle"/> @@ -114,6 +127,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" 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"/> @@ -123,6 +138,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DateCalculator.java" path="net/objectlab/kit/datecalc/joda/DateCalculator.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -135,6 +152,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_DateCalculatorFactory.java" path="net/objectlab/kit/datecalc/joda/DateCalculatorFactory.java"> @@ -148,6 +167,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ForwardHandler.java" path="net/objectlab/kit/datecalc/joda/ForwardHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -160,6 +181,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_HolidayHandler.java" path="net/objectlab/kit/datecalc/joda/HolidayHandler.java"> <result date="2006-08-08" statvalue="100" type="cobertura-line"/> @@ -172,6 +195,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_PeriodCountCalculator.java" path="net/objectlab/kit/datecalc/joda/PeriodCountCalculator.java"> @@ -185,6 +210,8 @@ <result date="2006-08-19" statvalue="100" type="cobertura-branch"/> <result date="2006-08-20" statvalue="100" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ModifiedFollowingHandler.java" path="net/objectlab/kit/datecalc/joda/ModifiedFollowingHandler.java"> @@ -192,6 +219,8 @@ <result date="2006-08-10" statvalue="16" type="cobertura-line"/> <result date="2006-08-19" statvalue="16" type="cobertura-line"/> <result date="2006-08-20" statvalue="16" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_joda_ModifiedPreceedingHandler.java" path="net/objectlab/kit/datecalc/joda/ModifiedPreceedingHandler.java"> @@ -199,5 +228,7 @@ <result date="2006-08-10" statvalue="16" type="cobertura-line"/> <result date="2006-08-19" statvalue="16" type="cobertura-line"/> <result date="2006-08-20" statvalue="16" type="cobertura-line"/> + <result date="2006-08-23" statvalue="75" type="cobertura-line"/> + <result date="2006-08-23" statvalue="100" type="cobertura-branch"/> </file> </qalab> Modified: trunk/src/site/faq.fml =================================================================== --- trunk/src/site/faq.fml 2006-08-23 21:22:58 UTC (rev 39) +++ trunk/src/site/faq.fml 2006-08-23 21:53:02 UTC (rev 40) @@ -41,4 +41,11 @@ </faq> </part> +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> +</script> +<script type="text/javascript"> +_uacct = "UA-615747-1"; +urchinTracker(); +</script> + </faqs> \ No newline at end of file Modified: trunk/src/site/index.xml =================================================================== --- trunk/src/site/index.xml 2006-08-23 21:22:58 UTC (rev 39) +++ trunk/src/site/index.xml 2006-08-23 21:53:02 UTC (rev 40) @@ -81,5 +81,12 @@ </section> +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> +</script> +<script type="text/javascript"> +_uacct = "UA-615747-1"; +urchinTracker(); +</script> + </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: <ma...@us...> - 2006-08-23 21:25:20
|
Revision: 39 Author: marchy Date: 2006-08-23 14:22:58 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=39&view=rev Log Message: ----------- Initial stab at the refactoring of the DateCalendar into a generic interface in common. Working Week etc are next, and more methods need to be pulled up into the abstract class. I also plan to rename the interfaces + clean up. Modified Paths: -------------- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.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/ForwardDateCalculatorTest.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedPreceedingDateCalculatorTest.java Added 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/DateCalculatorGeneric.java Added: 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 (rev 0) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-08-23 21:22:58 UTC (rev 39) @@ -0,0 +1,78 @@ +package net.objectlab.kit.datecalc.common; + +import java.util.Collections; +import java.util.Set; + +public abstract class AbstractDateCalculator<DateType> implements DateCalculatorGeneric<DateType> { + + protected static final int MONTHS_IN_QUARTER = 3; + protected static final int MONTH_IN_YEAR = 12; + protected static final int DAYS_IN_WEEK = 7; + protected String name; + protected DateType startDate; + protected DateType currentDate; + protected Set<DateType> nonWorkingDays; + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public DateType getStartDate() { + return startDate; + } + + /** Set both start date and current date */ + public void setStartDate(final DateType startDate) { + this.startDate = startDate; + setCurrentBusinessDate(startDate); + } + + public DateType getCurrentDate() { + return currentDate; + } + + public Set<DateType> getNonWorkingDays() { + return Collections.unmodifiableSet(nonWorkingDays); + } + + public void setNonWorkingDays(final Set<DateType> holidays) { + if (holidays == null) { + nonWorkingDays = Collections.emptySet(); + } else { + nonWorkingDays = holidays; + } + } + + /** + * 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. + * + * @param businessDays + * @return the current businessCalendar (so one can do + * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) + */ + public DateCalculatorGeneric<DateType> moveByTenor(final Tenor tenor) { + if (tenor == null) { + throw new IllegalArgumentException("Tenor cannot be null"); + } + + switch (tenor.getCode()) { + case DAY: + 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..."); + } + + } + +} Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java =================================================================== --- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java (rev 0) +++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculatorGeneric.java 2006-08-23 21:22:58 UTC (rev 39) @@ -0,0 +1,149 @@ +package net.objectlab.kit.datecalc.common; + +import java.util.List; +import java.util.Set; + + +public interface DateCalculatorGeneric<DateType> { + + /** + * @return Calendar name (Typically the name associated with the holiday + * set). + */ + public String getName(); + + /** + * @param startDate + * the reference date for this calendar, the current date is also + * updated and may be moved if it falls on a non working day + * (holiday/weekend). + */ + public void setStartDate(final DateType startDate); + + /** + * @return startDate the reference date for this calendar. + */ + public DateType getStartDate(); + + /** + * @param currentDate held by the calendar. + */ + public DateType getCurrentDate(); + + /** + * is the given date on a weekend, according to the WorkingWeek + */ + public boolean isWeekend(final DateType date); + + /** + * is the given date a non working day, i.e. either a "weekend" or a + * holiday? + */ + public boolean isNonWorkingDay(final DateType date); + + /** + * @return true if the current date is either a weekend or a holiday. + */ + public boolean isCurrentDateNonWorking(); + + /** + * This is typically used at the construction of a DateCalculator. + * + * @param holidays + * the holiday (if null, an empty set will be put in place) + */ + public void setNonWorkingDays(final Set<DateType> holidays); + + /** + * @return an immutable copy of the holiday set. + */ + public Set<DateType> getNonWorkingDays(); + + /** + * Allow user to define what their Working Week should be (default is + * Mon-Fri). + * + * @param week + */ + public void setWorkingWeek(final WorkingWeek week); + + /** + * give a current business date which may be moved if it falls on a non + * working day. + * + * @param date + * @return new current date if moved. + */ + public DateType setCurrentBusinessDate(final DateType date); + + /** + * @return the holiday handler type, can be null + */ + public String getHolidayHandlerType(); + + /** + * move the current date by the number of days and, if it falls on a weekend + * or holiday, move it according to the HolidayHandler given in this + * DateCalculator. + * + * @param days + * number of day + * @return the businessCalendar (so one can do + * calendar.moveByDays(-2).getCurrentBusinessDate();) + */ + public DateCalculatorGeneric<DateType> moveByDays(final int days); + + /** + * move the current date by a number of business days, 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. + * + * @param businessDays + * @return the current businessCalendar (so one can do + * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) + */ + public DateCalculatorGeneric<DateType> moveByBusinessDays(final int businessDays); + + /** + * By combining several calendars, we take into account several set of + * holidays. + * + * @param calendar + * @return a new DateCalculator + */ + public DateCalculatorGeneric<DateType> combine(DateCalculatorGeneric<DateType> calendar); + + /** + * 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. + * + * @param businessDays + * @return the current businessCalendar (so one can do + * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) + */ + public DateCalculatorGeneric<DateType> moveByTenor(final Tenor tenor); + + /** + * @return the next IMMDate based on current date. + */ + public DateType getNextIMMDate(); + + /** + * @return the previous IMMDate based on current date. + */ + public DateType getPreviousIMMDate(); + + /** + * 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. + * @return list of IMM dates + */ + public List<DateType> getIMMDates(final DateType start, final DateType end); + +} \ No newline at end of file Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 21:22:58 UTC (rev 39) @@ -23,7 +23,8 @@ import java.util.List; import java.util.Set; -import net.objectlab.kit.datecalc.common.Tenor; +import net.objectlab.kit.datecalc.common.AbstractDateCalculator; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.WorkingWeek; /** @@ -33,22 +34,12 @@ * * @author Benoit Xhenseval */ -public class BaseDateCalculator implements DateCalculator { +public class BaseDateCalculator extends AbstractDateCalculator<Date> implements DateCalculatorGeneric<Date>, DateCalculator { - private String name; - - private Date startDate; - - private Date currentDate; - - private Set<Date> nonWorkingDays; - private WorkingWeek workingWeek = WorkingWeek.DEFAULT; private HolidayHandler holidayHandler = null; - private final int DAYS_IN_WEEK = 7; - @SuppressWarnings("unchecked") public BaseDateCalculator() { this(null, null, Collections.EMPTY_SET, null); @@ -67,44 +58,10 @@ this.holidayHandler = holidayHandler; } - public Date getCurrentDate() { - return currentDate; - } - - public Set<Date> getNonWorkingDays() { - return Collections.unmodifiableSet(nonWorkingDays); - } - - public Date getStartDate() { - return startDate; - } - - public void setNonWorkingDays(final Set<Date> holidays) { - if (holidays == null) { - nonWorkingDays = Collections.emptySet(); - } else { - nonWorkingDays = holidays; - } - } - - /** Set both start date and current date */ - public void setStartDate(final Date startDate) { - this.startDate = startDate; - setCurrentBusinessDate(startDate); - } - public void setWorkingWeek(final WorkingWeek week) { workingWeek = week; } - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - void setHolidayHandler(final HolidayHandler holidayHandler) { this.holidayHandler = holidayHandler; } @@ -142,7 +99,7 @@ return currentDate; } - public DateCalculator moveByDays(final int days) { + public DateCalculatorGeneric<Date> moveByDays(final int days) { if (currentDate == null) { initialise(); } @@ -185,7 +142,7 @@ * if both calendars have different types of HolidayHandlers or * WorkingWeek; */ - public DateCalculator combine(final DateCalculator calendar) { + public DateCalculatorGeneric<Date> combine(final DateCalculatorGeneric calendar) { if (calendar == null || calendar == this) { return this; } @@ -203,7 +160,7 @@ newSet.addAll(calendar.getNonWorkingDays()); } - final DateCalculator cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, + final DateCalculatorGeneric cal = new BaseDateCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet, holidayHandler); return cal; @@ -290,31 +247,4 @@ cal.add(Calendar.DAY_OF_MONTH, 7 * 2); } - /** - * 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) - */ - public DateCalculator moveByTenor(final Tenor tenor) { - if (tenor == null) { - throw new IllegalArgumentException("Tenor cannot be null"); - } - - switch (tenor.getCode()) { - case DAY: - 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..."); - } - - } } Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 21:22:58 UTC (rev 39) @@ -16,12 +16,11 @@ package net.objectlab.kit.datecalc.jdk; import java.util.Date; -import java.util.List; -import java.util.Set; -import net.objectlab.kit.datecalc.common.Tenor; -import net.objectlab.kit.datecalc.common.WorkingWeek; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; + + /** * A DateCalculator is a lightweight container with a reference(optional) to a * set of holidays, a WorkingWeek (Mon-Fri by default), a startDate and a @@ -30,145 +29,5 @@ * * @author Benoit Xhenseval */ -public interface DateCalculator { - /** - * @return Calendar name (Typically the name associated with the holiday - * set). - */ - String getName(); - - /** - * @param startDate - * the reference date for this calendar, the current date is also - * updated and may be moved if it falls on a non working day - * (holiday/weekend). - */ - void setStartDate(final Date startDate); - - /** - * @return startDate the reference date for this calendar. - */ - Date getStartDate(); - - /** - * @param current - * Date held by the calendar. - */ - Date getCurrentDate(); - - /** - * is the date a non-working day according to the WorkingWeek? - */ - boolean isWeekend(final Date date); - - /** - * is the given date a non working day, i.e. either a "weekend" or a - * holiday? - */ - boolean isNonWorkingDay(final Date date); - - /** - * @return true if the current date is either a weekend or a holiday. - */ - boolean isCurrentDateNonWorking(); - - /** - * This is typically used at the construction of a DateCalculator. - * - * @param holidays - * the holiday (if null, an empty set will be put in place) - */ - void setNonWorkingDays(final Set<Date> holidays); - - /** - * @return an immutable copy of the holiday set. - */ - Set<Date> getNonWorkingDays(); - - /** - * Allow user to define what their Working Week should be (default is - * Mon-Fri). - * - * @param week - */ - void setWorkingWeek(final WorkingWeek week); - - /** - * give a current business date which may be moved if it falls on a non - * working day. - * - * @param date - * @return new current date if moved. - */ - Date setCurrentBusinessDate(final Date date); - - /** - * @return the holiday handler type, can be null - */ - String getHolidayHandlerType(); - - /** - * move the current date by the number of days and, if it falls on a weekend - * or holiday, move it according to the HolidayHandler given in this - * DateCalculator. - * - * @param days - * number of day - * @return the businessCalendar (so one can do - * calendar.addDays(2).getCurrentBusinessDate();) - */ - DateCalculator moveByDays(final int days); - - /** - * move the current date by a number of business days, 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) - */ - DateCalculator moveByBusinessDays(final int businessDays); - - /** - * By combining several calendars, we take into account several set of - * holidays. - * - * @param calendar - * @return a new DateCalculator - */ - DateCalculator combine(DateCalculator calendar); - - /** - * 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) - */ - DateCalculator moveByTenor(final Tenor tenor); - - /** - * @return the next IMMDate based on current date. - */ - Date getNextIMMDate(); - - /** - * @return the previous IMMDate based on current date. - */ - Date getPreviousIMMDate(); - - /** - * 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. - * @return list of IMM dates - */ - List<Date> getIMMDates(final Date start, final Date end); +public interface DateCalculator extends DateCalculatorGeneric<Date> { } Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactory.java 2006-08-23 21:22:58 UTC (rev 39) @@ -18,6 +18,8 @@ import java.util.Date; import java.util.Set; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; + /** * Factory will create new instances of DateCalculator, these are lightweight, * each thread should use the factory as a given DateCalculator should NOT be @@ -41,7 +43,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - DateCalculator getDateCalculator(final String name, final String holidayHandlerType); + DateCalculatorGeneric getDateCalculator(final String name, final String holidayHandlerType); /** * Use this method to register a set of holidays for a given calendar. Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java 2006-08-23 21:22:58 UTC (rev 39) @@ -20,6 +20,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DefaultDateCalculatorFactory implements DateCalculatorFactory { @@ -42,7 +43,7 @@ * typically one of the value of HolidayHandlerType * @return a new DateCalculator */ - public DateCalculator getDateCalculator(final String name, final String holidayHandlerType) { + public DateCalculatorGeneric getDateCalculator(final String name, final String holidayHandlerType) { final BaseDateCalculator cal = new BaseDateCalculator(); cal.setName(name); if (holidays.containsKey(name)) { Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -4,14 +4,15 @@ import junit.framework.Assert; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DateCalculatorCombinationTest extends AbstractDateCalculatorTest { public void testInvalidCombinationDiffHandler() { - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", HolidayHandlerType.FORWARD); try { @@ -23,8 +24,8 @@ } public void testInvalidCombinationNullNotNullHandler() { - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", HolidayHandlerType.FORWARD); try { @@ -36,9 +37,9 @@ } public void testInvalidCombinationNotNullNullHandler() { - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", null); + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla2", null); try { cal1.combine(cal2); @@ -50,14 +51,14 @@ public void testValidCombinationOneEmptySet() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "bla/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -68,14 +69,14 @@ public void testValidCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "UK/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -86,14 +87,14 @@ public void testValidCombination2Sets() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", createUKHolidays()); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "US/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", Date, combo.getStartDate()); @@ -103,12 +104,12 @@ public void testNullCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculator combo = cal1.combine(null); + final DateCalculatorGeneric combo = cal1.combine(null); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); @@ -119,12 +120,12 @@ public void testSameCombination() { DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("US", createUSHolidays()); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("US", HolidayHandlerType.FORWARD); final Date Date = createDate("2006-08-08"); cal1.setStartDate(Date); - final DateCalculator combo = cal1.combine(cal1); + final DateCalculatorGeneric combo = cal1.combine(cal1); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); 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-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorFactoryTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -5,17 +5,18 @@ import junit.framework.Assert; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class DateCalculatorFactoryTest extends AbstractDateCalculatorTest { public void testGetCalendarsNoHoliday() { - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal1", cal1); Assert.assertEquals("name", "bla", cal1.getName()); Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty()); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal2", cal2); Assert.assertEquals("name", "bla", cal2.getName()); Assert.assertTrue("no holiday", cal2.getNonWorkingDays().isEmpty()); @@ -26,12 +27,12 @@ final Set<Date> uk = createUKHolidays(); DefaultDateCalculatorFactory.getDefaultInstance().registerHolidays("UK", uk); - final DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + final DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNotNull("cal1", cal1); Assert.assertEquals("name", "bla", cal1.getName()); Assert.assertTrue("no holiday", cal1.getNonWorkingDays().isEmpty()); - final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", null); + final DateCalculatorGeneric cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", null); Assert.assertNotNull("cal2", cal2); Assert.assertEquals("name cal2", "UK", cal2.getName()); Assert.assertEquals("UK holidays", 4, cal2.getNonWorkingDays().size()); @@ -39,7 +40,7 @@ } public void testGetCorrectAlgo() { - DateCalculator cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); + DateCalculatorGeneric cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", null); Assert.assertNull("No algo", cal1.getHolidayHandlerType()); cal1 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -7,13 +7,14 @@ import junit.framework.Assert; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.WorkingWeek; public class ForwardDateCalculatorTest extends AbstractDateCalculatorTest { public void testSimpleForwardWithWeekend() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -28,7 +29,7 @@ } public void testSimpleForwardStartDateWithWeekend() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -56,7 +57,7 @@ } public void testSimpleForwardStartDateNoWeekend() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final WorkingWeek ww = new WorkingWeek(); ww.withWorkingDayFromCalendar(true, Calendar.SATURDAY); @@ -88,7 +89,7 @@ } public void testSimpleForwardStartDateWhackyWeek() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -126,7 +127,7 @@ } public void testSimpleForwardStartDateIdealWeekend() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -164,7 +165,7 @@ } public void testSimpleForwardWithHolidays() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); final Set<Date> holidays = new HashSet<Date>(); holidays.add(createDate("2006-08-28")); @@ -197,7 +198,7 @@ checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-28"); } - private void checkDate(final String string, final DateCalculator calendar, final String string2) { + private void checkDate(final String string, final DateCalculatorGeneric calendar, final String string2) { Assert.assertEquals(string, createDate(string2), calendar.getCurrentDate()); } } Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/IMMDateTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -4,6 +4,7 @@ import java.util.List; import junit.framework.Assert; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; public class IMMDateTest extends AbstractDateCalculatorTest { @@ -11,7 +12,7 @@ } public void testNextIMM() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -79,7 +80,7 @@ } public void testPreviousIMM() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -149,7 +150,7 @@ } public void testIMMLists() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -168,7 +169,7 @@ } public void testEmptyIMMLists() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -181,7 +182,7 @@ } public void testEndOnIMMDateIMMLists() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -196,7 +197,7 @@ } public void testStartOnIMMDateIMMLists() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.FORWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 21:22:58 UTC (rev 39) @@ -21,7 +21,8 @@ import java.util.List; import java.util.Set; -import net.objectlab.kit.datecalc.common.Tenor; +import net.objectlab.kit.datecalc.common.AbstractDateCalculator; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.WorkingWeek; import org.joda.time.DateTimeConstants; @@ -34,21 +35,8 @@ * * @author Benoit Xhenseval */ -public class BaseDateCalculator implements DateCalculator { - private static final int MONTHS_IN_QUARTER = 3; +public class BaseDateCalculator extends AbstractDateCalculator<LocalDate> implements DateCalculator { - private static final int DAYS_IN_WEEK = 7; - - private static final int MONTH_IN_YEAR = 12; - - private String name; - - private LocalDate startDate; - - private LocalDate currentDate; - - private Set<LocalDate> nonWorkingDays; - private JodaWorkingWeek workingWeek = JodaWorkingWeek.DEFAULT; private HolidayHandler holidayHandler = null; @@ -71,49 +59,12 @@ this.holidayHandler = holidayHandler; } - public LocalDate getCurrentDate() { - return currentDate; - } - - /** - * @return an unmodifiable Set of non working days. - */ - public Set<LocalDate> getNonWorkingDays() { - return Collections.unmodifiableSet(nonWorkingDays); - } - - public LocalDate getStartDate() { - return startDate; - } - - public void setNonWorkingDays(final Set<LocalDate> holidays) { - if (holidays == null) { - nonWorkingDays = Collections.emptySet(); - } else { - nonWorkingDays = holidays; - } - } - - /** Set both start date and current date */ - public void setStartDate(final LocalDate startDate) { - this.startDate = startDate; - setCurrentBusinessDate(startDate); - } - public void setWorkingWeek(final WorkingWeek week) { if (week instanceof JodaWorkingWeek) { workingWeek = (JodaWorkingWeek) week; } } - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - void setHolidayHandler(final HolidayHandler holidayHandler) { this.holidayHandler = holidayHandler; } @@ -195,7 +146,7 @@ * if both calendars have different types of HolidayHandlers or * WorkingWeek; */ - public DateCalculator combine(final DateCalculator calendar) { + public DateCalculator combine(final DateCalculatorGeneric calendar) { if (calendar == null || calendar == this) { return this; } @@ -324,48 +275,4 @@ return firstWed.plusWeeks(2); } - /** - * Assumes that the month is correct, get the day for the 2rd wednesday. - * - * @param first - * @return - */ - // @Deprecated - // private int calculateIMMDay(final LocalDate date) { - // final LocalDate first = date.dayOfMonth().setCopy(1); - // final int firstDayOfMonth = first.getDayOfWeek(); - // int offset = 7 + DateTimeConstants.WEDNESDAY - firstDayOfMonth; - // if (offset >= 7) { - // offset -= 7; - // } - // - // offset += 14 + 1; // for 3rd of the month - // return offset; - // } - /** - * 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) - */ - public DateCalculator moveByTenor(final Tenor tenor) { - if (tenor == null) { - throw new IllegalArgumentException("Tenor cannot be null"); - } - - switch (tenor.getCode()) { - case IMM: - setCurrentBusinessDate(getNextIMMDate()); - return this; - case DAY: - return moveByDays(tenor.getUnits()); - case WEEK: - return moveByDays(tenor.getUnits() * DAYS_IN_WEEK); - default: - throw new UnsupportedOperationException("Sorry not yet..."); - } - } } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 21:22:58 UTC (rev 39) @@ -15,12 +15,8 @@ */ package net.objectlab.kit.datecalc.joda; -import java.util.List; -import java.util.Set; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; -import net.objectlab.kit.datecalc.common.Tenor; -import net.objectlab.kit.datecalc.common.WorkingWeek; - import org.joda.time.LocalDate; /** @@ -31,149 +27,6 @@ * * @author Benoit Xhenseval */ -public interface DateCalculator { - /** - * @return Calendar name (Typically the name associated with the holiday - * set). - */ - String getName(); +public interface DateCalculator extends DateCalculatorGeneric<LocalDate> { - /** - * @param startDate - * the reference date for this calendar, the current date is also - * updated and may be moved if it falls on a non working day - * (holiday/weekend). - */ - void setStartDate(final LocalDate startDate); - - /** - * @return startDate the reference date for this calendar. - */ - LocalDate getStartDate(); - - /** - * @param current - * Date held by the calendar. - */ - LocalDate getCurrentDate(); - - /** - * is the date a non-working day according to the WorkingWeek? - */ - boolean isWeekend(final LocalDate date); - - /** - * is the given date a non working day, i.e. either a "weekend" or a - * holiday? - */ - boolean isNonWorkingDay(final LocalDate date); - - /** - * @return true if the current date is either a weekend or a holiday. - */ - boolean isCurrentDateNonWorking(); - - /** - * This is typically used at the construction of a DateCalculator but it - * could be called once created and would impact only this instance of the - * calculator; if you want to register a set of non working days for all - * instances of calculator, one needs to do it via the - * DateCalculatorFactory. - * - * @param holidays - * the holiday (if null, an empty set will be put in place) - */ - void setNonWorkingDays(final Set<LocalDate> holidays); - - /** - * @return an immutable copy of the holiday set. - */ - Set<LocalDate> getNonWorkingDays(); - - /** - * Allow user to define what their Working Week should be (default is - * Mon-Fri). - * - * @param week - */ - void setWorkingWeek(final WorkingWeek week); - - /** - * give a current business date which may be moved if it falls on a non - * working day. - * - * @param date - * @return new current date if moved. - */ - LocalDate setCurrentBusinessDate(final LocalDate date); - - /** - * @return the holiday handler type, can be null - */ - String getHolidayHandlerType(); - - /** - * move the current date by the number of days and, if it falls on a weekend - * or holiday, move it according to the HolidayHandler given in this - * DateCalculator. - * - * @param days - * number of day - * @return the businessCalendar (so one can do - * calendar.addDays(2).getCurrentBusinessDate();) - */ - DateCalculator moveByDays(final int days); - - /** - * move the current date by a number of business days, 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByBusinessDays(2).getCurrentBusinessDate();) - */ - DateCalculator moveByBusinessDays(final int businessDays); - - /** - * 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. - * - * @param businessDays - * @return the current businessCalendar (so one can do - * calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();) - */ - DateCalculator moveByTenor(final Tenor tenor); - - /** - * By combining several calendars, we take into account several set of - * holidays. - * - * @param calendar - * @return a new DateCalculator - */ - DateCalculator combine(DateCalculator calendar); - - /** - * @return the next IMMDate based on current date. - */ - LocalDate getNextIMMDate(); - - /** - * @return the previous IMMDate based on current date. - */ - LocalDate getPreviousIMMDate(); - - /** - * 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. - * @return list of IMM dates - */ - List<LocalDate> getIMMDates(final LocalDate start, final LocalDate end); } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -5,6 +5,7 @@ import junit.framework.Assert; import junit.framework.TestCase; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.StandardTenor; import net.objectlab.kit.datecalc.common.Tenor; @@ -16,7 +17,7 @@ public class BackwardDateCalculatorTest extends TestCase { public void testSimpleForwardWithWeekend() { - final DateCalculator cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", + final DateCalculatorGeneric cal = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("bla", HolidayHandlerType.BACKWARD); Assert.assertEquals("Name", "bla", cal.getName()); Assert.assertEquals("Holidays size", 0, cal.getNonWorkingDays().size()); @@ -257,7 +258,7 @@ checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05"); } - private void checkDate(final String string, final DateCalculator calendar, final String string2) { + private void checkDate(final String string, final DateCalculatorGeneric calendar, final String string2) { Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); } } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorCombinationTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -1,6 +1,7 @@ package net.objectlab.kit.datecalc.joda; import junit.framework.Assert; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import org.joda.time.LocalDate; @@ -56,7 +57,7 @@ final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "bla/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); @@ -74,7 +75,7 @@ final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "UK/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); @@ -92,7 +93,7 @@ final DateCalculator cal2 = DefaultDateCalculatorFactory.getDefaultInstance().getDateCalculator("UK", HolidayHandlerType.FORWARD); - final DateCalculator combo = cal1.combine(cal2); + final DateCalculatorGeneric combo = cal1.combine(cal2); Assert.assertEquals("Combo name", "US/UK", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); @@ -107,7 +108,7 @@ final LocalDate localDate = new LocalDate("2006-08-08"); cal1.setStartDate(localDate); - final DateCalculator combo = cal1.combine(null); + final DateCalculatorGeneric combo = cal1.combine(null); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); @@ -123,7 +124,7 @@ final LocalDate localDate = new LocalDate("2006-08-08"); cal1.setStartDate(localDate); - final DateCalculator combo = cal1.combine(cal1); + final DateCalculatorGeneric combo = cal1.combine(cal1); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -5,6 +5,7 @@ import junit.framework.Assert; import junit.framework.TestCase; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.StandardTenor; import net.objectlab.kit.datecalc.common.Tenor; @@ -254,7 +255,7 @@ checkDate("Move 4W", cal.moveByTenor(new Tenor(4, TenorCode.WEEK)), "2006-09-05"); } - private void checkDate(final String string, final DateCalculator calendar, final String string2) { + private void checkDate(final String string, final DateCalculatorGeneric calendar, final String string2) { Assert.assertEquals(string, new LocalDate(string2), calendar.getCurrentDate()); } } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java 2006-08-23 20:54:43 UTC (rev 38) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ModifiedFollowingDateCalculatorTest.java 2006-08-23 21:22:58 UTC (rev 39) @@ -5,6 +5,7 @@ import junit.framework.Assert; import junit.framework.TestCase; +import net.objectlab.kit.datecalc.common.DateCalculatorGeneric; import net.objectlab.kit.datecalc.common.HolidayHandlerType; import net.objectlab.kit.datecalc.common.StandardTenor; import net.objectlab.kit.datecalc.common.Tenor; @@ -23,11 +24,11 @@ final LocalDate startDate = new LocalDate("2006-08-01"); cal.setStartDate(startDate); - checkDate("Move by 0 days", cal.addDays(0), "2006-08-01"); - checkDate("Move by 1 days", cal.addDays(1), "2006-08-02"); - checkDate("Move by 1 more days", cal.addDays(1), "2006-08-03"); - checkDate("Move by 1 more more days", cal.addDays(1), "2006-08-04"); - checkDate("Move by 1 more more more days (across weekend)", cal.addDays(1), "2006-08-07"); + checkDate("Move by 0 days", cal.moveByDays(0), "2006-08-01"); + checkDate("Move by 1 days", cal.moveByDays(1), "2006-08-02"); + checkDate("Move by 1 more days", cal.moveByDays(1), "2006-08-03"); + checkDate("Move by 1 more more days", cal.moveByDays(1), "2006-08-04"); + checkDate("Move by 1 more more more days (across weekend)", cal.moveByDays(1), "2006-08-07"); } public void testSimpleForwardStartDateWithWeekend() { @@ -188,16 +189,16 @@ checkDate("Xmas Eve", cal, "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("21/12 + 1", cal.moveByDays(1), "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(2), "2006-12-27"); + checkDate("21/12 + 1", cal.moveByDays(2), "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-22")); - checkDate("22/12 + 1", cal.addDays(1), "2006-12-27"); + checkDate("22/12 + 1", cal.moveByDays(1), "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-23")); - checkDate("23/12 + 1", cal.addDays(1), "2006-12-28"); + checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-28"); } public void testMoveByBusinessDays() { @@ -216,7 +217,7 @@ checkDate("Move 1 BD", cal.moveByBusinessDays(1), "2006-08-25"); cal.setStartDate(new LocalDate("2006-08-24")); - checkDate("Add 1 week", cal.addDays(7), ... [truncated message content] |
|
From: <be...@us...> - 2006-08-23 20:54:55
|
Revision: 38 Author: benoitx Date: 2006-08-23 13:54:43 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=38&view=rev Log Message: ----------- new stats Modified Paths: -------------- trunk/datecalc-jdk/qalab.xml Modified: trunk/datecalc-jdk/qalab.xml =================================================================== --- trunk/datecalc-jdk/qalab.xml 2006-08-23 20:51:42 UTC (rev 37) +++ trunk/datecalc-jdk/qalab.xml 2006-08-23 20:54:43 UTC (rev 38) @@ -26,9 +26,11 @@ <summaryresult date="2006-08-10" filecount="8" statvalue="3" type="checkstyle"/> <summaryresult date="2006-08-10" filecount="2" statvalue="7" type="pmd"/> <summaryresult date="2006-08-10" filecount="1" statvalue="1" type="findbugs"/> - <summaryresult date="2006-08-20" filecount="8" statvalue="3" type="checkstyle"/> - <summaryresult date="2006-08-20" filecount="1" statvalue="4" type="pmd"/> + <summaryresult date="2006-08-20" filecount="10" statvalue="10" type="checkstyle"/> + <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="pmd"/> <summaryresult date="2006-08-20" filecount="1" statvalue="1" type="findbugs"/> + <summaryresult date="2006-08-20" filecount="9" statvalue="77" type="cobertura-line"/> + <summaryresult date="2006-08-20" filecount="9" statvalue="77" 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"/> @@ -46,9 +48,11 @@ <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-10" statvalue="4" type="pmd"/> <result date="2006-08-10" statvalue="1" type="findbugs"/> - <result date="2006-08-20" statvalue="1" type="checkstyle"/> - <result date="2006-08-20" statvalue="4" type="pmd"/> + <result date="2006-08-20" statvalue="7" type="checkstyle"/> + <result date="2006-08-20" statvalue="1" type="pmd"/> <result date="2006-08-20" statvalue="1" type="findbugs"/> + <result date="2006-08-20" statvalue="74" type="cobertura-line"/> + <result date="2006-08-20" statvalue="75" type="cobertura-branch"/> </file> <file id="net_objectlab_kit_datecalc_jdk_DefaultDateCalculatorFactory.java" path="net/objectlab/kit/datecalc/jdk/DefaultDateCalculatorFactory.java"> @@ -56,6 +60,8 @@ <result date="2006-08-09" statvalue="1" type="checkstyle"/> <result date="2006-08-10" statvalue="1" type="checkstyle"/> <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-20" statvalue="100" type="cobertura-line"/> + <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlab-kit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlab-kit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"> @@ -108,8 +114,18 @@ <result date="2006-08-08" statvalue="100" type="cobertura-branch"/> <result date="2006-08-09" statvalue="100" type="cobertura-branch"/> <result date="2006-08-10" statvalue="100" type="cobertura-branch"/> + <result date="2006-08-20" statvalue="50" type="cobertura-line"/> <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> </file> <file id="C:_project_objectlabkit_datecalc-jdk_src_test_java_net_objectlab_kit_datecalc_jdk_DateCalculatorCombinationTest.java" path="C:/project/objectlabkit/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/DateCalculatorCombinationTest.java"/> + <file id="net_objectlab_kit_datecalc_jdk_Utils.java" path="net/objectlab/kit/datecalc/jdk/Utils.java"> + <result date="2006-08-20" statvalue="1" type="checkstyle"/> + <result date="2006-08-20" statvalue="75" type="cobertura-line"/> + <result date="2006-08-20" statvalue="100" type="cobertura-branch"/> + </file> + <file id="net_objectlab_kit_datecalc_jdk_ForwardHandler.java" path="net/objectlab/kit/datecalc/jdk/ForwardHandler.java"> + <result date="2006-08-20" statvalue="100" type="cobertura-line"/> + <result date="2006-08-20" 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-08-23 20:52:57
|
Revision: 37 Author: benoitx Date: 2006-08-23 13:51:42 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=37&view=rev Log Message: ----------- Added Paths: ----------- trunk/LICENSE.txt Added: trunk/LICENSE.txt =================================================================== --- trunk/LICENSE.txt (rev 0) +++ trunk/LICENSE.txt 2006-08-23 20:51:42 UTC (rev 37) @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ma...@us...> - 2006-08-23 20:06:34
|
Revision: 36 Author: marchy Date: 2006-08-23 13:05:37 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/objectlabkit/?rev=36&view=rev Log Message: ----------- renamed addDays() to moveByDays() to match moveByBusinessDays() Modified Paths: -------------- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/BaseDateCalculator.java 2006-08-23 20:05:37 UTC (rev 36) @@ -142,7 +142,7 @@ return currentDate; } - public DateCalculator addDays(final int days) { + public DateCalculator moveByDays(final int days) { if (currentDate == null) { initialise(); } @@ -167,7 +167,7 @@ final int step = (businessDays < 0 ? -1 : 1); for (int i = 0; i < numberOfStepsLeft; i++) { - addDays(step); + moveByDays(step); } return this; @@ -306,9 +306,9 @@ switch (tenor.getCode()) { case DAY: - return addDays(tenor.getUnits()); + return moveByDays(tenor.getUnits()); case WEEK: - return addDays(tenor.getUnits() * DAYS_IN_WEEK); + return moveByDays(tenor.getUnits() * DAYS_IN_WEEK); case IMM: setCurrentBusinessDate(getNextIMMDate()); return this; Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java =================================================================== --- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateCalculator.java 2006-08-23 20:05:37 UTC (rev 36) @@ -117,7 +117,7 @@ * @return the businessCalendar (so one can do * calendar.addDays(2).getCurrentBusinessDate();) */ - DateCalculator addDays(final int days); + DateCalculator moveByDays(final int days); /** * move the current date by a number of business days, this means that if a Modified: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/ForwardDateCalculatorTest.java 2006-08-23 20:05:37 UTC (rev 36) @@ -20,11 +20,11 @@ final Date startDate = createDate("2006-08-01"); cal.setStartDate(startDate); - checkDate("Move by 0 days", cal.addDays(0), "2006-08-01"); - checkDate("Move by 1 days", cal.addDays(1), "2006-08-02"); - checkDate("Move by 1 more days", cal.addDays(1), "2006-08-03"); - checkDate("Move by 1 more more days", cal.addDays(1), "2006-08-04"); - checkDate("Move by 1 more more more days (across weekend)", cal.addDays(1), "2006-08-07"); + checkDate("Move by 0 days", cal.moveByDays(0), "2006-08-01"); + checkDate("Move by 1 days", cal.moveByDays(1), "2006-08-02"); + checkDate("Move by 1 more days", cal.moveByDays(1), "2006-08-03"); + checkDate("Move by 1 more more days", cal.moveByDays(1), "2006-08-04"); + checkDate("Move by 1 more more more days (across weekend)", cal.moveByDays(1), "2006-08-07"); } public void testSimpleForwardStartDateWithWeekend() { @@ -185,16 +185,16 @@ checkDate("Xmas Eve", cal, "2006-12-27"); cal.setStartDate(createDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("21/12 + 1", cal.moveByDays(1), "2006-12-22"); cal.setStartDate(createDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(2), "2006-12-27"); + checkDate("21/12 + 1", cal.moveByDays(2), "2006-12-27"); cal.setStartDate(createDate("2006-12-22")); - checkDate("22/12 + 1", cal.addDays(1), "2006-12-27"); + checkDate("22/12 + 1", cal.moveByDays(1), "2006-12-27"); cal.setStartDate(createDate("2006-12-23")); - checkDate("23/12 + 1", cal.addDays(1), "2006-12-28"); + checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-28"); } private void checkDate(final String string, final DateCalculator calendar, final String string2) { Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/BaseDateCalculator.java 2006-08-23 20:05:37 UTC (rev 36) @@ -151,7 +151,7 @@ return currentDate; } - public DateCalculator addDays(final int days) { + public DateCalculator moveByDays(final int days) { if (currentDate == null) { initialise(); } @@ -177,7 +177,7 @@ final int step = (businessDays < 0 ? -1 : 1); for (int i = 0; i < numberOfStepsLeft; i++) { - addDays(step); + moveByDays(step); } return this; @@ -361,9 +361,9 @@ setCurrentBusinessDate(getNextIMMDate()); return this; case DAY: - return addDays(tenor.getUnits()); + return moveByDays(tenor.getUnits()); case WEEK: - return addDays(tenor.getUnits() * DAYS_IN_WEEK); + return moveByDays(tenor.getUnits() * DAYS_IN_WEEK); default: throw new UnsupportedOperationException("Sorry not yet..."); } Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java =================================================================== --- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/DateCalculator.java 2006-08-23 20:05:37 UTC (rev 36) @@ -122,7 +122,7 @@ * @return the businessCalendar (so one can do * calendar.addDays(2).getCurrentBusinessDate();) */ - DateCalculator addDays(final int days); + DateCalculator moveByDays(final int days); /** * move the current date by a number of business days, this means that if a Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/BackwardDateCalculatorTest.java 2006-08-23 20:05:37 UTC (rev 36) @@ -23,11 +23,11 @@ final LocalDate startDate = new LocalDate("2006-08-01"); cal.setStartDate(startDate); - checkDate("Move by 0 days", cal.addDays(0), "2006-08-01"); - checkDate("Move by 1 days", cal.addDays(1), "2006-08-02"); - checkDate("Move by 1 more days", cal.addDays(1), "2006-08-03"); - checkDate("Move by 1 more more days", cal.addDays(1), "2006-08-04"); - checkDate("Move by 1 more more more days (across weekend)", cal.addDays(1), "2006-08-04"); + checkDate("Move by 0 days", cal.moveByDays(0), "2006-08-01"); + checkDate("Move by 1 days", cal.moveByDays(1), "2006-08-02"); + checkDate("Move by 1 more days", cal.moveByDays(1), "2006-08-03"); + checkDate("Move by 1 more more days", cal.moveByDays(1), "2006-08-04"); + checkDate("Move by 1 more more more days (across weekend)", cal.moveByDays(1), "2006-08-04"); } public void testSimpleBackwardStartDateWithWeekend() { @@ -188,16 +188,16 @@ checkDate("Xmas Eve", cal, "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("21/12 + 1", cal.moveByDays(1), "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(2), "2006-12-22"); + checkDate("21/12 + 1", cal.moveByDays(2), "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-22")); - checkDate("22/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("22/12 + 1", cal.moveByDays(1), "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-23")); - checkDate("23/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-22"); } /** @@ -219,7 +219,7 @@ checkDate("Move 1 BD", cal.moveByBusinessDays(1), "2006-08-25"); cal.setStartDate(new LocalDate("2006-08-24")); - checkDate("Add 1 week", cal.addDays(7), "2006-08-31"); + checkDate("Add 1 week", cal.moveByDays(7), "2006-08-31"); cal.setStartDate(new LocalDate("2006-08-24")); // checkDate("Move by 1W with 1 bank holiday", cal.moveByBusinessDays(7), "2006-09-05"); Modified: 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-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/DateCalculatorFactoryTest.java 2006-08-23 20:05:37 UTC (rev 36) @@ -75,16 +75,16 @@ Assert.assertNotNull("No hol", cal1.getNonWorkingDays()); Assert.assertTrue("empty hol", cal1.getNonWorkingDays().isEmpty()); - LocalDate date = cal1.addDays(0).getCurrentDate(); + LocalDate date = cal1.moveByDays(0).getCurrentDate(); Assert.assertEquals("default today", new LocalDate(), date); cal1.setStartDate(null); - date = cal1.addDays(0).getCurrentDate(); + date = cal1.moveByDays(0).getCurrentDate(); Assert.assertEquals("default today", new LocalDate(), date); cal1.setStartDate(new LocalDate("2006-08-08")); cal1.setCurrentBusinessDate(null); - date = cal1.addDays(0).getCurrentDate(); + date = cal1.moveByDays(0).getCurrentDate(); Assert.assertEquals("default today", new LocalDate(), date); } Modified: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java =================================================================== --- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-23 12:14:53 UTC (rev 35) +++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/ForwardDateCalculatorTest.java 2006-08-23 20:05:37 UTC (rev 36) @@ -23,11 +23,11 @@ final LocalDate startDate = new LocalDate("2006-08-01"); cal.setStartDate(startDate); - checkDate("Move by 0 days", cal.addDays(0), "2006-08-01"); - checkDate("Move by 1 days", cal.addDays(1), "2006-08-02"); - checkDate("Move by 1 more days", cal.addDays(1), "2006-08-03"); - checkDate("Move by 1 more more days", cal.addDays(1), "2006-08-04"); - checkDate("Move by 1 more more more days (across weekend)", cal.addDays(1), "2006-08-07"); + checkDate("Move by 0 days", cal.moveByDays(0), "2006-08-01"); + checkDate("Move by 1 days", cal.moveByDays(1), "2006-08-02"); + checkDate("Move by 1 more days", cal.moveByDays(1), "2006-08-03"); + checkDate("Move by 1 more more days", cal.moveByDays(1), "2006-08-04"); + checkDate("Move by 1 more more more days (across weekend)", cal.moveByDays(1), "2006-08-07"); } public void testSimpleForwardStartDateWithWeekend() { @@ -188,16 +188,16 @@ checkDate("Xmas Eve", cal, "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(1), "2006-12-22"); + checkDate("21/12 + 1", cal.moveByDays(1), "2006-12-22"); cal.setStartDate(new LocalDate("2006-12-21")); - checkDate("21/12 + 1", cal.addDays(2), "2006-12-27"); + checkDate("21/12 + 1", cal.moveByDays(2), "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-22")); - checkDate("22/12 + 1", cal.addDays(1), "2006-12-27"); + checkDate("22/12 + 1", cal.moveByDays(1), "2006-12-27"); cal.setStartDate(new LocalDate("2006-12-23")); - checkDate("23/12 + 1", cal.addDays(1), "2006-12-28"); + checkDate("23/12 + 1", cal.moveByDays(1), "2006-12-28"); } public void testMoveByBusinessDays() { @@ -216,7 +216,7 @@ checkDate("Move 1 BD", cal.moveByBusinessDays(1), "2006-08-25"); cal.setStartDate(new LocalDate("2006-08-24")); - checkDate("Add 1 week", cal.addDays(7), "2006-08-31"); + checkDate("Add 1 week", cal.moveByDays(7), "2006-08-31"); cal.setStartDate(new LocalDate("2006-08-24")); checkDate("Move by 1W with 1 bank holiday", cal.moveByBusinessDays(7), "2006-09-05"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |