|
From: <be...@us...> - 2006-09-05 09:29:53
|
Revision: 105
http://svn.sourceforge.net/objectlabkit/?rev=105&view=rev
Author: benoitx
Date: 2006-09-05 02:29:03 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Better JavaDoc.
Modified 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/IMMPeriod.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-09-04 23:56:32 UTC (rev 104)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-05 09:29:03 UTC (rev 105)
@@ -21,10 +21,13 @@
import java.util.Set;
/**
- * A DateCalculator is a lightweight container with a reference(optional) to a
+ * A DateCalculator is a lightweight container with an optional reference 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.
+ * current business date. The Calculator also uses a HolidayHandler to determine what to
+ * do when the calculated current Business Date falls on a weekend or holiday (non-working day).
+ * The CurrentDate date is changed everytime that the moveByDays or moveByBusinessDays methods are called.
+ * 'E' will be parameterized to be a Date-like class, i.e. java.util.Date or java.util.Calendar (and LocalDate
+ * or YearMonthDay for Joda-time).
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
@@ -33,48 +36,60 @@
public interface DateCalculator<E> {
/**
- * @return Calendar name (Typically the name associated with the holiday
+ * This is typically the name of the associated set of holidays.
+ * @return calculator name (Typically the name associated with the holiday
* set).
*/
String getName();
/**
+ * Setting the start date also sets the current business date (and if this is a non-working day,
+ * the current business date will be moved to the next business day acording to the HolidayHandler
+ * algorithm given).
* @param startDate
- * the reference date for this calendar, the current date is also
+ * the reference date for this calculator, the current business date is also
* updated and may be moved if it falls on a non working day
* (holiday/weekend).
*/
void setStartDate(final E startDate);
/**
- * @return startDate the reference date for this calendar.
+ * Gives the startDate of this calculator (immutable once set via setStartDate).
+ * @return startDate the reference date for this calculator.
*/
E getStartDate();
/**
- * @param currentDate
- * held by the calendar.
+ * Gives the current business date held by the calculator.
+ * @return a date.
*/
E getCurrentBusinessDate();
/**
- * is the given date on a weekend, according to the WorkingWeek
+ * Is the given date falling on a weekend, according to the WorkingWeek.
+ * @return true if the date falls on a weekend.
*/
boolean isWeekend(final E date);
/**
- * is the given date a non working day, i.e. either a "weekend" or a
+ * Is the given date a non working day, i.e. either a "weekend" or a
* holiday?
+ * @return true if the given date is non-working.
*/
boolean isNonWorkingDay(final E date);
/**
+ * Is the current business day a non-working day, this is useful if the
+ * calculator does not have any algorithm to change the date when it falls
+ * on a non-working day. This method can then be used to show a warning to the
+ * user.
* @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.
+ * This is typically used at the construction of a DateCalculator to give
+ * a reference to a set of holidays.
*
* @param holidays
* the holiday (if null, an empty set will be put in place)
@@ -82,61 +97,72 @@
void setNonWorkingDays(final Set<E> holidays);
/**
+ * Gives a immutable copy of the set of registered holidays.
* @return an immutable copy of the holiday set.
*/
Set<E> getNonWorkingDays();
/**
- * Allow user to define what their Working Week should be (default is
+ * Allows user to define what their Working Week should be (default is
* Mon-Fri).
*
- * @param week
+ * @param week an immutable definition of a week.
*/
void setWorkingWeek(final WorkingWeek week);
/**
- * give a current business date which may be moved if it falls on a non
- * working day.
+ * Gives a current business date, it may be moved acording to the HolidayHandler algorithm
+ * if it falls on a non-working day.
*
* @param date
- * @return new current date if moved.
+ * @return new current business date if moved.
*/
E setCurrentBusinessDate(final E date);
/**
+ * Gives the name of the holiday handler algorithm, see HolidayHandlerType for some standard values.
* @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
+ * This changes the current business date held in the calculator, it moves the
+ * new current business date by the number of days and, if it falls on a weekend
+ * or holiday, moves it further according to the HolidayHandler given in this
* DateCalculator.
*
* @param days
- * number of day
+ * number of days (can be <0 or >0)
* @return the businessCalendar (so one can do
* calendar.moveByDays(-2).getCurrentBusinessDate();)
*/
DateCalculator<E> 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
+ * This changes the current business date held in the calculator, it moves the
+ * current date by a number of business days, this means that if a
+ * date is either a 'weekend' or holiday along the way, it will be skipped acording to the
* holiday handler and not count towards the number of days to move.
*
- * @param businessDays
+ * @param businessDays (can be <0 or >0)
* @return the current businessCalendar (so one can do
* calendar.moveByBusinessDays(2).getCurrentBusinessDate();)
+ * @exception IllegalArgumentException if the HolidayHandlerType is (MODIFIED_PRECEEDING or BACKWARD) and businessDays > 0
+ * or (MODIFIED_FOLLOWING or FORWARD) and businessDays < 0
*/
DateCalculator<E> moveByBusinessDays(final int businessDays);
/**
- * By combining several calendars, we take into account several set of
- * holidays.
+ * Allows DateCalculators to be combined into a new one, the startDate and
+ * currentBusinessDate will be the ones from the existing calendar (not the
+ * parameter one). The name will be combined name1+"/"+calendar.getName().
*
- * @param calculator
- * @return a new DateCalculator
+ * @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;
*/
DateCalculator<E> combine(DateCalculator<E> calculator);
@@ -152,20 +178,23 @@
DateCalculator<E> moveByTenor(final Tenor tenor);
/**
+ * Checks if a given date is an official IMM Date (3rd Wednesdays of March/June/Sept/Dec.
* @param date
* @return true if that date is an IMM date.
*/
boolean isIMMDate(E date);
/**
- * Even if the current date is an IMM date, it will return the next one.
+ * Starting from the current business date, it will return the next IMM Date, even if the
+ * current business date is an IMM date (same as calling getNextIMMDate(IMMPeriod.QUARTERLY)).
*
- * @return the next IMMDate based on current date.
+ * @return the next IMMDate based on current business date.
*/
E getNextIMMDate();
/**
- * Even if the current date is an IMM date, it will return the next one.
+ * Starting from the current business date, it will return the next IMM Date based on the IMMPeriod,
+ * even if the current business date is an IMM date.
*
* @param period
* specify when the "next" IMM is, if quarterly then it is the
@@ -175,14 +204,16 @@
E getNextIMMDate(IMMPeriod period);
/**
- * Even if the current date is an IMM date, it will return the previous one.
+ * Starting from the current business date, it will return the previous IMM Date, even if the
+ * current business date is an IMM date.
*
* @return the previous IMMDate based on current date.
*/
E getPreviousIMMDate();
/**
- * Even if the current date is an IMM date, it will return the previous one.
+ * Starting from the current business date, it will return the previous IMM Date based on the IMMPeriod,
+ * even if the current business date is an IMM date.
*
* @param period
* specify when the "previous" IMM is, if quarterly then it is
@@ -194,7 +225,7 @@
/**
* Returns a list of IMM dates between 2 dates, it will exclude the start
* date if it is an IMM date but would include the end date if it is an IMM
- * (same as IMMPeriod.QUARTERLY).
+ * (same as as calling getIMMDates(start,end,IMMPeriod.QUARTERLY)).
*
* @param start
* start of the interval, excluded
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-04 23:56:32 UTC (rev 104)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMPeriod.java 2006-09-05 09:29:03 UTC (rev 105)
@@ -28,7 +28,7 @@
public enum IMMPeriod {
/** Bi annually March and September */
BI_ANNUALY_MAR_SEP,
- /** Bi annually March and September */
+ /** Bi annually June and December */
BI_ANNUALY_JUN_DEC,
/** Quarterly: eg March, June, September, December */
QUARTERLY
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-09-10 15:19:15
|
Revision: 147
http://svn.sourceforge.net/objectlabkit/?rev=147&view=rev
Author: marchy
Date: 2006-09-10 08:18:53 -0700 (Sun, 10 Sep 2006)
Log Message:
-----------
javadoc update
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/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/Utils.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -22,9 +22,9 @@
import java.util.concurrent.ConcurrentMap;
/**
- * TODO javadoc
+ * @TODO javadoc
*
- * @author marchi
+ * @author Marcin Jekot
* @author $LastChangedBy: benoitx $
* @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
*
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -20,8 +20,12 @@
/**
* This will be called to determine whether the date should be moved according
* to the special algorithm used.
- *
+ *
* @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
+ * @param <E>
*/
public interface HolidayHandler<E> {
E moveCurrentDate(DateCalculator<E> date);
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandlerType.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandlerType.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandlerType.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -21,6 +21,9 @@
* Define a series of standard way to handle holidays.
*
* @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
*/
public final class HolidayHandlerType {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -17,10 +17,13 @@
*/
package net.objectlab.kit.datecalc.common;
+
/**
* Defines some standard Day Count basis.
*
* @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
*/
public enum PeriodCountBasis {
/**
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/StandardTenor.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -21,6 +21,9 @@
* A series of Standard Tenors used by the financial industry.
*
* @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
*/
public final class StandardTenor {
private StandardTenor() {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -20,6 +20,11 @@
/**
* Holds only valid unit and TenorCode: Day, Week, Month, Year, IMM, Overnight,
* TomNext, Spot, SpotNext, SpotWeek.
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
*/
public class Tenor {
private int units = 0;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/TenorCode.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -17,6 +17,14 @@
*/
package net.objectlab.kit.datecalc.common;
+/**
+ * enum of Tenor Codes held by a {@link Tenor}
+ *
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
+ */
public enum TenorCode {
OVERNIGHT("ON", false),
// TOMNEXT("TN", false),
@@ -34,10 +42,17 @@
this.acceptUnits = acceptUnits;
}
+ /**
+ * @return the string representation of this <code>TenorCode</code>
+ */
public String getCode() {
return code;
}
+ /**
+ * @param code string representation of the <code>TenorCode</code>
+ * @return a <code>TenorCode</code> represented by the string argument
+ */
public static TenorCode fromCode(final String code) {
for (final TenorCode ct : TenorCode.values()) {
if (ct.getCode().equals(code)) {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -28,7 +28,7 @@
import java.util.TimeZone;
/**
- * TODO javadoc
+ * Utilities class for <code>Date/Calendar</code> conversions
*
* @author Marcin Jekot
* @author $LastModifiedBy$
@@ -44,15 +44,12 @@
private Utils() {
}
- public static Calendar getCal(final Date date) {
- if (date == null) {
- return null;
- }
- final Calendar cal = Calendar.getInstance();
- cal.setTime(date);
- return blastTime(cal);
- }
-
+ /**
+ * Removes set's all "time" fields to zero, leaving only the date portion of the Calendar.
+ * The Calendar passe
+ * @param cal to Calendar object to blast, note, it will be modified
+ * @return the calendar object modified (same instance)
+ */
public static Calendar blastTime(final Calendar cal) {
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -63,26 +60,28 @@
}
/**
+ * Creates a Date object given a string representation of it
*
- * @param str
+ * @param dateStr
* string (return today if string is null)
- * @return today if
+ * @return today if string is null, a Date object representing the string
+ * otherwise
* @throws IllegalArgumentException
* if the string cannot be parsed.
*/
- public static Date createDate(final String str) {
- if (str == null) {
+ public static Date createDate(final String dateStr) {
+ if (dateStr == null) {
return createCalendar(null).getTime();
}
try {
- final Date date = SDF.parse(str);
+ final Date date = SDF.parse(dateStr);
final Calendar cal = getCal(date);
return cal.getTime();
} catch (final ParseException e) {
- throw new IllegalArgumentException("\"" + str + "\"" + " is an invalid date, the pattern is : " + DATE_PATTERN);
+ throw new IllegalArgumentException("\"" + dateStr + "\"" + " is an invalid date, the pattern is : " + DATE_PATTERN);
}
}
-
+
/**
*
* @param str
@@ -104,6 +103,26 @@
}
}
+ /**
+ * Get a Calendar object for a given Date representation
+ * @param date
+ * @return
+ */
+ public static Calendar getCal(final Date date) {
+ if (date == null) {
+ return null;
+ }
+ final Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ return blastTime(cal);
+ }
+
+ /**
+ * Converts a Set of Date objects to a Set of Calendar objects
+ *
+ * @param dates
+ * @return
+ */
public static Set<Calendar> toCalendarSet(final Set<Date> dates) {
final Set<Calendar> calendars = new HashSet<Calendar>();
for (final Date date : dates) {
@@ -112,6 +131,12 @@
return calendars;
}
+ /**
+ * Converts a Set of Calendar objects to a Set of Date objects
+ *
+ * @param calendars
+ * @return
+ */
public static Set<Date> toDateSet(final Set<Calendar> calendars) {
final Set<Date> dates = new HashSet<Date>();
@@ -121,6 +146,13 @@
return dates;
}
+ /**
+ * Converts a <code>List</code> of Calendar objects to a <code>List</code>
+ * of dates
+ *
+ * @param dates
+ * @return
+ */
public static List<Date> toDateList(final List<Calendar> dates) {
final List<Date> dateList = new ArrayList<Date>();
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-10 14:56:37 UTC (rev 146)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-10 15:18:53 UTC (rev 147)
@@ -24,6 +24,9 @@
* Immutable Working Week, default is Mon->Friday.
*
* @author Benoit Xhenseval
+ * @author $LastChangedBy$
+ * @version $Revision$ $Date$
+ *
*/
public class WorkingWeek {
private static final byte MONDAY = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-09-10 16:26:18
|
Revision: 153
http://svn.sourceforge.net/objectlabkit/?rev=153&view=rev
Author: marchy
Date: 2006-09-10 09:26:07 -0700 (Sun, 10 Sep 2006)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-10 16:18:07 UTC (rev 152)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-10 16:26:07 UTC (rev 153)
@@ -19,8 +19,10 @@
/**
* Interface that defines a financial market way of calculating difference in
- * days, month (or part of) and year (or part of). TODO Improve javadoc.
+ * days, month (or part of) and year (or part of).
*
+ * @TODO Improve javadoc.
+ *
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-10 16:18:07 UTC (rev 152)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java 2006-09-10 16:26:07 UTC (rev 153)
@@ -91,7 +91,7 @@
* true if working day
* @param dayOfWeek
* e.g. Calendar.MONDAY, Calendar.TUESDAY, etc
- * @return TODO
+ * @return a new instance of a <code>WorkingWeek</code> with the working day set
*/
public WorkingWeek withWorkingDayFromCalendar(final boolean working, final int dayOfWeek) {
final int day = adjustDay(dayOfWeek);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-11 11:56:24
|
Revision: 158
http://svn.sourceforge.net/objectlabkit/?rev=158&view=rev
Author: benoitx
Date: 2006-09-11 04:56:13 -0700 (Mon, 11 Sep 2006)
Log Message:
-----------
Better javadoc.
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/AbstractIMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.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/IMMDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -32,6 +32,9 @@
* @version $Revision$ $Date$
*
* @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public abstract class AbstractDateCalculator<E> implements DateCalculator<E> {
private static final int MONTHS_IN_YEAR = 12;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractIMMDateCalculator.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -30,6 +30,9 @@
* @version $Revision: 108 $ $Date: 2006-09-05 11:13:01 +0100 (Tue, 05 Sep 2006) $
*
* @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public abstract class AbstractIMMDateCalculator<E> implements IMMDateCalculator<E> {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -22,12 +22,16 @@
import java.util.concurrent.ConcurrentMap;
/**
- * @TODO javadoc
+ * Base class for all calculator factories, it handles the holiday registration.
*
* @author Marcin Jekot
* @author $LastChangedBy: benoitx $
* @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
*
+ * @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public abstract class AbstractKitCalculatorsFactory<E> implements KitCalculatorsFactory<E> {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -32,6 +32,11 @@
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
+ *
+ * @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public interface DateCalculator<E> {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/HolidayHandler.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -26,6 +26,9 @@
* @version $Revision$ $Date$
*
* @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public interface HolidayHandler<E> {
E moveCurrentDate(DateCalculator<E> date);
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/IMMDateCalculator.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -26,6 +26,10 @@
* @author Benoit Xhenseval
* @author $LastChangedBy: benoitx $
* @version $Revision: 109 $ $Date: 2006-09-05 12:16:39 +0100 (Tue, 05 Sep 2006) $
+ * @param <E>
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public interface IMMDateCalculator<E> {
/**
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -27,13 +27,14 @@
* NOT change even if a new set is registered; one needs to get a new
* DateCalculator to get the new set.
*
- * @param E
+ * @author Benoit Xhenseval
+ * @author $LastChangedBy: benoitx $
+ * @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
+ *
+ * @param <E>
* a representation of a date, typically JDK: Date, Calendar;
* Joda:LocalDate, YearMonthDay
*
- * @author Benoit Xhenseval
- * @author $LastChangedBy: benoitx $
- * @version $Revision: 125 $ $Date: 2006-09-07 19:24:20 +0200 (Thu, 07 Sep 2006) $
*/
public interface KitCalculatorsFactory<E> {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountCalculator.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -21,18 +21,16 @@
* Interface that defines a financial market way of calculating difference in
* days, month (or part of) and year (or part of).
*
- * @TODO Improve javadoc.
- *
* @author Benoit Xhenseval
* @author $LastChangedBy$
* @version $Revision$ $Date$
*
* @param <E>
- * a representation of "Date", typically Date, Calendar, LocalDate,
- * YearMonthDay.
+ * a representation of a date, typically JDK: Date, Calendar;
+ * Joda:LocalDate, YearMonthDay
+ *
*/
public interface PeriodCountCalculator<E> {
-
int YEAR_360 = 360;
int MONTHS_IN_YEAR = 12;
@@ -45,9 +43,33 @@
int MONTH_30_DAYS = 30;
+ /**
+ * This calculates the number of days between 2 dates, it follows the given basis which means that
+ * the result could vary between the same 2 dates if the basis is different.
+ * @param start the start date
+ * @param end the end date
+ * @param basis the basis to use
+ * @return number of days between end and start.
+ */
int dayDiff(final E start, final E end, PeriodCountBasis basis);
+ /**
+ * This calculates the number of months (or fraction) between 2 dates, it follows the given basis which means that
+ * the result could vary between the same 2 dates if the basis is different.
+ * @param start the start date
+ * @param end the end date
+ * @param basis the basis to use
+ * @return number of months between end and start.
+ */
double monthDiff(final E start, final E end, PeriodCountBasis basis);
+ /**
+ * This calculates the number of years (or fraction) between 2 dates, it follows the given basis which means that
+ * the result could vary between the same 2 dates if the basis is different.
+ * @param start the start date
+ * @param end the end date
+ * @param basis the basis to use
+ * @return number of months between end and start.
+ */
double yearDiff(final E start, final E end, PeriodCountBasis basis);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2006-09-11 11:17:54 UTC (rev 157)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2006-09-11 11:56:13 UTC (rev 158)
@@ -19,7 +19,7 @@
/**
* Holds only valid unit and TenorCode: Day, Week, Month, Year, IMM, Overnight,
- * TomNext, Spot, SpotNext, SpotWeek.
+ * Spot.
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2006-09-19 09:52:49
|
Revision: 186
http://svn.sourceforge.net/objectlabkit/?rev=186&view=rev
Author: benoitx
Date: 2006-09-19 02:52:41 -0700 (Tue, 19 Sep 2006)
Log Message:
-----------
javadoc corrections, based on the yDoc warning report.
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/AbstractKitCalculatorsFactory.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/KitCalculatorsFactory.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-18 20:27:22 UTC (rev 185)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2006-09-19 09:52:41 UTC (rev 186)
@@ -102,7 +102,7 @@
* 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
+ * @param tenor the tenor.
* @param spotLag
* number of days to "spot" days, this can vary from one market
* to the other.
@@ -219,20 +219,20 @@
* currentBusinessDate will be the ones from the existing calendar (not the
* parameter one). The name will be combined name1+"/"+calendar.getName().
*
- * @param calendar,
+ * @param calculator
* 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) {
+ public DateCalculator<E> combine(final DateCalculator<E> calculator) {
+ if (calculator == null || calculator == this) {
return this;
}
- if (holidayHandler == null && calendar.getHolidayHandlerType() != null || holidayHandler != null
- && !holidayHandler.getType().equals(calendar.getHolidayHandlerType())) {
+ if (holidayHandler == null && calculator.getHolidayHandlerType() != null || holidayHandler != null
+ && !holidayHandler.getType().equals(calculator.getHolidayHandlerType())) {
throw new IllegalArgumentException("Combined Calendars cannot have different handler types");
}
@@ -240,11 +240,11 @@
if (nonWorkingDays != null) {
newSet.addAll(nonWorkingDays);
}
- if (calendar.getNonWorkingDays() != null) {
- newSet.addAll(calendar.getNonWorkingDays());
+ if (calculator.getNonWorkingDays() != null) {
+ newSet.addAll(calculator.getNonWorkingDays());
}
- final DateCalculator<E> cal = createNewCalculator(getName() + "/" + calendar.getName(), getStartDate(), newSet,
+ final DateCalculator<E> cal = createNewCalculator(getName() + "/" + calculator.getName(), getStartDate(), newSet,
holidayHandler);
return cal;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-18 20:27:22 UTC (rev 185)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java 2006-09-19 09:52:41 UTC (rev 186)
@@ -45,7 +45,7 @@
*
* @param name
* the calendar name to register these holidays under.
- * @param holidays
+ * @param holidaysSet
* the set of holidays (non-working days).
*/
public void registerHolidays(final String name, final Set<E> holidaysSet) {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-18 20:27:22 UTC (rev 185)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2006-09-19 09:52:41 UTC (rev 186)
@@ -178,7 +178,7 @@
* currentBusinessDate will be the ones from the existing calendar (not the
* parameter one). The name will be combined name1+"/"+calendar.getName().
*
- * @param calendar,
+ * @param calculator
* return the same DateCalculator if calender is null or the
* original calendar (but why would you want to do that?)
* @throws IllegalArgumentException
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java 2006-09-18 20:27:22 UTC (rev 185)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/KitCalculatorsFactory.java 2006-09-19 09:52:41 UTC (rev 186)
@@ -45,7 +45,7 @@
* calendar name (holidays set interested in). If there is set of
* holidays with that name, it will return a DateCalculator with
* an empty holiday set (will work on Weekend only).
- * @param type
+ * @param holidayHandlerType
* typically one of the value of HolidayHandlerType or null.
* @return a new DateCalculator
* @exception IllegalArgumentException
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-18 20:27:22 UTC (rev 185)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2006-09-19 09:52:41 UTC (rev 186)
@@ -83,10 +83,10 @@
}
/**
- *
+ * get a new Calendar based on the string date.
* @param str
- * string
- * @return
+ * the date string
+ * @return a new Calendar
* @throws IllegalArgumentException
* if the string cannot be parsed.
*/
@@ -104,10 +104,10 @@
}
/**
- * Get a Calendar object for a given Date representation
+ * Get a Calendar object for a given Date representation.
*
* @param date
- * @return
+ * @return the Calendar
*/
public static Calendar getCal(final Date date) {
if (date == null) {
@@ -119,10 +119,10 @@
}
/**
- * Converts a Set of Date objects to a Set of Calendar objects
+ * Converts a Set of Date objects to a Set of Calendar objects.
*
* @param dates
- * @return
+ * @return the converted Set<Calendar>
*/
public static Set<Calendar> toCalendarSet(final Set<Date> dates) {
final Set<Calendar> calendars = new HashSet<Calendar>();
@@ -136,7 +136,7 @@
* Converts a Set of Calendar objects to a Set of Date objects
*
* @param calendars
- * @return
+ * @return the converset Set<Date>
*/
public static Set<Date> toDateSet(final Set<Calendar> calendars) {
@@ -152,7 +152,7 @@
* of dates
*
* @param dates
- * @return
+ * @return the converted List<Date>
*/
public static List<Date> toDateList(final List<Calendar> dates) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|