Minsky: 3.17.0
|
#include <godleyTable.h>
Public Types | |
typedef std::vector< std::vector< string > > | Data |
typedef GodleyAssetClass::AssetClass | AssetClass |
![]() | |
enum | AssetClass { noAssetClass, asset, liability, equity } |
enum | DisplayStyle { DRCR, sign } |
Public Member Functions | |
GodleyTable () | |
bool | operator== (const GodleyTable &other) const |
const vector< AssetClass > & | assetClass () const |
class of each column (used in DE compliant mode) More... | |
AssetClass | assetClass (std::size_t col) const |
AssetClass | assetClass (std::size_t col, AssetClass cls) |
bool | singleEquity () const |
Check whether more than one equity column is present irrespective of single or multiple equity column mode. More... | |
void | nameUnique () |
bool | signConventionReversed (int col) const |
The usual mathematical sign convention is reversed in double entry book keeping conventions if the asset class is a liability or equity. More... | |
bool | initialConditionRow (unsigned row) const |
returns true if row is an "Initial Conditions" row More... | |
bool | singularRow (unsigned row, unsigned col) |
return true if row is empty apart from a value in column col More... | |
std::size_t | rows () const |
std::size_t | cols () const |
void | clear () |
void | resize (unsigned rows, unsigned cols) |
void | moveRow (int row, int n) |
move row row down by n places (up if -ve) More... | |
void | moveCol (int col, int n) |
void | dimension (unsigned rows, unsigned cols) |
string & | cell (unsigned row, unsigned col) |
const string & | cell (unsigned row, unsigned col) const |
bool | cellInTable (int row, int col) const |
string | getCell (unsigned row, unsigned col) const |
void | setCell (unsigned row, unsigned col, const string &data) |
void | balanceEquity (int col) |
insert A-L into the equity column c, such that A-L-E=0 More... | |
std::vector< std::string > | getColumnVariables () const |
get the set of column labels, in column order More... | |
std::vector< std::string > | getVariables () const |
get the vector of unique variable names from the interior of the table, in row, then column order More... | |
std::vector< std::string > | getColumn (unsigned col) const |
get column data More... | |
void | setDEmode (bool doubleEntryCompliant) |
toggle flow signs according to double entry compliant mode More... | |
std::map< std::string, double > | rowSumAsMap (int row) const |
std::string | rowSum (int row) const |
return the symbolic sum across a row More... | |
const Data & | getData () const |
accessor for schema access More... | |
void | exportToLaTeX (const std::string &filename) const |
void | exportToCSV (const std::string &filename) const |
void | orderAssetClasses () |
reorders columns into assets/liabilities and equities. Adds empty columns if an asset class is not present. More... | |
void | rename (const std::string &from, const std::string &to) |
rename all instances of a variable More... | |
void | renameFlows (const std::string &from, const std::string &to) |
rename all instances of a flow variable More... | |
void | renameStock (const std::string &from, const std::string &to) |
rename a stock variable More... | |
void | insertRow (unsigned row) |
insert row at row More... | |
void | deleteRow (unsigned row) |
delete row at row More... | |
void | insertCol (unsigned col) |
insert col at col More... | |
void | deleteCol (unsigned col) |
delete col before col More... | |
Static Public Member Functions | |
static std::string | stringify (const std::map< std::string, double > &) |
Public Attributes | |
bool | doubleEntryCompliant |
std::string | title |
std::string | savedText |
save text in currently highlighted column heading for renaming all variable instances and to enable user to fix problems More... | |
Static Public Attributes | |
static const char * | initialConditions ="Initial Conditions" |
Private Member Functions | |
CLASSDESC_ACCESS (GodleyTable) | |
void | _resize (unsigned rows, unsigned cols) |
Static Private Member Functions | |
static void | markEdited () |
mark model as having changed More... | |
Private Attributes | |
vector< AssetClass > | m_assetClass {noAssetClass, asset, liability, equity} |
class of each column (used in DE compliant mode) More... | |
Data | data |
Friends | |
struct | SchemaHelper |
class | GodleyIcon |
Definition at line 33 of file godleyTable.h.
Definition at line 54 of file godleyTable.h.
typedef std::vector<std::vector<string> > minsky::GodleyTable::Data |
Definition at line 39 of file godleyTable.h.
|
inline |
Definition at line 61 of file godleyTable.h.
|
inlineprivate |
Definition at line 47 of file godleyTable.h.
|
inline |
class of each column (used in DE compliant mode)
Definition at line 76 of file godleyTable.h.
Referenced by minsky::Minsky::balanceDuplicateColumns(), balanceEquity(), minsky::exportToCSV(), minsky::exportToLaTeX(), getColumnVariables(), moveCol(), and orderAssetClasses().
AssetClass minsky::GodleyTable::assetClass | ( | std::size_t | col | ) | const |
AssetClass minsky::GodleyTable::assetClass | ( | std::size_t | col, |
AssetClass | cls | ||
) |
void GodleyTable::balanceEquity | ( | int | col | ) |
insert A-L into the equity column c, such that A-L-E=0
Definition at line 134 of file godleyTable.cc.
References assetClass(), cell(), minsky::GodleyAssetClass::equity, rows(), rowSumAsMap(), and stringify().
|
inline |
Definition at line 134 of file godleyTable.h.
Referenced by minsky::Minsky::balanceDuplicateColumns(), balanceEquity(), getColumn(), getColumnVariables(), getVariables(), minsky::Minsky::importDuplicateColumn(), initialConditionRow(), orderAssetClasses(), rename(), renameFlows(), renameStock(), rowSumAsMap(), setDEmode(), and singularRow().
|
inline |
Definition at line 140 of file godleyTable.h.
|
inline |
Definition at line 145 of file godleyTable.h.
|
private |
|
inline |
Definition at line 107 of file godleyTable.h.
|
inline |
Definition at line 105 of file godleyTable.h.
Referenced by minsky::Minsky::balanceDuplicateColumns(), deleteCol(), minsky::exportToCSV(), minsky::exportToLaTeX(), getColumnVariables(), getVariables(), minsky::Minsky::importDuplicateColumn(), insertCol(), insertRow(), moveCol(), orderAssetClasses(), rename(), renameFlows(), renameStock(), rowSumAsMap(), setDEmode(), singleEquity(), and singularRow().
void GodleyTable::deleteCol | ( | unsigned | col | ) |
delete col before col
Definition at line 83 of file godleyTable.cc.
References cols(), data, m_assetClass, markEdited(), minsky::GodleyAssetClass::noAssetClass, orderAssetClasses(), and rows().
|
inline |
|
inline |
Definition at line 132 of file godleyTable.h.
void GodleyTable::exportToCSV | ( | const std::string & | filename | ) | const |
Definition at line 304 of file godleyTable.cc.
References minsky::exportToCSV(), and f.
void GodleyTable::exportToLaTeX | ( | const std::string & | filename | ) | const |
Definition at line 297 of file godleyTable.cc.
References minsky::exportToLaTeX(), and f.
|
inline |
Definition at line 147 of file godleyTable.h.
Referenced by minsky::exportToCSV(), and minsky::exportToLaTeX().
std::vector< std::string > GodleyTable::getColumn | ( | unsigned | col | ) | const |
get column data
Definition at line 248 of file godleyTable.cc.
References cell(), and rows().
Referenced by orderAssetClasses().
vector< string > GodleyTable::getColumnVariables | ( | ) | const |
get the set of column labels, in column order
Definition at line 146 of file godleyTable.cc.
References assetClass(), cell(), cols(), minsky::trimWS(), and minsky::var.
|
inline |
vector< string > GodleyTable::getVariables | ( | ) | const |
get the vector of unique variable names from the interior of the table, in row, then column order
Definition at line 164 of file godleyTable.cc.
References cell(), cols(), initialConditionRow(), minsky::FlowCoef::name, and rows().
bool GodleyTable::initialConditionRow | ( | unsigned | row | ) | const |
returns true if row is an "Initial Conditions" row
Definition at line 37 of file godleyTable.cc.
References cell(), initialConditions, and rows().
Referenced by getVariables(), rowSumAsMap(), and setDEmode().
void GodleyTable::insertCol | ( | unsigned | col | ) |
insert col at col
Definition at line 68 of file godleyTable.cc.
References cols(), data, m_assetClass, markEdited(), and minsky::GodleyAssetClass::noAssetClass.
void GodleyTable::insertRow | ( | unsigned | row | ) |
insert row at row
In the following, C++ data structure is off by one with respect to the TCL table, as the TCL table has an extra row and column for the +/- buttons. So deleting the row/column before the index has the effect of deleting the row/column at the index in the TCL table, and inserting row/column at the index in C++ has the effect of inserting before the index in TCL
Definition at line 59 of file godleyTable.cc.
References cols(), data, and markEdited().
|
staticprivate |
mark model as having changed
Definition at line 32 of file godleyTable.cc.
References minsky::Minsky::markEdited(), and minsky::minsky().
Referenced by deleteCol(), insertCol(), and insertRow().
void GodleyTable::moveCol | ( | int | col, |
int | n | ||
) |
Definition at line 109 of file godleyTable.cc.
References assetClass(), cols(), data, m_assetClass, orderAssetClasses(), rows(), and savedText.
void GodleyTable::moveRow | ( | int | row, |
int | n | ||
) |
move row row down by n places (up if -ve)
Definition at line 98 of file godleyTable.cc.
void GodleyTable::nameUnique | ( | ) |
Generates a unique name for this table.
Definition at line 277 of file godleyTable.cc.
References minsky::cminsky(), minsky::GroupItems::items, and title.
|
inline |
Definition at line 69 of file godleyTable.h.
References data, doubleEntryCompliant, m_assetClass, and title.
void GodleyTable::orderAssetClasses | ( | ) |
reorders columns into assets/liabilities and equities. Adds empty columns if an asset class is not present.
Definition at line 311 of file godleyTable.cc.
References minsky::GodleyAssetClass::asset, assetClass(), cell(), cols(), minsky::GodleyAssetClass::equity, getColumn(), minsky::GodleyAssetClass::noAssetClass, resize(), and rows().
Referenced by deleteCol(), and moveCol().
void GodleyTable::rename | ( | const std::string & | from, |
const std::string & | to | ||
) |
rename all instances of a variable
Definition at line 348 of file godleyTable.cc.
References cell(), cols(), minsky::FlowCoef::name, rows(), and minsky::FlowCoef::str().
void GodleyTable::renameFlows | ( | const std::string & | from, |
const std::string & | to | ||
) |
rename all instances of a flow variable
Definition at line 363 of file godleyTable.cc.
References cell(), cols(), minsky::FlowCoef::name, rows(), and minsky::FlowCoef::str().
void GodleyTable::renameStock | ( | const std::string & | from, |
const std::string & | to | ||
) |
rename a stock variable
Definition at line 377 of file godleyTable.cc.
References cell(), cols(), minsky::FlowCoef::name, and minsky::FlowCoef::str().
|
inline |
Definition at line 108 of file godleyTable.h.
Referenced by orderAssetClasses().
|
inline |
Definition at line 104 of file godleyTable.h.
Referenced by balanceEquity(), deleteCol(), minsky::exportToCSV(), minsky::exportToLaTeX(), getColumn(), getVariables(), initialConditionRow(), moveCol(), moveRow(), orderAssetClasses(), rename(), renameFlows(), and setDEmode().
|
inline |
return the symbolic sum across a row
Definition at line 179 of file godleyTable.h.
map< string, double > GodleyTable::rowSumAsMap | ( | int | row | ) | const |
Definition at line 201 of file godleyTable.cc.
References cell(), minsky::FlowCoef::coef, cols(), initialConditionRow(), minsky::FlowCoef::name, and signConventionReversed().
Referenced by balanceEquity().
|
inline |
Definition at line 153 of file godleyTable.h.
void GodleyTable::setDEmode | ( | bool | doubleEntryCompliant | ) |
toggle flow signs according to double entry compliant mode
Definition at line 256 of file godleyTable.cc.
References cell(), cols(), doubleEntryCompliant, initialConditionRow(), rows(), and signConventionReversed().
|
inline |
The usual mathematical sign convention is reversed in double entry book keeping conventions if the asset class is a liability or equity.
Definition at line 92 of file godleyTable.h.
Referenced by rowSumAsMap(), and setDEmode().
bool GodleyTable::singleEquity | ( | ) | const |
Check whether more than one equity column is present irrespective of single or multiple equity column mode.
Definition at line 196 of file godleyTable.cc.
References cols(), minsky::GodleyAssetClass::equity, and m_assetClass.
bool GodleyTable::singularRow | ( | unsigned | row, |
unsigned | col | ||
) |
return true if row is empty apart from a value in column col
Definition at line 51 of file godleyTable.cc.
References cell(), and cols().
|
static |
Definition at line 225 of file godleyTable.cc.
Referenced by balanceEquity().
|
friend |
Definition at line 38 of file godleyTable.h.
|
friend |
Definition at line 37 of file godleyTable.h.
|
private |
Definition at line 44 of file godleyTable.h.
Referenced by deleteCol(), insertCol(), insertRow(), moveCol(), moveRow(), operator==(), and minsky::SchemaHelper::setPrivates().
bool minsky::GodleyTable::doubleEntryCompliant |
Definition at line 56 of file godleyTable.h.
Referenced by minsky::exportToCSV(), minsky::exportToLaTeX(), operator==(), and setDEmode().
|
static |
Definition at line 60 of file godleyTable.h.
Referenced by initialConditionRow().
|
private |
class of each column (used in DE compliant mode)
Definition at line 43 of file godleyTable.h.
Referenced by deleteCol(), insertCol(), moveCol(), operator==(), minsky::SchemaHelper::setPrivates(), and singleEquity().
std::string minsky::GodleyTable::savedText |
save text in currently highlighted column heading for renaming all variable instances and to enable user to fix problems
Definition at line 167 of file godleyTable.h.
Referenced by moveCol().
std::string minsky::GodleyTable::title |
Definition at line 58 of file godleyTable.h.
Referenced by schema3::Item::Item(), nameUnique(), operator==(), and minsky::GodleyIcon::titleOffs().