C# Class HandCoded.Finance.Interval

An Interval is a length of time expressed as an integer multiple of some Period, for example five days or three months.
Exibir arquivo Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Public Methods

Method Description
DividesDates ( Date first, Date last ) : bool

Determines if an Interval will divide the time period delimited by two dates exactly.

Equals ( Interval other ) : bool

Compares two Interval instance to see if they contain the same information.

This routine takes into account the equivalence of certain time intervals (e.g. 1Y = 12M and 1W = 7D).

Equals ( object other ) : bool

Compares an Interval instance with another object to see if they contain the same information.

This routine takes into account the equivalence of certain time intervals (e.g. 1Y = 12M and 1W = 7D).

GetHashCode ( ) : int

Produces a hash value for the instance.

Interval ( int multiplier, Period period ) : System

Constructs an Interval from the provided multiplier and time unit.

Interval ( int multiplier, string code ) : System

Constructs an Interval from the provided multiplier and time unit code.

IsMultipleOf ( Interval other ) : bool

Determines if this Interval is an integer multiple of another.

The calculation recognises that a week is seven days and that a year is twelve months. It also allows 1T to match any time period longer than a day and for any time period to be a multiple of 1 day.

Plus ( Interval other ) : Interval

Calculates the result of adding another Interval to this one.

ToString ( ) : string

Creates a debugging string describing the instance.

Method Details

DividesDates() public method

Determines if an Interval will divide the time period delimited by two dates exactly.
public DividesDates ( Date first, Date last ) : bool
first Date The first date.
last Date The last date.
return bool

Equals() public method

Compares two Interval instance to see if they contain the same information.
This routine takes into account the equivalence of certain time intervals (e.g. 1Y = 12M and 1W = 7D).
public Equals ( Interval other ) : bool
other Interval The other Interval instance.
return bool

Equals() public method

Compares an Interval instance with another object to see if they contain the same information.
This routine takes into account the equivalence of certain time intervals (e.g. 1Y = 12M and 1W = 7D).
public Equals ( object other ) : bool
other object The to compare with.
return bool

GetHashCode() public method

Produces a hash value for the instance.
public GetHashCode ( ) : int
return int

Interval() public method

Constructs an Interval from the provided multiplier and time unit.
public Interval ( int multiplier, Period period ) : System
multiplier int The time period multiplier.
period Period The time period unit.
return System

Interval() public method

Constructs an Interval from the provided multiplier and time unit code.
public Interval ( int multiplier, string code ) : System
multiplier int The time period unit multiplier.
code string The timer period unit code
return System

IsMultipleOf() public method

Determines if this Interval is an integer multiple of another.
The calculation recognises that a week is seven days and that a year is twelve months. It also allows 1T to match any time period longer than a day and for any time period to be a multiple of 1 day.
public IsMultipleOf ( Interval other ) : bool
other Interval The other Interval instance.
return bool

Plus() public method

Calculates the result of adding another Interval to this one.
If the two time periods /// cannot be combined.
public Plus ( Interval other ) : Interval
other Interval The Interval to add.
return Interval

ToString() public method

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