19#ifndef BITECELLSCRIPT_H 
   20#define BITECELLSCRIPT_H 
   74    bool hasValue(QString variable_name);
 
   75    double value(QString variable_name);
 
   94    void setup(QJSValue &js_value, QStringList event_names, 
BiteAgent *agent);
 
   96    QString 
run(
const QString event, 
BiteCell *cell=
nullptr, QJSValueList *params=
nullptr);
 
   98    bool hasEvent(
const QString &event) 
const;
 
   99    QJSValue 
eventFunction(
const QString &event) { 
return mEvents[event].property(event); }
 
  103    QMap<QString, QJSValue> mEvents; 
 
  105    QJSValue mScriptCell;
 
  129    QString 
dump() 
const;
 
  144    QJSValue mScriptCell;
 
  160    QList<DynamicExpression*> mConstraints;
 
Definition: fmsaplinglist.h:12
 
The FMTreeList class implements low-level functionality for selecting and harvesting of trees.
Definition: fmtreelist.h:34
 
Definition: biteagent.h:71
 
Definition: bitecell.h:38
 
void setActive(bool activate)
Definition: bitecell.h:50
 
int yearsLiving() const
Definition: bitecell.h:62
 
bool isActive() const
Definition: bitecell.h:49
 
int cumYearsLiving() const
Definition: bitecell.h:64
 
void setSpreading(bool activate)
Definition: bitecell.h:53
 
bool isSpreading() const
Definition: bitecell.h:52
 
void die()
Definition: bitecell.cpp:79
 
Definition: bitecellscript.h:37
 
void die()
Definition: bitecellscript.h:78
 
void setSpreading(bool a)
Definition: bitecellscript.h:59
 
int cumYearsLiving
Definition: bitecellscript.h:42
 
bool active() const
Definition: bitecellscript.h:55
 
~BiteCellScript()
Definition: bitecellscript.h:49
 
BiteCellScript(QObject *parent=nullptr)
Definition: bitecellscript.cpp:34
 
void reloadTrees()
Definition: bitecellscript.cpp:92
 
bool hasValue(QString variable_name)
Definition: bitecellscript.cpp:63
 
void setValue(QString var_name, double value)
Definition: bitecellscript.cpp:80
 
int yearsLiving() const
Definition: bitecellscript.h:61
 
BiteCell * cell() const
Definition: bitecellscript.h:51
 
BiteAgent * agent
Definition: bitecellscript.h:46
 
bool active
Definition: bitecellscript.h:39
 
QString info()
Definition: bitecellscript.cpp:57
 
int cumYearsLiving() const
Definition: bitecellscript.h:62
 
ABE::FMTreeList * trees()
 
double value(QString variable_name)
Definition: bitecellscript.cpp:69
 
void setCell(BiteCell *c)
Definition: bitecellscript.h:50
 
ABE::FMTreeList * trees
Definition: bitecellscript.h:44
 
int yearsLiving
Definition: bitecellscript.h:41
 
BiteAgent * agent() const
Definition: bitecellscript.h:53
 
int outbreakYears
Definition: bitecellscript.h:43
 
void setAgent(BiteAgent *a)
Definition: bitecellscript.h:52
 
void reloadSaplings()
Definition: bitecellscript.cpp:99
 
ABE::FMSaplingList * saplings
Definition: bitecellscript.h:45
 
bool spreading
Definition: bitecellscript.h:40
 
ABE::FMSaplingList * saplings()
 
bool spreading() const
Definition: bitecellscript.h:58
 
void setActive(bool a)
Definition: bitecellscript.h:56
 
Definition: bitecellscript.h:149
 
bool isConst()
return true if no dynamic evaluation happens
Definition: bitecellscript.cpp:423
 
~Constraints()
Definition: bitecellscript.cpp:338
 
Constraints()
Definition: bitecellscript.h:151
 
void setup(QJSValue &js_value, DynamicExpression::EWrapperType wrap, BiteAgent *agent)
setup from javascript
Definition: bitecellscript.cpp:343
 
double evaluate(BiteCell *cell)
run the constraints
Definition: bitecellscript.cpp:365
 
QStringList dump()
prints some debug info
Definition: bitecellscript.cpp:433
 
Definition: bitecellscript.h:88
 
Events()
Definition: bitecellscript.h:90
 
void setup(QJSValue &js_value, QStringList event_names, BiteAgent *agent)
setup events from the javascript object
Definition: bitecellscript.cpp:452
 
QString run(const QString event, BiteCell *cell=nullptr, QJSValueList *params=nullptr)
execute javascript event /if registered) in the context of the forest stand 'stand'.
Definition: bitecellscript.cpp:466
 
QString dump()
prints some debug info
Definition: bitecellscript.cpp:508
 
QJSValue eventFunction(const QString &event)
Definition: bitecellscript.h:99
 
void clear()
clear the list of events
Definition: bitecellscript.cpp:447
 
bool hasEvent(const QString &event) const
returns true, if the event 'event' is available.
Definition: bitecellscript.cpp:503
 
An expression engine for mathematical expressions provided as strings.
Definition: expression.h:29
 
ResourceUnit is the spatial unit that encapsulates a forest stand and links to several environmental ...
Definition: resourceunit.h:49
 
Definition: scripttree.h:10
 
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
 
Definition: biteagent.cpp:32
 
DynamicExpression encapsulates an "expression" that can be either a iLand expression,...
Definition: bitecellscript.h:111
 
bool isConst() const
Definition: bitecellscript.h:128
 
bool isValid() const
Definition: bitecellscript.h:127
 
void setup(const QJSValue &js_value, EWrapperType type, BiteAgent *agent)
Definition: bitecellscript.cpp:131
 
EWrapperType
Definition: bitecellscript.h:112
 
@ CellWrap
Definition: bitecellscript.h:112
 
@ SaplingWrap
Definition: bitecellscript.h:112
 
@ TreeWrap
Definition: bitecellscript.h:112
 
bool evaluateBool(SaplingTree *sap, ResourceUnit *ru) const
Definition: bitecellscript.h:125
 
EFilterType type() const
Definition: bitecellscript.h:118
 
DynamicExpression()
Definition: bitecellscript.h:114
 
bool evaluateBool(BiteCell *cell) const
Definition: bitecellscript.h:123
 
~DynamicExpression()
Definition: bitecellscript.cpp:123
 
EFilterType
Definition: bitecellscript.h:113
 
@ ftJavascript
Definition: bitecellscript.h:113
 
@ ftInvalid
Definition: bitecellscript.h:113
 
@ ftExpression
Definition: bitecellscript.h:113
 
@ ftConstant
Definition: bitecellscript.h:113
 
bool evaluateBool(Tree *tree) const
Definition: bitecellscript.h:124
 
QString dump() const
Definition: bitecellscript.cpp:321
 
double evaluate(BiteCell *cell) const
Definition: bitecellscript.cpp:176
 
Definition: saplings.h:29