obj::calc::Value Class Reference

This class embedds Numbers & Strings into a basic object. More...

Inheritance diagram for obj::calc::Value:
obj::calc::Calculable obj::Printable

List of all members.

Public Member Functions

def __init__
 Constructor.
def __str__
 Debugging method to print the Value.
def __cmp__
 Compares two Values.
def __len__
 Returns the Value's length.
def __mul__
 Executes the multiplication with another object.
def __add__
 Executes the addition with another object.
def is_numeric
 True if the object only contains numeric objects.
def is_literal
 True if the object only contains literal objects.
def is_null
 True if the evaluated value of an object is null.
def get_letter
 If the object is literal, returns the value.
def is_equivalent_to_a_single_1
 True if the object can be displayed as a single 1.
def is_equivalent_to_a_single_minus_1
 True if the object can be displayed as a single -1.
def is_equivalent_to_a_single_0
 True if the object can be displayed as a single 0.
def is_equivalent_to_a_single_numeric_Item
 True if the object is or only contains one numeric Item.
def is_equivalent_to_an_irreducible_Fraction
 True if the object is or only contains one irreducible Fraction.
def is_a_perfect_square
 True if the object contains a perfect (integer) square.
def evaluate
 Returns the value of a numeric Value.
def calculate_next_step
 Returns None.
def sqrt
 Returns a Value containing the square root of self.
def round
 Returns the value once rounded to the given precision.
def digits_number
 Returns the number of digits of a numerical value.
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).
def make_string
 Creates a string of the given object in the given ML.

Detailed Description

This class embedds Numbers & Strings into a basic object.

It doesn't have any exponent field (always set to 1), so does not belong to Exponenteds. This is the only place where numbers are used directly. The Item class for instance, contains Values in its fields, not numbers. This to be sure any content of any field (even if only a simple number is to be saved in the field) can be tested & managed as an object in any other class than Value. Up from 2010/11/19, it is decided that all numeric Values will contain a decimal.Decimal number.

Definition at line 396 of file __init__.py.


Member Function Documentation

def obj::calc::Value::__add__ (   self,
  objct 
)

Executes the addition with another object.

Warning:
Will raise an error if you try to add a literal with a number

Definition at line 495 of file __init__.py.

def obj::calc::Value::__cmp__ (   self,
  other_value 
)

Compares two Values.

Todo:

check if __cmp__ shouldn't return +1 if value of self > objct

comparison directly with numbers... (see alphabetical_order_cmp)

Returns:
0 (i.e. they're equal)

Definition at line 453 of file __init__.py.

def obj::calc::Value::__init__ (   self,
  arg 
)

Constructor.

Warning:
Might raise an UncompatibleType exception or decimal.InvalidOperation
Parameters:
arg Number|String If the argument is not of one of these kinds, an exception will be raised.
Returns:
One instance of Value

Definition at line 411 of file __init__.py.

def obj::calc::Value::__len__ (   self  ) 

Returns the Value's length.

Returns:
1

Definition at line 470 of file __init__.py.

def obj::calc::Value::__mul__ (   self,
  objct 
)

Executes the multiplication with another object.

Warning:
Will raise an error if you try to multiply a literal with a number

Definition at line 481 of file __init__.py.

def obj::calc::Value::evaluate (   self  ) 

Returns the value of a numeric Value.

Warning:
Raise an exception if not numeric

Reimplemented from obj::calc::Calculable.

Definition at line 637 of file __init__.py.

def obj::calc::Value::make_string (   self,
  markup,
  options 
)

Creates a string of the given object in the given ML.

Parameters:
markup The markup dictionary to use
options Any options
Returns:
The formated string

Reimplemented from obj::Printable.

Definition at line 767 of file __init__.py.


The documentation for this class was generated from the following file:
Generated on Fri Dec 30 19:26:37 2011 for mathmaker by  doxygen 1.6.3