|
double | getToDepreciate (double investment, Date initialDate, Date finalDate) |
|
◆ daysBetween()
static double org.turro.financials.model.asset.DepreciationMap.daysBetween |
( |
Date |
d1, |
|
|
Date |
d2 |
|
) |
| |
|
static |
◆ getToDepreciate()
double org.turro.financials.model.asset.DepreciationMap.getToDepreciate |
( |
double |
investment, |
|
|
Date |
initialDate, |
|
|
Date |
finalDate |
|
) |
| |
Definition at line 30 of file DepreciationMap.java.
31 double toDepreciate = 0.0;
32 Date initialPeriod =
null;
33 DepreciationEntry de =
null;
34 for(Date finalPeriod : keySet()) {
35 if(finalPeriod.after(finalDate)) {
38 if(de !=
null && initialPeriod !=
null) {
39 Date range[] = DateRange.getFinalRange(initialDate, finalDate, initialPeriod, finalPeriod);
41 toDepreciate +=
daysBetween(range[0], range[1]) * (investment * (de.getPercent() / 365.0 / 100.0));
49 de =
get(finalPeriod);
50 initialPeriod = finalPeriod;
52 if(de !=
null && initialPeriod !=
null) {
53 Date range[] = DateRange.getFinalRange(initialDate, finalDate, initialPeriod, finalDate);
55 toDepreciate +=
daysBetween(range[0], range[1]) * (investment * (de.getPercent() / 365.0 / 100.0));
63 return Math.abs(toDepreciate) <= Math.abs(investment) ? toDepreciate : investment;
static double daysBetween(Date d1, Date d2)
The documentation for this class was generated from the following file: