Nektar++
Public Member Functions | Private Member Functions | List of all members
CellMLToNektar.pycml.mathml_and Class Reference
Inheritance diagram for CellMLToNektar.pycml.mathml_and:
[legend]

Public Member Functions

def evaluate (self)
 
- Public Member Functions inherited from CellMLToNektar.pycml.mathml_operator
def wrong_number_of_operands (self, found, wanted)
 
- Public Member Functions inherited from CellMLToNektar.pycml.mathml
def __init__ (self)
 
def __repr__ (self)
 
def __deepcopy__ (self, memo)
 
def clone_self (self, register=False)
 
def get_original_of_clone (self)
 
def get_component (self)
 
def model (self)
 
def eval (self, elt)
 
- Public Member Functions inherited from CellMLToNektar.pycml.element_base
def __init__ (self)
 
def __delattr__ (self, key)
 
def __setattr__ (self, key, value)
 
def rootNode (self)
 
def cmeta_id (self)
 
def xml_remove_child_at (self, index=-1)
 
def xml_doc (self)
 
def xml_properties (self)
 

Private Member Functions

def _get_binding_time (self)
 

Additional Inherited Members

- Static Public Member Functions inherited from CellMLToNektar.pycml.mathml
def clone (expr)
 
- Public Attributes inherited from CellMLToNektar.pycml.element_base
 xml_attributes
 
- Properties inherited from CellMLToNektar.pycml.mathml
 component = property(get_component)
 

Detailed Description

Class representing the MathML <and> operator.

Definition at line 5802 of file pycml.py.

Member Function Documentation

◆ _get_binding_time()

def CellMLToNektar.pycml.mathml_and._get_binding_time (   self)
private
Return the binding time of the enclosing <apply> element.

Short-circuit if a static False operand occurs before any dynamic
operands, returning static.  Otherwise return the least upper bound
of operand binding times, as usual.

Definition at line 5818 of file pycml.py.

References CellMLToNektar.pycml.mathml.eval().

5818  def _get_binding_time(self):
5819  """Return the binding time of the enclosing <apply> element.
5820 
5821  Short-circuit if a static False operand occurs before any dynamic
5822  operands, returning static. Otherwise return the least upper bound
5823  of operand binding times, as usual.
5824  """
5825  app = self.xml_parent
5826  bts = [BINDING_TIMES.static]
5827  for operand in app.operands():
5828  bt = app._get_element_binding_time(operand)
5829  if bt is BINDING_TIMES.static:
5830  value = self.eval(operand)
5831  if not value and len(bts) == 1:
5832  # Short-circuit
5833  break
5834  else:
5835  bts.append(bt)
5836  # Take least upper bound
5837  return max(bts)
5838 

◆ evaluate()

def CellMLToNektar.pycml.mathml_and.evaluate (   self)
Return the logical conjunction of the operands.

Evaluates operands in the order given in the file, and will
short-circuit at the first which evaluates to False.

Definition at line 5804 of file pycml.py.

References CellMLToNektar.pycml.mathml.eval().

Referenced by CellMLToNektar.pycml.mathml_constructor._eval_self().

5804  def evaluate(self):
5805  """Return the logical conjunction of the operands.
5806 
5807  Evaluates operands in the order given in the file, and will
5808  short-circuit at the first which evaluates to False.
5809  """
5810  app = self.xml_parent
5811  ops = app.operands()
5812  value = True
5813  for operand in ops:
5814  value = value and self.eval(operand)
5815  if not value: break
5816  return value
5817