1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! The cashflow statistics definition.
// Copyright (c) 2021 ShiftLeft Software
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct ElemCashflowStats {
/// Number of current value events
current_values: usize,
/// Number of interest change events
interest_changes: usize,
/// Number of principal change events
principal_changes: usize,
/// Number of statistic value events
statistic_values: usize,
}
/// The cashflow statistics element implementation.
impl ElemCashflowStats {
/// Create and return a new cashflow statistics element.
///
/// # Arguments
///
/// * `current_values_param` - Number of current value events.
/// * `interest_changes_param` - Number of interest change events.
/// * `principal_changes_param` - Number of principal change events.
/// * `statistic_values_param` - Number of statistic value events.
///
/// # Return
///
/// * See description.
pub fn new(
current_values_param: usize,
interest_changes_param: usize,
principal_changes_param: usize,
statistic_values_param: usize,
) -> ElemCashflowStats {
ElemCashflowStats {
current_values: current_values_param,
interest_changes: interest_changes_param,
principal_changes: principal_changes_param,
statistic_values: statistic_values_param,
}
}
/// Return the number of current value events.
pub fn current_values(&self) -> usize {
self.current_values
}
/// Return the number of interest change events.
pub fn interest_changes(&self) -> usize {
self.interest_changes
}
/// Return the number of principal change events.
pub fn principal_changes(&self) -> usize {
self.principal_changes
}
/// Return the number of statistic value events.
pub fn statistic_values(&self) -> usize {
self.statistic_values
}
}