mathmaker  0.4(alpha)
Public Member Functions | Properties
core.root_calculus.Value Class Reference

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

Inheritance diagram for core.root_calculus.Value:
core.root_calculus.Signed core.root_calculus.Calculable core.root_calculus.Evaluable core.base.Printable core.base.NamedObject core.base.Clonable

List of all members.

Public Member Functions

def __init__
 Constructor.
def get_first_letter
 If the object is literal, returns the value.
def get_has_been_rounded
 Returns the "has been rounded" state of the Value.
def get_iteration_list
 Returns the list of elements to iter over.
def get_minus_signs_nb
 Returns the number of minus signs in the object.
def get_raw_value
 Returns the raw value contained in the Value.
def get_sign
 Returns the sign of the Value.
def get_unit
 Returns the unit of the Value.
def set_has_been_rounded
 Sets the "has been rounded" state of the Value.
def set_sign
 Set the sign of the object.
def set_unit
 Set the unit of the Value.
def set_opposite_sign
 Changes the sign of the object.
def into_str
 Creates a string of the given object in the given ML.
def evaluate
 Returns the value of a numeric Value.
def calculate_next_step
 Returns None.
def dbg_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 substitute
 Uses the given lexicon to substitute literal Values in self.
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 contains_a_rounded_number
 To check if this contains a rounded number...
def contains_exactly
 Always False for a Value.
def is_a_perfect_square
 True if the object contains a perfect square (integer or decimal)
def is_an_integer
 True if the object contains an integer (numeric)
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 is_displ_as_a_single_1
 True if the object can be displayed as a single 1.
def is_displ_as_a_single_minus_1
 True if the object can be displayed as a single -1.
def is_displ_as_a_single_0
 True if the object can be displayed as a single 0.
def is_displ_as_a_single_numeric_Item
 True if the object is or only contains one numeric Item.
def is_displ_as_a_single_int
 True if the object can be displayed as a single int.

Properties

 raw_value
 has_been_rounded
 sign
 unit

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 486 of file root_calculus.py.


Constructor & Destructor Documentation

def core.root_calculus.Value.__init__ (   self,
  arg,
  options 
)

Member Function Documentation

def core.root_calculus.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 811 of file root_calculus.py.

References core.base_calculus.Item.raw_value, core.root_calculus.Value.raw_value, and core.base_calculus.Monomial.raw_value.

def core.root_calculus.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:
-1|0 (i.e. they're equal)

Definition at line 769 of file root_calculus.py.

References core.base_calculus.Item.raw_value, core.root_calculus.Value.raw_value, and core.base_calculus.Monomial.raw_value.

Returns the Value's length.

Returns:
1

Reimplemented from core.root_calculus.Calculable.

Definition at line 786 of file root_calculus.py.

def core.root_calculus.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 797 of file root_calculus.py.

References core.base_calculus.Item.raw_value, core.root_calculus.Value.raw_value, and core.base_calculus.Monomial.raw_value.

To check if this contains a rounded number...

Returns:
True or False depending on the Value inside

Reimplemented from core.root_calculus.Evaluable.

Definition at line 959 of file root_calculus.py.

References core.root_calculus.Value.has_been_rounded.

def core.root_calculus.Value.contains_exactly (   self,
  objct 
)

Always False for a Value.

Parameters:
objctThe object to search for
Returns:
False

Reimplemented from core.root_calculus.Evaluable.

Definition at line 972 of file root_calculus.py.

def core.root_calculus.Value.into_str (   self,
  options 
)
def core.root_calculus.Value.set_sign (   self,
  arg 
)
def core.root_calculus.Value.set_unit (   self,
  arg 
)

Set the unit of the Value.

Parameters:
argString

Definition at line 657 of file root_calculus.py.

References core.base_calculus.Item._unit, core.root_calculus.Value._unit, and core.base_calculus.Function._unit.


Property Documentation

core::root_calculus.Value::has_been_rounded [static]
Initial value:
property(get_has_been_rounded,
                         doc = "'has been rounded' state of the Value")

Definition at line 595 of file root_calculus.py.

Referenced by core.root_calculus.Value.contains_a_rounded_number().

core::root_calculus.Value::raw_value [static]
core::root_calculus.Value::sign [static]
Initial value:
property(get_sign,
                    doc = "Sign of the Value")

Reimplemented from core.root_calculus.Signed.

Definition at line 597 of file root_calculus.py.

Referenced by core.root_calculus.Value.set_opposite_sign().

core::root_calculus.Value::unit [static]
Initial value:
property(get_unit,
                    doc = "Unit of the Value")

Definition at line 600 of file root_calculus.py.

Referenced by core.root_calculus.Value.into_str().


The documentation for this class was generated from the following file: