pub struct CalcEngine { /* private fields */ }

Implementations

The main implementation of the AmFn engine component.

Create and return a new AmFn engine.

Return
  • See description.

Return the calculation manager.

Return
  • See description.

Returns the calculation manager.

Return
  • See description.

Returns the mutable calculation manager.

Return
  • See description.

Initialize the engine.

Arguments
  • locale_str_param - Initial locale string to select.

Initialize a cashflow.

Arguments
  • index - Cashflow index to initialize.
Return
  • True if successful, otherwise false.

Copy the current preferences locales, exchange rates, template groups, and optionally cashflows and return a new AmFn engine.

Arguments
  • cashflow - Copy the list of cashflows.
Return
  • See description.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Creates the events from the indicated template event list into the currently selected cashflow event list.

Arguments
  • group_param - The name of the template group.
  • event_param - The name of the template event.
  • cf_index - Cashflow index.
Return
  • List of new events added to the cashflow’s event list.

Creates a new cashflow from a named template group.

Arguments
  • group_param - The name of the template group.
  • new_name_param - The name of the new cashflow.
  • new_group_param - The name of the new cashflow group.
Return
  • A balance result if successful, otherwise an error code.

Creates and returns the statistics for the currently selected cashflow.

Return
  • See description.

Evaluate all of the descriptors in the user preferences. For each descriptor that specifies an expression, execute the expression using the list of parameters.

Evaluate all of the descriptors in the selected cashflow. For each descriptor that specifies an expression, execute the expression using the list of parameters.

Evaluate the event type expression for all events in the selected cashflow.

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.

Format a date and return the internal format.

Arguments
  • display_val - The display value to parse.
Return
  • See description.

Format an integer and return the internal format.

Arguments
  • display_val - The display value to parse.
Return
  • See description.

Format a decimal and return the internal format.

Arguments
  • display_val - The display value to parse.
Return
  • See description.

Format a currency and return the internal format.

Arguments
  • display_val - The display value to parse.
Return
  • See description.

Format and return a date string.

Arguments
  • val - The usize date value to format.
Return
  • See description.

Format and return a integer string.

Arguments
  • val - The integer value to format.
Return
  • See description.

Format and return an integer string.

Arguments
  • val - The usize value to format.
Return
  • See description.

Format and return a decimal string.

Arguments
  • val - The decimal value to format.
Return
  • See description.

Format and return a currency string.

Arguments
  • val - The decimal value to format.
Return
  • See description.

Return a rounded decimal.

Arguments
  • val - The decimal value to round.
Return
  • See description.

Return a rounded currency.

Arguments
  • val - The decimal value to round.
Return
  • See description.

Get the appropriate amortization list value as a string.

Arguments
  • elem_column - Column element.
  • list_am_opt - Amortization list.
Return
  • See description.

Get the appropriate event list value as a string.

Arguments
  • elem_column - Column element.
Return
  • See description.

Create and return a column list object.

Arguments
  • event_type - The type of table.
Return
  • See description.

Create and return a summary list object.

Return
  • See description.

Set the appropriate event list value and return it as a string.

Arguments
  • col_name_index - Column name index.
  • col_type - Column type.
  • col_code - Column code.
  • index - Event row index.
  • value_param - Value to set as a string.
Return
  • See description.

Set the appropriate event list extension values.

Arguments
  • index - Event row index.
  • ext_param - Extension values to set.
Return
  • True if successful, otherwise false.

Set the appropriate event list parameter values.

Arguments
  • index_param - Event row index.
  • parameters - Parameters to set.
Return
  • True if successful, otherwise false.

Trait Implementations

The main default implementation of the AmFn engine component.

Create and return a new AmFn engine.

Return
  • See description.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.