A node on the operator tree representing an indexing expression. More...
#include <nodes.h>
Public Member Functions | |
SyntaxNodeIx (SyntaxNode *on) | |
Constructor. | |
SyntaxNode * | hasDummyVar (const std::string &name) |
Find if the indexing expression defines the given dummy variable. | |
std::list< SyntaxNode * > | getListDummyVars () const |
Return the list of all dummy variables defined by this index's expression. | |
int | getNComp () const |
Retrieve the number of indexing expressions. | |
SyntaxNode * | getDummyVarExpr (int i) const |
Retrieve the dummy variable for the specified indexing expression. | |
SyntaxNode * | getSet (int i) const |
Retrieve the set for the specified indexing expression. | |
ModelComp * | getModelComp (int i) const |
Retrieve the ModelComp for the specified indexing expression. | |
void | splitExpression () |
Set up the ->sets, ->dummyVarExpr, ->ncomp, ->qualifier components. | |
SyntaxNodeIx * | deep_copy () |
Copy the node and all its subnodes into new data structures. | |
void | printDiagnostic (std::ostream &fout) const |
Diagnostic printing of member variables. | |
const SyntaxNode * | getIndexingSet () const |
for nodes that are indexing expressions, get the set that is indexed over | |
Private Member Functions | |
SyntaxNodeIx (const int opCode_) | |
Private Attributes | |
int | ncomp |
Number of 'dummy IN set'-type expressions. | |
std::vector< SyntaxNode * > | dummyVarExpr |
List of the dummyVarExpressions. | |
std::vector< SyntaxNode * > | sets |
List of the set expressions. | |
SyntaxNode * | qualifier |
The expresson to the right of the ':' (if present). | |
std::vector< ModelComp * > | sets_mc |
List of ModelComp for the indexing sets. |
A node on the operator tree representing an indexing expression.
This is a node on the operator tree that represents an indexing expression. A general indexing expression can be of the form:
{(i,j) in ARCS, k in SET: i>k}
which will be broken down into a list of 'dummy IN set' expressions plus an optional qualifier (the condition to the right of COLON).
SyntaxNodeIx::SyntaxNodeIx | ( | const int | opCode_ | ) | [inline, private] |
Referenced by deep_copy().
SyntaxNodeIx::SyntaxNodeIx | ( | SyntaxNode * | on | ) |
Constructor.
References ncomp, qualifier, and splitExpression().
SyntaxNodeIx * SyntaxNodeIx::deep_copy | ( | ) | [virtual] |
Copy the node and all its subnodes into new data structures.
SyntaxNodeIDREF nodes will also be duplicated, however they will point to the original ModelComp's (rather than duplicates of them).
Reimplemented from SyntaxNode.
References SyntaxNode::deep_copy(), dummyVarExpr, SyntaxNode::nchild(), ncomp, SyntaxNode::opCode, qualifier, sets, SyntaxNodeIx(), and SyntaxNode::values.
Referenced by ModelComp::deep_copy().
SyntaxNode* SyntaxNodeIx::getDummyVarExpr | ( | int | i | ) | const [inline] |
Retrieve the dummy variable for the specified indexing expression.
References dummyVarExpr.
Referenced by AmplModel::addDummyObjective(), getGlobalNameNew(), ModelComp::moveUp(), and AmplModel::writeTaggedComponents().
const SyntaxNode * SyntaxNodeIx::getIndexingSet | ( | ) | const |
for nodes that are indexing expressions, get the set that is indexed over
References SyntaxNode::begin(), SyntaxNode::front(), and SyntaxNode::getOpCode().
Referenced by process_model().
list< SyntaxNode * > SyntaxNodeIx::getListDummyVars | ( | ) | const |
Return the list of all dummy variables defined by this index's expression.
References SyntaxNode::begin(), dummyVarExpr, SyntaxNode::end(), SyntaxNode::front(), SyntaxNode::getOpCode(), ID, and ncomp.
Referenced by StochModel::_transcribeComponents(), buildPathProbTerm(), and process_model().
ModelComp* SyntaxNodeIx::getModelComp | ( | int | i | ) | const [inline] |
Retrieve the ModelComp for the specified indexing expression.
References sets_mc.
Referenced by CompDescrParam::CompDescrParam(), and labelToSetElement().
int SyntaxNodeIx::getNComp | ( | ) | const [inline] |
Retrieve the number of indexing expressions.
References ncomp.
Referenced by AmplModel::addDummyObjective(), CompDescrParam::CompDescrParam(), getGlobalNameNew(), ModelComp::moveUp(), and AmplModel::writeTaggedComponents().
SyntaxNode* SyntaxNodeIx::getSet | ( | int | i | ) | const [inline] |
Retrieve the set for the specified indexing expression.
References sets.
Referenced by AmplModel::addDummyObjective(), and AmplModel::writeTaggedComponents().
SyntaxNode * SyntaxNodeIx::hasDummyVar | ( | const std::string & | name | ) |
Find if the indexing expression defines the given dummy variable.
Find if the indexing expression given defines the given dummy variable.
name | The name of the dummy variable to look for. |
References SyntaxNode::begin(), dummyVarExpr, SyntaxNode::end(), SyntaxNode::front(), SyntaxNode::getOpCode(), IDNode::id(), logCreate, and ncomp.
Referenced by find_var_ref_in_indexing().
void SyntaxNodeIx::printDiagnostic | ( | std::ostream & | fout | ) | const |
Diagnostic printing of member variables.
References dummyVarExpr, ncomp, qualifier, and sets.
void SyntaxNodeIx::splitExpression | ( | ) |
Set up the ->sets, ->dummyVarExpr, ->ncomp, ->qualifier components.
References SyntaxNode::begin(), dummyVarExpr, SyntaxNode::end(), findKeywordinTree(), SyntaxNode::findModelComp(), SyntaxNode::front(), SyntaxNode::getOpCode(), IN, LBRACE, SyntaxNode::nchild(), ncomp, SyntaxNode::opCode, qualifier, sets, sets_mc, and TSET.
Referenced by ModelComp::dump(), find_var_ref_in_indexing(), and SyntaxNodeIx().
std::vector<SyntaxNode*> SyntaxNodeIx::dummyVarExpr [private] |
List of the dummyVarExpressions.
Referenced by deep_copy(), getDummyVarExpr(), getListDummyVars(), hasDummyVar(), printDiagnostic(), and splitExpression().
int SyntaxNodeIx::ncomp [private] |
Number of 'dummy IN set'-type expressions.
Referenced by deep_copy(), getListDummyVars(), getNComp(), hasDummyVar(), printDiagnostic(), splitExpression(), and SyntaxNodeIx().
SyntaxNode* SyntaxNodeIx::qualifier [private] |
The expresson to the right of the ':' (if present).
Referenced by deep_copy(), printDiagnostic(), splitExpression(), and SyntaxNodeIx().
std::vector<SyntaxNode*> SyntaxNodeIx::sets [private] |
List of the set expressions.
Referenced by deep_copy(), getSet(), printDiagnostic(), and splitExpression().
std::vector<ModelComp*> SyntaxNodeIx::sets_mc [private] |
List of ModelComp for the indexing sets.
Referenced by getModelComp(), and splitExpression().