| 
      
      
      From: <be...@us...> - 2006-11-03 15:59:31
      
     | 
| Revision: 219
          http://svn.sourceforge.net/objectlabkit/?rev=219&view=rev
Author:   benoitx
Date:     2006-11-03 07:59:19 -0800 (Fri, 03 Nov 2006)
Log Message:
-----------
First cut at a 'range' feature...
Modified Paths:
--------------
    trunk/common-build/project.properties
    trunk/datecalc-common/project.xml
    trunk/project.properties
Added Paths:
-----------
    trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java
    trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayCalendar.java
Modified: trunk/common-build/project.properties
===================================================================
--- trunk/common-build/project.properties	2006-10-21 17:13:39 UTC (rev 218)
+++ trunk/common-build/project.properties	2006-11-03 15:59:19 UTC (rev 219)
@@ -102,3 +102,5 @@
 maven.pmd.targetjdk=1.5
 
 maven.multiproject.navigation=independent
+
+maven.repo.remote=http://repo1.maven.org/maven,http://people.apache.org/repo/m1-snapshot-repository/
Modified: trunk/datecalc-common/project.xml
===================================================================
--- trunk/datecalc-common/project.xml	2006-10-21 17:13:39 UTC (rev 218)
+++ trunk/datecalc-common/project.xml	2006-11-03 15:59:19 UTC (rev 219)
@@ -52,6 +52,15 @@
          <excludes>
             <exclude>**/Abstract*.java</exclude>
          </excludes>
+         <resources>
+            <resource>
+               <directory>src/test/java</directory>
+               <includes>
+                  <include>**/*.txt</include>
+               </includes>
+               <filtering>false</filtering>
+            </resource>
+         </resources>
       </unitTest>
    </build>
 
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java	                        (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java	2006-11-03 15:59:19 UTC (rev 219)
@@ -0,0 +1,110 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ * 
+ * Based in London, we are world leaders in the design and development 
+ * of bespoke applications for the securities financing markets.
+ * 
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ *           ___  _     _           _   _          _
+ *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
+ *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
+ *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
+ *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ *                   |__/
+ *
+ *                     www.ObjectLab.co.uk
+ *
+ * $Id: DateCalculator.java 200 2006-10-10 20:15:58Z benoitx $
+ * 
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @TODO javadoc
+ * 
+ * @author xhensevb
+ * @author $LastChangedBy: marchy $
+ * @version $Revision: 138 $ $Date: 2006-09-10 13:29:15 +0100 (Sun, 10 Sep 2006) $
+ * 
+ */
+public class DefaultHolidayCalendar<E> implements HolidayCalendar<E> {
+    private Set<E> holidays;
+
+    private E earlyBoundary;
+
+    private E lateBoundary;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#getEarlyBoundary()
+     */
+    public E getEarlyBoundary() {
+        return earlyBoundary;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#getHolidays()
+     */
+    public Set<E> getHolidays() {
+        return holidays;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#getLateBoundary()
+     */
+    public E getLateBoundary() {
+        return lateBoundary;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#setEarlyBoundary(java.lang.Object)
+     */
+    public void setEarlyBoundary(final E earlyBoundary) {
+        this.earlyBoundary = earlyBoundary;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#setHolidays(java.util.Set)
+     */
+    public void setHolidays(final Set<E> holidays) {
+        Set<E> s = new HashSet<E>();
+        s.addAll(holidays);
+
+        this.holidays = Collections.unmodifiableSet(s);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see net.objectlab.kit.datecalc.common.HolidayCalendar#setLateBoundary(java.lang.Object)
+     */
+    public void setLateBoundary(final E lateBoundary) {
+        this.lateBoundary = lateBoundary;
+    }
+}
Added: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayCalendar.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayCalendar.java	                        (rev 0)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayCalendar.java	2006-11-03 15:59:19 UTC (rev 219)
@@ -0,0 +1,112 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ * 
+ * Based in London, we are world leaders in the design and development 
+ * of bespoke applications for the securities financing markets.
+ * 
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ *           ___  _     _           _   _          _
+ *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
+ *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
+ *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
+ *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ *                   |__/
+ *
+ *                     www.ObjectLab.co.uk
+ *
+ * $Id: HolidayHandler.java 200 2006-10-10 20:15:58Z benoitx $
+ * 
+ * Copyright 2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package net.objectlab.kit.datecalc.common;
+
+import java.util.Set;
+
+/**
+ * A Holiday Calendar not only defines a set of holiday dates but an early and
+ * late boundary for these dates, e.g. putting the holidays for 2006 in a set
+ * with limits of 1 Jan 2006 and 31 Dec 2006 means that 2006 is covered, not
+ * that 31 Dec is a holiday itself.
+ * 
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 200 $ $Date: 2006-10-10 21:15:58 +0100 (Tue, 10 Oct 2006) $
+ * @since 1.1
+ * 
+ * @param <E>
+ *            a representation of a date, typically JDK: Date, Calendar;
+ *            Joda:LocalDate, YearMonthDay
+ * 
+ */
+public interface HolidayCalendar<E> {
+    /**
+     * Returns an immutable set of holidays.
+     * 
+     * @return an immutable copy of the holiday set.
+     */
+    Set<E> getHolidays();
+
+    /**
+     * Returns an immutable set of holidays.
+     * 
+     * @return an immutable copy of the holiday set.
+     * @throws IllegalArgumentException if the holidays contains dates outside 
+     * the range defined by earliest/latest dates.
+     */
+    void setHolidays(final Set<E> holidays);
+
+    /**
+     * Returns the earliest date covered by this HolidayCalendar.
+     * @return E the earliest date covered by this holiday calendar.
+     */
+    E getEarlyBoundary();
+
+    /**
+     * Sets the earliest date (must be <= first date in holiday set)
+     * @param earlyBoundary
+     */
+    void setEarlyBoundary(final E earlyBoundary);
+
+    /**
+     * Returns the latest date covered by this HolidayCalendar.
+     * @return E the latest date covered by this holiday calendar.
+     */
+    E getLateBoundary();
+
+    /**
+     * Sets the latest date (must be <= first date in holiday set)
+     * @param lateBoundary
+     */
+    void setLateBoundary(final E lateBoundary);
+}
+
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ * 
+ * Based in London, we are world leaders in the design and development of
+ * bespoke applications for the securities financing markets.
+ * 
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * 
+ *           ___  _     _           _   _          _
+ *          / _ \| |__ (_) ___  ___| |_| |    __ _| |__
+ *         | | | | '_ \| |/ _ \/ __| __| |   / _` | '_ \
+ *         | |_| | |_) | |  __/ (__| |_| |__| (_| | |_) |
+ *          \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ *                   |__/
+ *
+ * 
+ *                      www.ObjectLab.co.uk
+ */
Modified: trunk/project.properties
===================================================================
--- trunk/project.properties	2006-10-21 17:13:39 UTC (rev 218)
+++ trunk/project.properties	2006-11-03 15:59:19 UTC (rev 219)
@@ -109,4 +109,6 @@
 #do.obfuscation=false
 
 #
-maven.ydoc.packages=net.objectlab.kit.*
\ No newline at end of file
+maven.ydoc.packages=net.objectlab.kit.*
+
+maven.repo.remote=http://repo1.maven.org/maven,http://people.apache.org/repo/m1-snapshot-repository/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |