BrightSide Workbench Full Report + Source Code
org.turro.financials.model.asset.DepreciationMap Class Reference
Inheritance diagram for org.turro.financials.model.asset.DepreciationMap:
Collaboration diagram for org.turro.financials.model.asset.DepreciationMap:

Public Member Functions

double getToDepreciate (double investment, Date initialDate, Date finalDate)
 

Static Public Member Functions

static double daysBetween (Date d1, Date d2)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 28 of file DepreciationMap.java.

Member Function Documentation

◆ daysBetween()

static double org.turro.financials.model.asset.DepreciationMap.daysBetween ( Date  d1,
Date  d2 
)
static

Definition at line 67 of file DepreciationMap.java.

67  {
68  return ( (d2.getTime() - d1.getTime() + ONE_HOUR) /
69  (ONE_HOUR * 24));
70  }
Here is the caller graph for this function:

◆ getToDepreciate()

double org.turro.financials.model.asset.DepreciationMap.getToDepreciate ( double  investment,
Date  initialDate,
Date  finalDate 
)

Definition at line 30 of file DepreciationMap.java.

30  {
31  double toDepreciate = 0.0;
32  Date initialPeriod = null;
33  DepreciationEntry de = null;
34  for(Date finalPeriod : keySet()) {
35  if(finalPeriod.after(finalDate)) {
36  break;
37  }
38  if(de != null && initialPeriod != null) {
39  Date range[] = DateRange.getFinalRange(initialDate, finalDate, initialPeriod, finalPeriod);
40  if(range != null) {
41  toDepreciate += daysBetween(range[0], range[1]) * (investment * (de.getPercent() / 365.0 / 100.0));
42  }
43 // if(initialDate == null || initialPeriod.after(initialDate)) {
44 // toDepreciate += daysBetween(initialPeriod, finalPeriod) * (investment * (de.getPercent() / 365.0 / 100.0));
45 // } else if((initialPeriod.before(initialDate) || initialPeriod.equals(initialDate)) && finalPeriod.after(initialDate)) {
46 // toDepreciate += daysBetween(initialDate, finalPeriod) * (investment * (de.getPercent() / 365.0 / 100.0));
47 // }
48  }
49  de = get(finalPeriod);
50  initialPeriod = finalPeriod;
51  }
52  if(de != null && initialPeriod != null) {
53  Date range[] = DateRange.getFinalRange(initialDate, finalDate, initialPeriod, finalDate);
54  if(range != null) {
55  toDepreciate += daysBetween(range[0], range[1]) * (investment * (de.getPercent() / 365.0 / 100.0));
56  }
57 // if(initialDate == null || initialPeriod.after(initialDate)) {
58 // toDepreciate += daysBetween(initialPeriod, finalDate) * (investment * (de.getPercent() / 365.0 / 100.0));
59 // } else if((initialPeriod.before(initialDate) || initialPeriod.equals(initialDate)) && finalDate.after(initialDate)) {
60 // toDepreciate += daysBetween(initialDate, finalDate) * (investment * (de.getPercent() / 365.0 / 100.0));
61 // }
62  }
63  return Math.abs(toDepreciate) <= Math.abs(investment) ? toDepreciate : investment;
64  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: