Table of Contents

Class ExtensionMethodsDebtUsableInCQLinq

Namespace
NDepend.TechnicalDebt
Assembly
NDepend.API.dll

This static class provides various extension methods related to Debt objects. These methods are usable in CQLinq expressions.

public static class ExtensionMethodsDebtUsableInCQLinq
Inheritance
ExtensionMethodsDebtUsableInCQLinq
Inherited Members

Methods (17)

AnnualInterestPercent(Debt, AnnualInterest)

Gets the estimated annual debt interest percent, expressed in percent per year.

public static double AnnualInterestPercent(this Debt debt, AnnualInterest annualInterest)

Parameters

debt Debt

The estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest

The cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

double

Remarks

The annual interest percent is equal to 100 multiplied by the annualInterest divided by the debt.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the debt annual interest percent is 20% per year.
Notice that an annual interest percent higher than 100% means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts Debt.Zero value for debt, in which case it returns zero. If debt is overflow or annualInterest is overflow this method returns 0.

See Also

AnnualInterestPercent(Debt, AnnualInterest?)

Gets the estimated annual debt interest percent, expressed in percent per year.

public static double? AnnualInterestPercent(this Debt debt, AnnualInterest? annualInterest)

Parameters

debt Debt

The estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest?

The nullable cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

double?
debt.AnnualInterestPercent(annualInterest.Value) if annualInterest is not null, else returns null.

Remarks

The annual interest percent is equal to 100 multiplied by the annualInterest divided by the debt.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the debt annual interest percent is 20% per year.
Notice that an annual interest percent higher than 100% means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts Debt.Zero value for debt, in which case it returns zero.

See Also

AnnualInterestPercent(Debt?, AnnualInterest)

Gets the estimated annual debt interest percent, expressed in percent per year.

public static double? AnnualInterestPercent(this Debt? debt, AnnualInterest annualInterest)

Parameters

debt Debt?

The nullable estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest

The cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

double?
debt.Value.AnnualInterestPercent(annualInterest) if debt is not null, else returns null.

Remarks

The annual interest percent is equal to 100 multiplied by the annualInterest divided by the debt.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the debt annual interest percent is 20% per year.
Notice that an annual interest percent higher than 100% means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts Debt.Zero value for debt, in which case it returns zero.

See Also

AnnualInterestPercent(Debt?, AnnualInterest?)

Gets the estimated annual debt interest percent, expressed in percent per year.

public static double? AnnualInterestPercent(this Debt? debt, AnnualInterest? annualInterest)

Parameters

debt Debt?

The nullable estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest?

The nullable cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

double?
debt.Value.AnnualInterestPercent(annualInterest.Value) if both debt and annualInterest are not null, else returns null.

Remarks

The annual interest percent is equal to 100 multiplied by the annualInterest divided by the debt.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the debt annual interest percent is 20% per year.
Notice that an annual interest percent higher than 100% means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts Debt.Zero value for debt, in which case it returns zero.

See Also

BreakingPoint(Debt, AnnualInterest)

Gets the time point from now when the estimated cost-to-not-fix the debt will reach the estimated cost-to-fix the debt. This time point is named the breaking point.

public static TimeSpan BreakingPoint(this Debt debt, AnnualInterest annualInterest)

Parameters

debt Debt

The estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest

The estimated cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

TimeSpan

Remarks

The breaking point is the debt divided by the annualInterest.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the breaking point is equal to 5 years from now.
Notice that a breaking point lower than a year means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts AnnualInterest.Zero value for annualInterest, in which case it returns TimeSpan.Zero. If annualInterest is zero, then this method returns a zero TimeSpan.
If the division leads to a too large value to be handled by TimeSpan, this method will return TimeSpan.MaxValue or TimeSpan.MinValue depending on the sign of the too large value.
If debt is overflow or annualInterest is overflow this method returns TimeSpan.Zero.

See Also

BreakingPoint(Debt, AnnualInterest?)

Gets the time point from now when the estimated cost-to-not-fix the debt will reach the estimated cost-to-fix the debt. This time point is named the breaking point.

public static TimeSpan? BreakingPoint(this Debt debt, AnnualInterest? annualInterest)

Parameters

debt Debt

The estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest?

The nullable cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

TimeSpan?
debt.BreakingPoint(annualInterest.Value) if annualInterest is not null, else returns null.

Remarks

The breaking point is the debt divided by the annualInterest.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the breaking point is equal to 5 years from now.
Notice that a breaking point lower than a year means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts AnnualInterest.Zero value for annualInterest, in which case it returns TimeSpan.Zero.

See Also

BreakingPoint(Debt?, AnnualInterest)

Gets the time point from now when the estimated cost-to-not-fix the debt will reach the estimated cost-to-fix the debt. This time point is named the breaking point.

public static TimeSpan? BreakingPoint(this Debt? debt, AnnualInterest annualInterest)

Parameters

debt Debt?

The nullable estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest

The cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

TimeSpan?
debt.Value.BreakingPoint(annualInterest) if debt is not null, else returns null.

Remarks

The breaking point is the debt divided by the annualInterest.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the breaking point is equal to 5 years from now.
Notice that a breaking point lower than a year means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts AnnualInterest.Zero value for annualInterest, in which case it returns TimeSpan.Zero.

See Also

BreakingPoint(Debt?, AnnualInterest?)

Gets the time point from now when the estimated cost-to-not-fix the debt will reach the estimated cost-to-fix the debt. This time point is named the breaking point.

public static TimeSpan? BreakingPoint(this Debt? debt, AnnualInterest? annualInterest)

Parameters

debt Debt?

The nullable estimated cost-to-fix a set of issues, it can be negative in case of debt-diff value.

annualInterest AnnualInterest?

The nullable cost-to-not-fix per year a set of issue, it can be negative in case of annual-interest-diff value.

Returns

TimeSpan?
debt.Value.BreakingPoint(annualInterest.Value) if both debt and annualInterest are not null, else returns null.

Remarks

The breaking point is the debt divided by the annualInterest.
For example if the estimated cost-to-fix the debt is equal to 10 man-days, and the estimated cost-to-not-fix the debt is equal to 2 man-days per year (this is the annualInterest) then the breaking point is equal to 5 years from now.
Notice that a breaking point lower than a year means that during the next 12 monthes, it would be cheaper to fix the debt than not to fix it.
This method accepts AnnualInterest.Zero value for annualInterest, in which case it returns TimeSpan.Zero.

See Also

Sum(IEnumerable<AnnualInterest>)

Sum the values of all AnnualInterest values in the sequence seq.

public static AnnualInterest Sum(this IEnumerable<AnnualInterest> seq)

Parameters

seq IEnumerable<AnnualInterest>

This sequence that contains AnnualInterest values to sum

Returns

AnnualInterest

Sum(IEnumerable<Debt>)

Sum the values of all Debt values in the sequence seq.

public static Debt Sum(this IEnumerable<Debt> seq)

Parameters

seq IEnumerable<Debt>

This sequence that contains Debt values to sum

Returns

Debt

Sum<T>(IEnumerable<T>, Func<T, AnnualInterest>)

Sum the values of all AnnualInterest values obtained from elements of the sequence seq through the function projecter.

public static AnnualInterest Sum<T>(this IEnumerable<T> seq, Func<T, AnnualInterest> projecter)

Parameters

seq IEnumerable<T>

This sequence that contains objects that are projected to AnnualInterest values to sum, through the function projecter

projecter Func<T, AnnualInterest>

The function that projects T objects to AnnualInterest values

Returns

AnnualInterest

Type Parameters

T

The generic type of elements of seq

Sum<T>(IEnumerable<T>, Func<T, Debt>)

Sum the values of all Debt values obtained from elements of the sequence seq through the function projecter.

public static Debt Sum<T>(this IEnumerable<T> seq, Func<T, Debt> projecter)

Parameters

seq IEnumerable<T>

This sequence that contains objects that are projected to Debt values to sum, through the function projecter

projecter Func<T, Debt>

The function that projects T objects to Debt values

Returns

Debt

Type Parameters

T

The generic type of elements of seq

ToAnnualInterest(TimeSpan?)

Returns an AnnualInterest value from a nullableTimeSpan value.

public static AnnualInterest ToAnnualInterest(this TimeSpan? nullableTimeSpan)

Parameters

nullableTimeSpan TimeSpan?

The input nullableTimeSpan value.

Returns

AnnualInterest

Remarks

if nullableTimeSpan is null, AnnualInterest.Zero is returned.

ToAnnualInterest(TimeSpan)

Returns an AnnualInterest value from a TimeSpan value.

public static AnnualInterest ToAnnualInterest(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The input TimeSpan value.

Returns

AnnualInterest

ToChar(DebtRating)

Convert the debtRating to a 'A' 'B' 'C' 'D' 'E' char.

public static char ToChar(this DebtRating debtRating)

Parameters

debtRating DebtRating

The DebtRating value.

Returns

char

ToDebt(TimeSpan?)

Returns a Debt value from a nullableTimeSpan value.

public static Debt ToDebt(this TimeSpan? nullableTimeSpan)

Parameters

nullableTimeSpan TimeSpan?

The input nullableTimeSpan value.

Returns

Debt

Remarks

if nullableTimeSpan is null, Debt.Zero is returned.

ToDebt(TimeSpan)

Returns a Debt value from a TimeSpan value.

public static Debt ToDebt(this TimeSpan timeSpan)

Parameters

timeSpan TimeSpan

The input TimeSpan value.

Returns

Debt