Public Member Functions | Private Member Functions | Private Attributes

SyntaxNodeIx Class Reference

A node on the operator tree representing an indexing expression. More...

#include <nodes.h>

Inheritance diagram for SyntaxNodeIx:
SyntaxNode

List of all members.

Public Member Functions

 SyntaxNodeIx (SyntaxNode *on)
 Constructor.
SyntaxNodehasDummyVar (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.
SyntaxNodegetDummyVarExpr (int i) const
 Retrieve the dummy variable for the specified indexing expression.
SyntaxNodegetSet (int i) const
 Retrieve the set for the specified indexing expression.
ModelCompgetModelComp (int i) const
 Retrieve the ModelComp for the specified indexing expression.
void splitExpression ()
 Set up the ->sets, ->dummyVarExpr, ->ncomp, ->qualifier components.
SyntaxNodeIxdeep_copy ()
 Copy the node and all its subnodes into new data structures.
void printDiagnostic (std::ostream &fout) const
 Diagnostic printing of member variables.
const SyntaxNodegetIndexingSet () 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.
SyntaxNodequalifier
 The expresson to the right of the ':' (if present).
std::vector< ModelComp * > sets_mc
 List of ModelComp for the indexing sets.

Detailed Description

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).


Constructor & Destructor Documentation

SyntaxNodeIx::SyntaxNodeIx ( const int  opCode_  )  [inline, private]

Referenced by deep_copy().

SyntaxNodeIx::SyntaxNodeIx ( SyntaxNode on  ) 

Constructor.

References ncomp, qualifier, and splitExpression().


Member Function Documentation

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]
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.

Parameters:
name The name of the dummy variable to look for.
Returns:
The ("ID") SyntaxNode representing the dummy Variable (if found) or NULL (if not found)

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.


Member Data Documentation

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().

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().


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