C# Class HandCoded.Finance.Calendar

Calendar instances implement the rules for determining if a Date is a business day in the location it represents.

The rules for public holidays vary from country to country but with the exception of special occaisions (e.g. royal weddings, funerals, etc.) can usually be predicted years in advance.

On first reference this class bootstraps an initial set of Calendar instances by processing a XML data file.
显示文件 Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Public Methods

Method Description
ForName ( string name ) : Calendar

If a Calendar with the given name exists in the extent set then a reference to it is returned to the caller.

IsBusinessDay ( Date date ) : bool

Determines if the Date provided falls on a business day in this Calendar (e.g. not a holiday or weekend).

ToString ( ) : string

Produces a debugging string describing the instance.

Protected Methods

Method Description
Calendar ( string name ) : System

Constructs a Calendar instance with a given name.

ToDebug ( ) : string

Produces a debugging string describing the state of the instance.

Private Methods

Method Description
Calendar ( ) : System

Initialises the Calendar cache by parsing a standard set of definitions held in a XML file distributed with the toolkit.

ConvertMonth ( string name ) : int
ConvertWeekday ( string name ) : int
ConvertWhen ( string name ) : int
ParseCalendars ( string uri ) : void

Parses the XML data file indicated by the URI to extract default sets of calendars.

Method Details

Calendar() protected method

Constructs a Calendar instance with a given name.
protected Calendar ( string name ) : System
name string The reference name for the instance.
return System

ForName() public static method

If a Calendar with the given name exists in the extent set then a reference to it is returned to the caller.
public static ForName ( string name ) : Calendar
name string The required Calendar name.
return Calendar

IsBusinessDay() public abstract method

Determines if the Date provided falls on a business day in this Calendar (e.g. not a holiday or weekend).
public abstract IsBusinessDay ( Date date ) : bool
date Date The to be tested.
return bool

ToDebug() protected method

Produces a debugging string describing the state of the instance.
protected ToDebug ( ) : string
return string

ToString() public method

Produces a debugging string describing the instance.
public ToString ( ) : string
return string