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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
//! The principal change definition of an event.
// 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 ElemPrincipalChange {
/// Principal change type.
pc_type: crate::PrincipalType,
/// Adjust successive dates to end of month.
eom: bool,
/// Apply change to principal balance first for simple interest.
principal_first: bool,
/// Mark as balance result statistics.
balance_statistics: bool,
/// Mark as auxiliary principal change event.
auxiliary: bool,
/// Mark as auxiliary passive principal change event.
aux_passive: bool,
}
/// The principal change implementation.
impl ElemPrincipalChange {
/// Create a new principal change element.
///
/// # Arguments
///
/// * `type_param` - Principal change type.
/// * `eom_param` - End-of-month.
/// * `principal_first_param` - Principal first.
/// * `balance_statistics_param` - Balance statistics.
/// * `auxiliary_param` - Auxiliary parameter.
/// * `aux_passive_param` - Auxiliary passive.
///
/// # Return
///
/// * See description.
pub fn new(
type_param: crate::PrincipalType,
eom_param: bool,
principal_first_param: bool,
balance_statistics_param: bool,
auxiliary_param: bool,
aux_passive_param: bool,
) -> ElemPrincipalChange {
ElemPrincipalChange {
pc_type: type_param,
eom: eom_param,
principal_first: principal_first_param,
balance_statistics: balance_statistics_param,
auxiliary: auxiliary_param,
aux_passive: aux_passive_param,
}
}
/// Copy this principal change element as a new principal change element.
///
/// # Return
///
/// * See description.
pub fn copy(&self) -> ElemPrincipalChange {
ElemPrincipalChange::new(
self.pc_type,
self.eom,
self.principal_first,
self.balance_statistics,
self.auxiliary,
self.aux_passive,
)
}
/// Tests if this principal change object and another are equal.
///
/// # Arguments
///
/// * `objElemPrincipalChange` - Object to compare.
/// # Return
///
/// * True if equals, otherwise false.
pub fn equal(&self, elem_principal_change: &ElemPrincipalChange) -> bool {
self.pc_type == elem_principal_change.pc_type
&& self.eom == elem_principal_change.eom
&& self.principal_first == elem_principal_change.principal_first
&& self.balance_statistics == elem_principal_change.balance_statistics
&& self.auxiliary == elem_principal_change.auxiliary
&& self.aux_passive == elem_principal_change.aux_passive
}
/// Get the principal change type.
///
/// # Return
///
/// * See description.
///
pub fn pc_type(&self) -> crate::PrincipalType {
self.pc_type
}
/// Get the value of adjust successive dates to end of month.
///
/// # Return
///
/// * See description.
pub fn eom(&self) -> bool {
self.eom
}
/// Get the value of apply change to principal balance first for simple interest.
///
/// # Return
///
/// * See description.
pub fn principal_first(&self) -> bool {
self.principal_first
}
/// Get the value of include with balance result statistics.
///
/// # Return
///
/// * See description.
pub fn balance_statistics(&self) -> bool {
self.balance_statistics
}
/// Get the auxiliary principal change event.
///
/// # Return
///
/// * See description.
pub fn auxiliary(&self) -> bool {
self.auxiliary
}
/// Get the auxiliary passive principal change event.
///
/// # Return
///
/// * See description.
pub fn aux_passive(&self) -> bool {
self.aux_passive
}
/// Set the principal change type.
///
/// # Arguments
///
/// * `type_param` - See description.
///
pub fn set_type(&mut self, type_param: crate::PrincipalType) {
self.pc_type = type_param;
}
/// Set the value of adjust successive dates to end of month.
///
/// # Arguments
///
/// * `eom_param` - See description.
pub fn set_eom(&mut self, eom_param: bool) {
self.eom = eom_param;
}
/// Set the value of apply change to principal balance first for simple interest.
///
/// # Arguments
///
/// * `principal_first_param` - See description.
pub fn set_principal_first(&mut self, principal_first_param: bool) {
self.principal_first = principal_first_param;
}
/// Set the value of include with balance result statistics.
///
/// # Arguments
///
/// * `balance_statistics_param` - See description.
pub fn set_balance_statistics(&mut self, balance_statistics_param: bool) {
self.balance_statistics = balance_statistics_param;
}
/// Set the auxiliary principal change event.
///
/// # Arguments
///
/// * `auxiliary_param` - See description.
pub fn set_auxiliary(&mut self, auxiliary_param: bool) {
self.auxiliary = auxiliary_param;
}
/// Set the auxiliary passive principal change event.
///
/// # Arguments
///
/// * `aux_passive_param` - See description.
pub fn set_aux_passive(&mut self, aux_passive_param: bool) {
self.aux_passive = aux_passive_param;
}
}