|
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. |