net.sourceforge.agora.simulator.control.analysis
Class AnalysisDate

java.lang.Object
  extended by net.sourceforge.agora.simulator.control.analysis.AnalysisDate

public class AnalysisDate
extends java.lang.Object

The Class AnalysisDate.


Constructor Summary
AnalysisDate(AnalysisDate copy)
          Instantiates a new analysis date.
AnalysisDate(java.util.Date date, int basis)
          Instantiates a new analysis date.
 
Method Summary
 void addMonths(int monthCount)
          Adds the months.
 boolean eq(AnalysisDate compareDate)
          Eq.
 int getActualEOMCount(int frequency)
          Gets the actual eom count.
static double getAverageYearLength(int startYear, int endYear)
          Gets the average year length.
 AnalysisDate getDate()
          Gets the date.
 int getDay()
          Gets the day.
static int getDaysInYear(AnalysisDate date, int basis)
          Gets the days in year.
static int getDaysInYears(int fromYear, int toYear)
          Gets the days in years.
static int getDiff(AnalysisDate startDate, AnalysisDate endDate)
          Gets the diff.
static int getDiff(AnalysisDate startDate, AnalysisDate endDate, boolean forceThirty)
          Gets the diff.
static int getLastDayOfMonth(int month, int year)
          Gets the last day of month.
 int getMonth()
          Gets the month.
 int getOriginalDay()
          Gets the original day.
 int getYear()
          Gets the year.
static double getYearfrac(AnalysisDate startDate, AnalysisDate endDate, int basis)
          Gets the yearfrac.
 boolean gt(AnalysisDate compareDate)
          Gt.
 boolean isLastDay()
          Checks if is last day.
static boolean isLeapYear(int i)
          Checks if is leap year.
 boolean isThirtyDays()
          Checks if is thirty days.
 boolean le(AnalysisDate compareDate)
          Le.
 boolean lt(AnalysisDate compareDate)
          Lt.
 void setDay(int day)
          Sets the day.
 void setMonth(int month)
          Sets the month.
 void setOriginalday(int originalday)
          Sets the originalday.
 void setYear(int year)
          Sets the year.
static boolean shouldCountFeb29(AnalysisDate startDate, AnalysisDate endDate)
          Should count feb29.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalysisDate

public AnalysisDate(java.util.Date date,
                    int basis)
Instantiates a new analysis date.

Parameters:
date - the date
basis - the basis

AnalysisDate

public AnalysisDate(AnalysisDate copy)
Instantiates a new analysis date.

Parameters:
copy - the copy
Method Detail

getLastDayOfMonth

public static int getLastDayOfMonth(int month,
                                    int year)
Gets the last day of month.

Parameters:
month - the month
year - the year
Returns:
the last day of month

isLeapYear

public static boolean isLeapYear(int i)
Checks if is leap year.

Parameters:
i - the i
Returns:
true, if is leap year

lt

public boolean lt(AnalysisDate compareDate)
Lt.

Parameters:
compareDate - the compare date
Returns:
true, if successful

le

public boolean le(AnalysisDate compareDate)
Le.

Parameters:
compareDate - the compare date
Returns:
true, if successful

eq

public boolean eq(AnalysisDate compareDate)
Eq.

Parameters:
compareDate - the compare date
Returns:
true, if successful

gt

public boolean gt(AnalysisDate compareDate)
Gt.

Parameters:
compareDate - the compare date
Returns:
true, if successful

addMonths

public void addMonths(int monthCount)
Adds the months.

Parameters:
monthCount - the month count

getDiff

public static int getDiff(AnalysisDate startDate,
                          AnalysisDate endDate)
Gets the diff.

Parameters:
startDate - the start date
endDate - the end date
Returns:
the diff

getDiff

public static int getDiff(AnalysisDate startDate,
                          AnalysisDate endDate,
                          boolean forceThirty)
Gets the diff.

Parameters:
startDate - the start date
endDate - the end date
forceThirty - the force thirty
Returns:
the diff

getDaysInYears

public static int getDaysInYears(int fromYear,
                                 int toYear)
Gets the days in years.

Parameters:
fromYear - the from year
toYear - the to year
Returns:
the days in years

getOriginalDay

public int getOriginalDay()
Gets the original day.

Returns:
the original day

setOriginalday

public void setOriginalday(int originalday)
Sets the originalday.

Parameters:
originalday - the new originalday

getDay

public int getDay()
Gets the day.

Returns:
the day

setDay

public void setDay(int day)
Sets the day.

Parameters:
day - the new day

getMonth

public int getMonth()
Gets the month.

Returns:
the month

setMonth

public void setMonth(int month)
Sets the month.

Parameters:
month - the new month

getYear

public int getYear()
Gets the year.

Returns:
the year

setYear

public void setYear(int year)
Sets the year.

Parameters:
year - the new year

isThirtyDays

public boolean isThirtyDays()
Checks if is thirty days.

Returns:
true, if is thirty days

getDate

public AnalysisDate getDate()
Gets the date.

Returns:
the date

getDaysInYear

public static int getDaysInYear(AnalysisDate date,
                                int basis)
                         throws java.lang.Exception
Gets the days in year.

Parameters:
date - the date
basis - the basis
Returns:
the days in year
Throws:
java.lang.Exception - the exception

isLastDay

public boolean isLastDay()
Checks if is last day.

Returns:
true, if is last day

shouldCountFeb29

public static boolean shouldCountFeb29(AnalysisDate startDate,
                                       AnalysisDate endDate)
Should count feb29.

Parameters:
startDate - the start date
endDate - the end date
Returns:
true, if successful

getActualEOMCount

public int getActualEOMCount(int frequency)
Gets the actual eom count.

Parameters:
frequency - the frequency
Returns:
the actual eom count

getYearfrac

public static double getYearfrac(AnalysisDate startDate,
                                 AnalysisDate endDate,
                                 int basis)
Gets the yearfrac.

Parameters:
startDate - the start date
endDate - the end date
basis - the basis
Returns:
the yearfrac

getAverageYearLength

public static double getAverageYearLength(int startYear,
                                          int endYear)
Gets the average year length.

Parameters:
startYear - the start year
endYear - the end year
Returns:
the average year length