It's the smallest displayable element (sign, value, exponent) The value can be either numeric or literal. More...
Public Member Functions | |
def | __init__ |
Constructor. | |
def | __str__ |
Raw display of the Item (debugging method). | |
def | __cmp__ |
Compares two Items. | |
def | __len__ |
Returns the Item's length. | |
def | is_numeric |
True if it's a numeric Item. | |
def | is_literal |
True if it's a literal Item. | |
def | is_null |
True if it's the null Item. | |
def | is_negative |
True if Item's *sign* is '-' (ie -(-1) would be "negative"). | |
def | is_positive |
True if Item's *sign* is '+'. | |
def | turn_into_fraction |
Turns the Item into the fraction item itself over item 1. | |
def | is_equivalent_to_a_single_1 |
True if it's positive w/ (exponent 0 or numeric w/ value 1). | |
def | is_equivalent_to_a_single_minus_1 |
True if it's negative w/ (exponent 0 or numeric w/ value 1). | |
def | is_equivalent_to_a_single_0 |
True if self.is_null(). | |
def | is_equivalent_to_a_single_numeric_Item |
True if the Item is numeric. | |
def | is_equivalent_to_an_irreducible_Fraction |
True if the object is or only contains one irreducible Fraction. | |
def | is_expandable |
False. | |
def | multiply_symbol_is_required |
True if the usual writing rules require a × between two factors. | |
def | requires_brackets |
True if the argument requires brackets in a product For instance, a Sum with several terms or a negative Item. | |
def | requires_inner_brackets |
True if the object requires inner brackets The reason for requiring them is having a negative *value* and if the exponent is either :
| |
def | contains_exactly |
Always False for an Item. | |
def | contains_a_rounded_number |
To check if this contains a rounded number. | |
def | get_value |
Gets the value (value_object.value) of the Item. | |
def | get_sign |
Gets the sign of the Item. | |
def | get_minus_signs_nb |
Gets the number of '-' signs of the Item. | |
def | get_letter |
Returns the letter of the Item, in case it's a literal. | |
def | set_is_out_striked |
Sets a value to the "is_out_striked" field If is_out_striked is set to True, the Item will be displayed out striked. | |
def | set_unit |
Sets a value to the "unit" field. | |
def | evaluate |
Returns the value of a numerically evaluable Item. | |
def | calculate_next_step |
Returns None|an Item. | |
def | round |
Returns the (numeric) Item once rounded to the given precision. | |
def | digits_number |
Returns the number of digits of a numerical Item. | |
def | needs_to_get_rounded |
Returns True/False depending on the need of the value to get rounded (for instance 2.68 doesn't need to get rounded if precision is __.HUNDREDTH or more, but needs it if it is less) If the Item is not numeric, or if the given precision is incorrect, the matching call to the Value will raise an exception. | |
def | expand_and_reduce_next_step |
Returns None (an Item can't get expanded nor reduced !). | |
def | make_string |
Creates a string of the given object in the given ML. |
It's the smallest displayable element (sign, value, exponent) The value can be either numeric or literal.
Definition at line 1005 of file __init__.py.
def obj::calc::Item::__cmp__ | ( | self, | ||
other_item | ||||
) |
Compares two Items.
Definition at line 1154 of file __init__.py.
def obj::calc::Item::__init__ | ( | self, | ||
arg | ||||
) |
Constructor.
arg | None|Number|String|Item|(sign,value,exponent)| (sign,number|letter|Value)|0-degree Monomial|Value Possible arguments can be :
|
Definition at line 1032 of file __init__.py.
def obj::calc::Item::__len__ | ( | self | ) |
def obj::calc::Item::__str__ | ( | self, | ||
options | ||||
) |
Raw display of the Item (debugging method).
options | No option available so far |
Definition at line 1134 of file __init__.py.
def obj::calc::Item::calculate_next_step | ( | self, | ||
options | ||||
) |
Returns None|an Item.
Reimplemented from obj::calc::Exponented.
Definition at line 1646 of file __init__.py.
def obj::calc::Item::contains_a_rounded_number | ( | self | ) |
To check if this contains a rounded number.
..
Reimplemented from obj::calc::Exponented.
Definition at line 1523 of file __init__.py.
def obj::calc::Item::contains_exactly | ( | self, | ||
objct | ||||
) |
Always False for an Item.
objct | The object to search for |
Reimplemented from obj::calc::Exponented.
Definition at line 1511 of file __init__.py.
def obj::calc::Item::evaluate | ( | self | ) |
Returns the value of a numerically evaluable Item.
Reimplemented from obj::calc::Calculable.
Definition at line 1621 of file __init__.py.
def obj::calc::Item::expand_and_reduce_next_step | ( | self, | ||
options | ||||
) |
Returns None (an Item can't get expanded nor reduced !).
Reimplemented from obj::calc::Exponented.
Definition at line 1748 of file __init__.py.
def obj::calc::Item::get_minus_signs_nb | ( | self | ) |
Gets the number of '-' signs of the Item.
Reimplemented from obj::calc::Exponented.
Definition at line 1562 of file __init__.py.
def obj::calc::Item::get_sign | ( | self | ) |
Gets the sign of the Item.
Reimplemented from obj::calc::Exponented.
Definition at line 1548 of file __init__.py.
def obj::calc::Item::get_value | ( | self | ) |
Gets the value (value_object.value) of the Item.
Definition at line 1535 of file __init__.py.
def obj::calc::Item::is_expandable | ( | self | ) |
def obj::calc::Item::is_negative | ( | self | ) |
True if Item's *sign* is '-' (ie -(-1) would be "negative").
Definition at line 1225 of file __init__.py.
def obj::calc::Item::is_positive | ( | self | ) |
True if Item's *sign* is '+'.
Definition at line 1240 of file __init__.py.
def obj::calc::Item::make_string | ( | self, | ||
markup, | ||||
options | ||||
) |
Creates a string of the given object in the given ML.
markup | The markup dictionary to use | |
options | Any options |
Reimplemented from obj::Printable.
Definition at line 1764 of file __init__.py.
def obj::calc::Item::multiply_symbol_is_required | ( | self, | ||
objct, | ||||
position | ||||
) |
True if the usual writing rules require a × between two factors.
objct | The other one | |
position | The position (integer) of self in the Product |
Reimplemented from obj::calc::Exponented.
Definition at line 1347 of file __init__.py.
def obj::calc::Item::needs_to_get_rounded | ( | self, | ||
precision | ||||
) |
Returns True/False depending on the need of the value to get rounded (for instance 2.68 doesn't need to get rounded if precision is __.HUNDREDTH or more, but needs it if it is less) If the Item is not numeric, or if the given precision is incorrect, the matching call to the Value will raise an exception.
Definition at line 1735 of file __init__.py.
def obj::calc::Item::requires_brackets | ( | self, | ||
position | ||||
) |
True if the argument requires brackets in a product For instance, a Sum with several terms or a negative Item.
position | The position of the object in the Product |
Reimplemented from obj::calc::Exponented.
Definition at line 1419 of file __init__.py.
def obj::calc::Item::requires_inner_brackets | ( | self | ) |
True if the object requires inner brackets The reason for requiring them is having a negative *value* and if the exponent is either :
Case of non-Item-Exponented exponents probably is to be improved
Case of numerator-only equivalent Quotients not made so far
Reimplemented from obj::calc::Exponented.
Definition at line 1452 of file __init__.py.