Menu

Operation

Nicolas Hainaux

This is the mother class of any operation in general. Sum, Product and Quotient all derive from Operation.

An operation has

  • elements (terms in a Sum, factors in a Product...)
  • a neutral element (Item(1) for the Product and Quotient, Item(0) for the Sum)
  • and a symbol ('+' for Sum, '×' for Product, 'like_a_fraction' or 'use_divide_symbol' for a Quotient)
Fields Methods (provided) Methods (must be reimplemented)
element get_element() operator()
neutral get_neutral()
symbol get_symbol()
get_iteration_list()
set_element()
set_symbol()
reset_element()
__get_item__()
__set_item__()
is_expandable()
is_numeric()
is_literal()

operator() has to be redefined in each instanciated operation (Sum, Product, Quotient). It will make the operation between self and arg and used by evaluate().

Check Operation's complete doc

Back


Related

Doc for dev: Core Objects

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.