Struct amfnengine::engine::calc_engine::CalcEngine
[−]pub struct CalcEngine { /* private fields */ }
Implementations
impl CalcEngine
impl CalcEngine
The main implementation of the AmFn engine component.
pub fn new() -> CalcEngine
pub fn new() -> CalcEngine
pub fn calc_manager(&self) -> &Rc<RefCell<CalcManager>>
pub fn calc_manager(&self) -> &Rc<RefCell<CalcManager>>
pub fn calc_mgr(&self) -> Ref<'_, CalcManager>
pub fn calc_mgr(&self) -> Ref<'_, CalcManager>
pub fn calc_mgr_mut(&self) -> RefMut<'_, CalcManager>
pub fn calc_mgr_mut(&self) -> RefMut<'_, CalcManager>
pub fn init_engine(&self, locale_str_param: &str)
pub fn init_engine(&self, locale_str_param: &str)
pub fn init_cashflow(&self, index: u32) -> bool
pub fn init_cashflow(&self, index: u32) -> bool
pub fn copy(&self, cashflow: bool) -> CalcEngine
pub fn copy(&self, cashflow: bool) -> CalcEngine
pub fn balance_cashflow(&self) -> Result<ElemBalanceResult, ErrorType>
pub fn balance_cashflow(&self) -> Result<ElemBalanceResult, ErrorType>
Performs primary calculations on a cashflow. Passes through an entire cashflow calculating the interest, accrued interest balance and balance for each event within the cashflow. This method directly handles the rule of 78 and subsequently compresses the cashflow.
Return
- The results from this method or an error code.
pub fn calculate_yield(&self) -> Result<ElemBalanceResult, ErrorType>
pub fn calculate_yield(&self) -> Result<ElemBalanceResult, ErrorType>
Calculates the value for an overall yield (i.e., APR). Calculates an overall yield value that will satisfy the condition that the remaining balance of the cashflow is the smallest amount greater than or equal to the given parameter value.
Return
- The results from this method or an error code.
pub fn calculate_value(&self) -> Result<ElemBalanceResult, ErrorType>
pub fn calculate_value(&self) -> Result<ElemBalanceResult, ErrorType>
Calculates the value for an event. Calculates either an interest amount or a principal amount (depending upon the selected event type) that will satisfy the condition that the remaining balance of the cashflow is the smallest amount greater than or equal to the given parameter value.
Return
- The results from this method or an error code.
pub fn calculate_periods(&self) -> Result<ElemBalanceResult, ErrorType>
pub fn calculate_periods(&self) -> Result<ElemBalanceResult, ErrorType>
Calculates the periods for an event. Calculates the number of periods that will satisfy the condition that the remaining balance of the cashflow is the smallest amount greater than or equal to the given parameter value.
Return
- The results from this method or an error code.
pub fn combine_cashflow(
&self,
name2_param: &str,
new_name_param: &str,
new_group_param: &str
) -> Result<ElemBalanceResult, ErrorType>
pub fn combine_cashflow(
&self,
name2_param: &str,
new_name_param: &str,
new_group_param: &str
) -> Result<ElemBalanceResult, ErrorType>
Combines the principal change events from two amortization element lists into a new amortization element list, compresses the list and transforms the compressed list into a new event list. All events except principal change and interest change events are discarded.
Arguments
name2_param
- The name of the second cashflow to combine.new_name_param
- The name of the new cashflow.new_group_param
- The optional name of the new template group or empty.
Return
- The results from this method or an error code.
pub fn merge_cashflow(
&self,
name2_param: &str,
new_name_param: &str,
new_group_param: &str,
interest_event_action: MergeType
) -> Result<ElemBalanceResult, ErrorType>
pub fn merge_cashflow(
&self,
name2_param: &str,
new_name_param: &str,
new_group_param: &str,
interest_event_action: MergeType
) -> Result<ElemBalanceResult, ErrorType>
Merges the events of two cashflows into a new cashflow according to order defined by intDate and intSort with a bias towards the first cashflow given equal sort keys. All events except principal change and interest change events are discarded.
Arguments
name2_param
- The name of the second cashflow to merge.new_name_param
- The name of the new cashflow.new_group_param
- The optional name of the new template group or empty.interest_event_action
- The action to be performed when interest events are encountered.
Return
- The results from this method or an error code.
pub fn split_cashflow(
&self,
all_events: bool
) -> Result<ElemBalanceResult, ErrorType>
pub fn split_cashflow(
&self,
all_events: bool
) -> Result<ElemBalanceResult, ErrorType>
Splits the currently selected principal change event into multiple principal change events whenever an active event is seen in the event list that is between the start and end dates of the principal change event.
Arguments
all_events
- If true split the principal change event when any active event is seen (otherwise only split the principal change event when an interest change event is seen).
Return
- The results from this method or an error code.
pub fn transform_cashflow(
&self,
new_name_param: &str,
new_group_param: &str,
after_pv: bool,
omit_interest_events: bool
) -> Result<ElemBalanceResult, ErrorType>
pub fn transform_cashflow(
&self,
new_name_param: &str,
new_group_param: &str,
after_pv: bool,
omit_interest_events: bool
) -> Result<ElemBalanceResult, ErrorType>
Transform the amortization list by creating an event list composed of events that are either before the current value present event (if after_pv is false) or after the current value present event (if after_pv is true). The current value present event itself is transformed into a principal change event.
Arguments
new_name_param
- The name of the new cashflow.new_group_param
- The optional name of the new template group or empty.after_pv
- If true transform the events after the current value present event. Otherwise, transform the events before the current value present event.omit_interest_events
- If true the interest events are eliminated from the resulting event list.
Return
- The results from this method or an error code.
pub fn create_cashflow_output(
&self,
include_rollups: bool,
include_details: bool,
compress_descriptor: bool,
omit_statistic_events: bool
) -> Result<ListAmortization, ErrorType>
pub fn create_cashflow_output(
&self,
include_rollups: bool,
include_details: bool,
compress_descriptor: bool,
omit_statistic_events: bool
) -> Result<ListAmortization, ErrorType>
Create a cashflow for output from the currently selected cashflow. Create the cashflow by combining principal change events that are identical except their dates but maintain a periodic flow according to the original frequencies.
Arguments
include_rollups
- Include rollup elements.include_details
- Include detail elements.compress_descriptor
- If true merge ListDescriptor objects into a single ListDescriptor object where applicable, otherwise do not compress amortization elements that have different ListDescriptor objects.omit_statistic_events
- If true the statistic events are eliminated from the resulting event list.
Return
- The resulting amortization list or an error code.
pub fn create_template_events(
&self,
group_param: &str,
event_param: &str,
cf_index: usize
) -> Result<ListEvent, ErrorType>
pub fn create_template_events(
&self,
group_param: &str,
event_param: &str,
cf_index: usize
) -> Result<ListEvent, ErrorType>
pub fn create_cashflow_from_template_group(
&self,
group_param: &str,
new_name_param: &str,
new_group_param: &str
) -> Result<ElemBalanceResult, ErrorType>
pub fn create_cashflow_from_template_group(
&self,
group_param: &str,
new_name_param: &str,
new_group_param: &str
) -> Result<ElemBalanceResult, ErrorType>
pub fn create_cashflow_stats(&self) -> ElemCashflowStats
pub fn create_cashflow_stats(&self) -> ElemCashflowStats
pub fn evaluate_user_descriptors(&self)
pub fn evaluate_user_descriptors(&self)
Evaluate all of the descriptors in the user preferences. For each descriptor that specifies an expression, execute the expression using the list of parameters.
pub fn evaluate_cashflow_descriptors(&self)
pub fn evaluate_cashflow_descriptors(&self)
Evaluate all of the descriptors in the selected cashflow. For each descriptor that specifies an expression, execute the expression using the list of parameters.
pub fn evaluate_cashflow_event_type_all(&self)
pub fn evaluate_cashflow_event_type_all(&self)
Evaluate the event type expression for all events in the selected cashflow.
pub fn evaluate_expression(
&self,
list_parameter: Option<&ListParameter>,
expression_str: &str,
cashflow: bool
) -> ElemSymbol
pub fn evaluate_expression(
&self,
list_parameter: Option<&ListParameter>,
expression_str: &str,
cashflow: bool
) -> ElemSymbol
Evaluate the expression.
Arguments
calc_manager_param
- Calculation manager.list_parameter
- List of parameters used with evaluation.expression_str
- The expression to evaluate.cashflow
- Search the cashflow preferences.
Return
- Resulting symbol if successful, otherwise an error message in the symbol.
pub fn format_date_in(&self, display_val: &str) -> String
pub fn format_date_in(&self, display_val: &str) -> String
pub fn format_integer_in(&self, display_val: &str) -> String
pub fn format_integer_in(&self, display_val: &str) -> String
pub fn format_decimal_in(&self, display_val: &str) -> String
pub fn format_decimal_in(&self, display_val: &str) -> String
pub fn format_currency_in(&self, display_val: &str) -> String
pub fn format_currency_in(&self, display_val: &str) -> String
pub fn format_date_out(&self, val: usize) -> String
pub fn format_date_out(&self, val: usize) -> String
pub fn format_integeri_out(&self, val: i32) -> String
pub fn format_integeri_out(&self, val: i32) -> String
pub fn format_integer_out(&self, val: usize) -> String
pub fn format_integer_out(&self, val: usize) -> String
pub fn format_decimal_out(&self, val: Decimal) -> String
pub fn format_decimal_out(&self, val: Decimal) -> String
pub fn format_currency_out(&self, val: Decimal) -> String
pub fn format_currency_out(&self, val: Decimal) -> String
pub fn round_decimal(&self, val: Decimal) -> Decimal
pub fn round_decimal(&self, val: Decimal) -> Decimal
pub fn round_currency(&self, val: Decimal) -> Decimal
pub fn round_currency(&self, val: Decimal) -> Decimal
pub fn am_value(
&self,
elem_column: &ElemColumn,
list_am_opt: &ListAmortization
) -> String
pub fn am_value(
&self,
elem_column: &ElemColumn,
list_am_opt: &ListAmortization
) -> String
pub fn event_value(&self, elem_column: &ElemColumn) -> String
pub fn event_value(&self, elem_column: &ElemColumn) -> String
pub fn parse_columns(&self, event_type: TableType) -> ListColumn
pub fn parse_columns(&self, event_type: TableType) -> ListColumn
pub fn parse_summary(&self) -> ListSummary
pub fn parse_summary(&self) -> ListSummary
pub fn set_event_value(
&self,
col_name_index: usize,
col_type: &str,
col_code: &str,
index: usize,
value_param: &str
) -> String
pub fn set_event_value(
&self,
col_name_index: usize,
col_type: &str,
col_code: &str,
index: usize,
value_param: &str
) -> String
pub fn set_extension_values(
&self,
index: usize,
ext_param: &ElemExtension
) -> bool
pub fn set_extension_values(
&self,
index: usize,
ext_param: &ElemExtension
) -> bool
Trait Implementations
impl Default for CalcEngine
impl Default for CalcEngine
The main default implementation of the AmFn engine component.
Auto Trait Implementations
impl !RefUnwindSafe for CalcEngine
impl !Send for CalcEngine
impl !Sync for CalcEngine
impl Unpin for CalcEngine
impl !UnwindSafe for CalcEngine
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more