Menu

Evaluable

Nicolas Hainaux
There is a newer version of this page. You can find it here.

Evaluable objects are the ones from which a numeric value may be calculated. The main method is evaluate().

This class was thought to gather methods that are related to numeric evaluation but also comparison. It has not been merged with Calculable and Signed, which where thought to gather other sorts of methods.

Of course, if evaluate() is called on a literal object, it will raise an exception ; but still there's no need to put literal objects apart from the numeric ones : first because they follow the same writing rules ; and second because they may be substituted by numeric objects. So, just take care to not call evaluate() on literal objects.

Fields Methods (provided) Methods (must be reimplemented)
comparison_method() evaluate()
contains_a_rounded_number()
contains_exactly()
get_first_letter()
is_numeric()
is_literal()
is_null()

comparison_method() will certainly change during the process of migration to python3, so I won't mention it here longer, for now

evaluate() is the only method that will raise an Exception if called on a literal object

contains_a_rounded_number() and contains_exactly() will just return boolean True/False
contains_exactly() is used to determine if an object is just a container for another, for example, to check if a Sum or a Product does have only one element being the Item we're looking for.

get_first_letter() is used to compare literals and in Value.__init__() and in Equation.__init__()

Back


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.