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
//! The current value 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 ElemCurrentValue {
/// Adjust successive dates to end of month.
eom: bool,
/// Do not affect the remaining cashflow.
passive: bool,
/// Designate as present value.
present: bool,
}
/// The current value implementation.
impl ElemCurrentValue {
/// Create a new current value element.
///
/// # Arguments
///
/// * `eom_param` - End-of-month.
/// * `passive_param` - Passive current value.
/// * `present_param` - Present current value.
///
/// # Return
///
/// * See description.
pub fn new(eom_param: bool, passive_param: bool, present_param: bool) -> ElemCurrentValue {
ElemCurrentValue {
eom: eom_param,
passive: passive_param,
present: present_param,
}
}
/// Copy this current value element as a new current value element.
///
/// # Return
///
/// * See description.
pub fn copy(&self) -> ElemCurrentValue {
ElemCurrentValue::new(self.eom, self.passive, self.present)
}
/// Tests if this current value object and another are equal.
///
/// # Arguments
///
/// * `elem_current_value` - Object to compare.
///
/// # Return
///
/// * True if equals, otherwise false.
pub fn equal(&self, elem_current_value: &ElemCurrentValue) -> bool {
self.eom == elem_current_value.eom
&& self.passive == elem_current_value.passive
&& self.present == elem_current_value.present
}
/// Get the value to adjust successive dates to end of month.
///
/// # Return
///
/// * See description.
pub fn eom(&self) -> bool {
self.eom
}
/// Get the value to not affect the remaining cashflow.
///
/// # Return
///
/// * See description.
pub fn passive(&self) -> bool {
self.passive
}
/// Get the value to designate as present value.
///
/// # Return
///
/// * See description.
pub fn present(&self) -> bool {
self.present
}
/// Set the value to adjust successive dates to end of month.
///
/// # Arguments
///
/// * `param` - See description.
pub fn set_eom(&mut self, param: bool) {
self.eom = param;
}
/// Set the value to not affect the remaining cashflow.
///
/// # Arguments
///
/// * `param` - See description.
pub fn set_passive(&mut self, param: bool) {
self.passive = param;
}
/// Set the value to designate as present value.
///
/// # Arguments
///
/// * `param` - See description.
pub fn set_present(&mut self, param: bool) {
self.present = param;
}
}