COPASI API  4.16.103
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
CExpression Class Reference

#include <CExpression.h>

Inheritance diagram for CExpression:
Inheritance graph
[legend]
Collaboration diagram for CExpression:
Collaboration graph
[legend]

Public Member Functions

virtual const C_FLOAT64calcValue ()
 
 CExpression (const std::string &name="Expression", const CCopasiContainer *pParent=NULL)
 
 CExpression (const CExpression &src, const CCopasiContainer *pParent=NULL)
 
virtual bool compile (std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
 
std::string getBerkeleyMadonnaString () const
 
std::string getCCodeString () const
 
const std::string & getDisplayString () const
 
const std::vector
< CCopasiContainer * > & 
getListOfContainer () const
 
const CObjectInterfacegetNodeObject (const CCopasiObjectName &CN) const
 
std::string getXPPString () const
 
void refresh ()
 
virtual bool setInfix (const std::string &infix)
 
void setIsBoolean (const bool &booleanRequired)
 
bool updateInfix ()
 
void writeMathML (std::ostream &out, bool fullExpand, size_t l) const
 
virtual ~CExpression ()
 
- Public Member Functions inherited from CEvaluationTree
bool calls (std::set< std::string > &list) const
 
 CEvaluationTree (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
 
 CEvaluationTree (const CEvaluationTree &src, const CCopasiContainer *pParent=NULL)
 
virtual bool compile ()
 
bool dependsOnTree (const std::string &name) const
 
CCopasiObject::DataObjectSet getDeletedObjects () const
 
std::string::size_type getErrorPosition () const
 
const std::string & getInfix () const
 
const std::vector
< CEvaluationNode * > & 
getNodeList () const
 
CEvaluationNodegetRoot ()
 
const CEvaluationNodegetRoot () const
 
const CEvaluationTree::TypegetType () const
 
virtual size_t getVariableIndex (const std::string &name) const
 
virtual const C_FLOAT64getVariableValue (const size_t &index) const
 
bool hasCircularDependency () const
 
bool hasDiscontinuity () const
 
bool isBoolean () const
 
bool isUsable () const
 
bool operator== (const CEvaluationTree &rhs) const
 
virtual bool setRoot (CEvaluationNode *pRootNode)
 
bool setTree (const ASTNode &pRootNode)
 
virtual ASTNode * toAST (const CCopasiDataModel *pDataModel) const
 
bool updateTree ()
 
virtual ~CEvaluationTree ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const std::string & getKey () const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Static Public Member Functions

static CExpressioncreateInitialExpression (const CExpression &expression, const CCopasiDataModel *pDataModel)
 
- Static Public Member Functions inherited from CEvaluationTree
static CEvaluationTreecopy (const CEvaluationTree &src)
 
static CEvaluationTreecreate (CEvaluationTree::Type type)
 
static CEvaluationNodefromAST (const ASTNode *pASTNode)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 

Protected Attributes

std::string mDisplayString
 
bool mIsBoolean
 
const std::vector
< CCopasiContainer * > * 
mpListOfContainer
 
- Protected Attributes inherited from CEvaluationTree
std::vector< CEvaluationNode * > mCalculationSequence
 
std::string mInfix
 
std::vector< CEvaluationNode * > * mpNodeList
 
CEvaluationNodempRoot
 
CEvaluationTree::Type mType
 
bool mUsable
 
C_FLOAT64 mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

void initObjects ()
 

Additional Inherited Members

- Public Types inherited from CEvaluationTree
enum  Type {
  Function = 0, MassAction, PreDefined, UserDefined,
  Expression, MathExpression
}
 
- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Attributes inherited from CEvaluationTree
static const std::string TypeName []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CEvaluationTree
void buildCalculationSequence ()
 
void calculate ()
 
bool compileNodes ()
 
bool parse ()
 
void setType (const CEvaluationTree::Type &type)
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 28 of file CExpression.h.

Constructor & Destructor Documentation

CExpression::CExpression ( const std::string &  name = "Expression",
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
conststd::string & name (default: "Expression")
constCCopasiContainer * pParent (default: NULL)

Definition at line 26 of file CExpression.cpp.

References initObjects().

Referenced by createInitialExpression().

27  :
29  mpListOfContainer(NULL),
30  mDisplayString(""),
31  mIsBoolean(false)
32 {
33  initObjects();
34 }
void initObjects()
Definition: CExpression.cpp:49
std::string mDisplayString
Definition: CExpression.h:161
bool mIsBoolean
Definition: CExpression.h:166
const std::vector< CCopasiContainer * > * mpListOfContainer
Definition: CExpression.h:156
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CExpression::CExpression ( const CExpression src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
const CExpression &src
constCCopasiContainer * pParent (default: NULL)

Definition at line 36 of file CExpression.cpp.

References CEvaluationTree::compile(), and initObjects().

37  :
38  CEvaluationTree(src, pParent),
39  mpListOfContainer(NULL),
42 {
43  initObjects();
44  compile();
45 }
void initObjects()
Definition: CExpression.cpp:49
std::string mDisplayString
Definition: CExpression.h:161
bool mIsBoolean
Definition: CExpression.h:166
const std::vector< CCopasiContainer * > * mpListOfContainer
Definition: CExpression.h:156
virtual bool compile()
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CExpression::~CExpression ( )
virtual

Destructor

Definition at line 47 of file CExpression.cpp.

47 {}

Member Function Documentation

const C_FLOAT64 & CExpression::calcValue ( )
virtual
bool CExpression::compile ( std::vector< CCopasiContainer * >  listOfContainer = CCopasiContainer::EmptyList)
virtual

Compile the evaluation tree.

Parameters
std::vector<CCopasiContainer * > listOfContainer (Default: CCopasiContainer::EmptyList)
Returns
bool success

Definition at line 97 of file CExpression.cpp.

References CEvaluationNode::buildDisplayString(), CEvaluationNode::buildInfix(), CEvaluationTree::compileNodes(), CCopasiObject::getObjectParent(), mDisplayString, CEvaluationTree::mInfix, mpListOfContainer, and CEvaluationTree::mpRoot.

Referenced by CMathEventN::CTrigger::allocate(), SBMLImporter::applyStoichiometricExpressions(), CMathEventN::CAssignment::compile(), CEventAssignment::compile(), CEvaluationNodeCall::compile(), CModelEntity::compile(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CModelParameter::compile(), CEvent::compile(), CMathEventN::compile(), CMetab::compile(), CMathEvent::compile(), CMetab::compileInitialValueDependencies(), CModelExpansion::duplicateEvent(), COptProblem::initialize(), CEvent::setDelayExpressionPtr(), CMathObject::setExpression(), CEventAssignment::setExpressionPtr(), CEvent::setPriorityExpressionPtr(), and CEvent::setTriggerExpressionPtr().

98 {
99  if (getObjectParent() != NULL)
100  listOfContainer.push_back(getObjectParent());
101 
102  mpListOfContainer = & listOfContainer;
103 
104  bool success = compileNodes();
105 
106  if (mpRoot)
107  {
109  mInfix = mpRoot->buildInfix();
110  }
111  else
112  {
113  mDisplayString = "";
114  mInfix = "";
115  }
116 
117  mpListOfContainer = NULL;
118 
119  return success;
120 }
std::string buildInfix() const
std::string mInfix
std::string mDisplayString
Definition: CExpression.h:161
std::string buildDisplayString() const
const std::vector< CCopasiContainer * > * mpListOfContainer
Definition: CExpression.h:156
CCopasiContainer * getObjectParent() const
CEvaluationNode * mpRoot
CExpression * CExpression::createInitialExpression ( const CExpression expression,
const CCopasiDataModel pDataModel 
)
static

Creates the corresponding initial expression for the given expression by converting each transient value to the corresponding initial value.

Parameters
constCExpression & expression
Returns
CExpression * pInitialExpression

Definition at line 219 of file CExpression.cpp.

References CExpression(), CCopasiObject::getCN(), CMetab::getConcentrationReference(), CMetab::getInitialConcentrationReference(), CModelEntity::getInitialValueReference(), CCopasiMessage::getLastMessage(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectParent(), CModelEntity::getValueReference(), CEvaluationNodeObject::setData(), CCopasiMessage::size(), and CEvaluationTree::updateTree().

Referenced by CModelEntity::compile(), CMetab::compile(), and CModelEntity::setStatus().

220 {
221  size_t Size = CCopasiMessage::size();
222  CExpression * pInitialExpression = new CExpression(expression, expression.getObjectParent());
223 
224  std::vector< CEvaluationNode * > * pNodeList =
225  const_cast< std::vector< CEvaluationNode * > * >(&pInitialExpression->getNodeList());
226  std::vector< CEvaluationNode * >::iterator it = pNodeList->begin();
227  std::vector< CEvaluationNode * >::iterator end = pNodeList->end();
228 
229  CEvaluationNodeObject * pNode;
230  const CCopasiObject * pObject;
231  const CCopasiContainer * pObjectParent;
232  const CModelEntity * pEntity;
233  const CMetab * pMetab;
234 
235  for (; it != end; ++it)
236  {
237  if ((pNode = dynamic_cast< CEvaluationNodeObject * >(*it)) != NULL)
238  {
239  assert(pDataModel != NULL);
240 
241  if ((pObject = static_cast< const CCopasiObject * >(pDataModel->getObject(pNode->getObjectCN()))) != NULL &&
242  (pObjectParent = pObject->getObjectParent()) != NULL &&
243  (pEntity = dynamic_cast<const CModelEntity * >(pObjectParent)) != NULL)
244  {
245  if (pEntity->getValueReference() == pObject)
246  pNode->setData("<" + pEntity->getInitialValueReference()->getCN() + ">");
247  else if ((pMetab = dynamic_cast<const CMetab * >(pEntity)) != NULL &&
248  pMetab->getConcentrationReference() == pObject)
249  pNode->setData("<" + pMetab->getInitialConcentrationReference()->getCN() + ">");
250  }
251  }
252  }
253 
254  pInitialExpression->updateTree();
255 
256  while (CCopasiMessage::size() > Size)
258 
259  return pInitialExpression;
260 }
virtual CCopasiObjectName getCN() const
const CRegisteredObjectName & getObjectCN() const
CCopasiObject * getInitialValueReference() const
Definition: CMetab.h:178
CExpression(const std::string &name="Expression", const CCopasiContainer *pParent=NULL)
Definition: CExpression.cpp:26
static size_t size()
static CCopasiMessage getLastMessage()
virtual bool setData(const Data &data)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
const std::vector< CEvaluationNode * > & getNodeList() const
CCopasiContainer * getObjectParent() const
CConcentrationReference * getConcentrationReference() const
Definition: CMetab.cpp:864
CCopasiObject * getValueReference() const
std::string CExpression::getBerkeleyMadonnaString ( ) const

Retrieve the display string in Berkeley Madonna syntax.

Definition at line 175 of file CExpression.cpp.

References CEvaluationNode::buildBerkeleyMadonnaString(), and CEvaluationTree::mpRoot.

176 {
177  std::string str1;
178 
179  if (mpRoot)
181  else
182  str1 = "";
183 
184  return str1;
185 }
std::string buildBerkeleyMadonnaString() const
CEvaluationNode * mpRoot
std::string CExpression::getCCodeString ( ) const

Retrieve the display string in C syntax.

Definition at line 163 of file CExpression.cpp.

References CEvaluationNode::buildCCodeString(), and CEvaluationTree::mpRoot.

164 {
165  std::string str1;
166 
167  if (mpRoot)
168  str1 = mpRoot->buildCCodeString();
169  else
170  str1 = "";
171 
172  return str1;
173 }
std::string buildCCodeString() const
CEvaluationNode * mpRoot
const std::string & CExpression::getDisplayString ( ) const

Retrieve the human readable display string. Note, the expression must be compiled for this return a displayable string.

Returns
const std::string & displayString

Definition at line 160 of file CExpression.cpp.

References mDisplayString.

Referenced by CQParameterOverviewDM::assignmentData(), CQEventDM::data(), CQGlobalQuantityDM::data(), CQCompartmentDM::data(), CQSpecieDM::data(), and operator<<().

161 {return mDisplayString;}
std::string mDisplayString
Definition: CExpression.h:161
const std::vector< CCopasiContainer * > & CExpression::getListOfContainer ( ) const

Retrieve the list of container used for compile

Returns
const std::vector< CCopasiContainer * > & listOfContainer

Definition at line 148 of file CExpression.cpp.

References mpListOfContainer.

149 {return *mpListOfContainer;}
const std::vector< CCopasiContainer * > * mpListOfContainer
Definition: CExpression.h:156
const CObjectInterface * CExpression::getNodeObject ( const CCopasiObjectName CN) const

Retrieve a pointer to the object defined by CN. This method may only be called during compile() since the list mpListOfContainer is only valid then.

Parameters
constCCopasiObjectName & CN
Returns
const CObjectInterface * value

Definition at line 132 of file CExpression.cpp.

References CCopasiDataModel::getDataObject(), CCopasiObject::getObjectDataModel(), mpListOfContainer, and CCopasiDataModel::ObjectFromCN().

Referenced by CEvaluationNodeObject::compile().

133 {
134  const CCopasiDataModel* pDataModel = getObjectDataModel();
135 
136  if (pDataModel == NULL) return NULL;
137 
138  if (mpListOfContainer != NULL)
139  {
140  return pDataModel->ObjectFromCN(*mpListOfContainer, CN);
141  }
142  else
143  {
144  return pDataModel->getDataObject(CN);
145  }
146 }
CCopasiDataModel * getObjectDataModel()
CCopasiObject * getDataObject(const CCopasiObjectName &CN) const
CObjectInterface * ObjectFromCN(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &objName) const
const std::vector< CCopasiContainer * > * mpListOfContainer
Definition: CExpression.h:156
std::string CExpression::getXPPString ( ) const

Retrieve the display string in XPPAUT syntax.

Definition at line 187 of file CExpression.cpp.

References CEvaluationNode::buildXPPString(), and CEvaluationTree::mpRoot.

188 {
189  std::string str1;
190 
191  if (mpRoot)
192  str1 = mpRoot->buildXPPString();
193  else
194  str1 = "";
195 
196  return str1;
197 }
std::string buildXPPString() const
CEvaluationNode * mpRoot
void CExpression::initObjects ( )
private

Initialize the contained CCopasiObjects

Definition at line 49 of file CExpression.cpp.

References CCopasiContainer::getObject(), refresh(), and CCopasiObject::setRefresh().

Referenced by CExpression().

50 {
51  CObjectInterface * pObject =
52  const_cast< CObjectInterface * >(getObject(CCopasiObjectName("Reference=Value")));
53  assert(pObject != NULL);
54 
55  static_cast< CCopasiObject * >(pObject)->setRefresh(this, &CExpression::refresh);
56 }
void setRefresh(CType *pType, void(CType::*method)(void))
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
void refresh()
void CExpression::refresh ( )

Refresh the value of the expression

Definition at line 129 of file CExpression.cpp.

References calcValue().

Referenced by CMathTrigger::CRootFinder::initObjects(), and initObjects().

130 {calcValue();}
virtual const C_FLOAT64 & calcValue()
bool CExpression::setInfix ( const std::string &  infix)
virtual

Set the infix description of the tree and compile it.

Parameters
conststd::string & infix
Returns
bool success

Reimplemented from CEvaluationTree.

Definition at line 63 of file CExpression.cpp.

References CEvaluationNode::isBoolean(), mIsBoolean, CEvaluationTree::mpNodeList, CEvaluationTree::mpRoot, CEvaluationTree::setInfix(), and CEvaluationNode::VARIABLE.

Referenced by CMathEventN::CTrigger::allocate(), CMathEventN::CAssignment::compile(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CMathEventN::compile(), CMathEvent::compile(), CMathObject::compileDependentMass(), CMathObject::compileParticleFlux(), CMathObject::compilePropensity(), CMathObject::compileTotalMass(), CMathObject::createExtensiveODERateExpression(), CMathObject::createExtensiveReactionRateExpression(), CMathObject::createExtensiveValueExpression(), CMathObject::createIntensiveRateExpression(), CMathObject::createIntensiveValueExpression(), CCopasiXMLParser::FunctionElement::end(), CEvent::setDelayExpression(), CEventAssignment::setExpression(), CMathObject::setExpression(), CModelEntity::setExpression(), CModelParameter::setInitialExpression(), CModelEntity::setInitialExpression(), COptProblem::setObjectiveFunction(), CEvent::setPriorityExpression(), and CEvent::setTriggerExpression().

64 {
65  if (!CEvaluationTree::setInfix(infix)) return false;
66 
67  if (mpNodeList == NULL) return true;
68 
69  // Check whether the expression has the expected type.
70  if (mpRoot != NULL)
71  {
72  if (mIsBoolean && !mpRoot->isBoolean())
73  {
74  return false;
75  }
76 
77  // We wrap a boolean expression in an if construct for
78  // non-boolean expressions
79  if (!mIsBoolean && mpRoot->isBoolean())
80  {
81  std::string Infix = "if(" + infix + ", 1, 0)";
83  }
84  }
85 
86  // We need to check that the expression does not contain any variables
87  std::vector< CEvaluationNode * >::const_iterator it = mpNodeList->begin();
88  std::vector< CEvaluationNode * >::const_iterator end = mpNodeList->end();
89 
90  for (; it != end; ++it)
91  if (((*it)->getType() & 0xFF000000) == CEvaluationNode::VARIABLE)
92  return false;
93 
94  return true;
95 }
std::vector< CEvaluationNode * > * mpNodeList
bool mIsBoolean
Definition: CExpression.h:166
virtual bool isBoolean() const
virtual bool setInfix(const std::string &infix)
CEvaluationNode * mpRoot
void CExpression::setIsBoolean ( const bool &  booleanRequired)
bool CExpression::updateInfix ( )

This method performs an infix update if a referenced object has been renamed

Returns
bool success

Definition at line 151 of file CExpression.cpp.

References CEvaluationNode::buildInfix(), CEvaluationTree::mInfix, CEvaluationTree::mpNodeList, and CEvaluationTree::mpRoot.

Referenced by CEvent::getDelayExpression(), CEventAssignment::getExpression(), CModelEntity::getExpression(), CModelEntity::getInitialExpression(), CEvent::getPriorityExpression(), and CEvent::getTriggerExpression().

152 {
153  if (mpNodeList == NULL) return false;
154 
155  mInfix = mpRoot->buildInfix();
156 
157  return true;
158 }
std::vector< CEvaluationNode * > * mpNodeList
std::string buildInfix() const
std::string mInfix
CEvaluationNode * mpRoot
void CExpression::writeMathML ( std::ostream &  out,
bool  fullExpand,
size_t  l 
) const

Write display mathml of the expression into the ostream "out" level specifies indentation fullExpand==true means function calls are expanded

Definition at line 201 of file CExpression.cpp.

References CEvaluationNode::buildMMLString(), CEvaluationTree::mpRoot, and SPC.

Referenced by CQExpressionWidget::writeMathML(), and CMMLOutput::writeRHS_ModelEntity().

202 {
203  if (mpRoot)
204  {
205  //create empty environment. Variable nodes should not occur in an expression
206  std::vector<std::vector<std::string> > env;
207 
208  bool flag = false; //TODO include check if parantheses are necessary
209 
210  if (flag) out << SPC(l) << "<mfenced>" << std::endl;
211 
212  out << mpRoot->buildMMLString(fullExpand, env);
213 
214  if (flag) out << SPC(l) << "</mfenced>" << std::endl;
215  }
216 }
#define SPC(level)
long int flag
Definition: f2c.h:52
std::string buildMMLString(bool expand, const std::vector< std::vector< std::string > > &variables) const
CEvaluationNode * mpRoot

Member Data Documentation

std::string CExpression::mDisplayString
protected

Human readable display string.

Definition at line 161 of file CExpression.h.

Referenced by compile(), and getDisplayString().

bool CExpression::mIsBoolean
protected

Indicates whether the expression is boolean or not.

Definition at line 166 of file CExpression.h.

Referenced by setInfix(), and setIsBoolean().

const std::vector< CCopasiContainer * >* CExpression::mpListOfContainer
protected

Pointer to the list of containers used for compilation.

Definition at line 156 of file CExpression.h.

Referenced by compile(), getListOfContainer(), and getNodeObject().


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