------------------------------
| 27 | |
| 28 | //------------------------------ |
| 29 | void setFragments( MathML::AST::INode* astNode, const Formula::ASTNodeASTNodeMap& originalClonedASTNodeMap) |
| 30 | { |
| 31 | switch ( astNode->getNodeType() ) |
| 32 | { |
| 33 | case MathML::AST::INode::ARITHMETIC: |
| 34 | { |
| 35 | MathML::AST::ArithmeticExpression* arithmetic = (MathML::AST::ArithmeticExpression*)astNode; |
| 36 | MathML::AST::NodeList& operands = arithmetic->getOperands(); |
| 37 | for ( size_t i = 0, count = operands.size(); i < count; ++i ) |
| 38 | { |
| 39 | setFragments(operands[i], originalClonedASTNodeMap); |
| 40 | } |
| 41 | break; |
| 42 | } |
| 43 | case MathML::AST::INode::COMPARISON: |
| 44 | { |
| 45 | MathML::AST::BinaryComparisonExpression* comparison = (MathML::AST::BinaryComparisonExpression*)astNode; |
| 46 | setFragments(comparison->getLeftOperand(), originalClonedASTNodeMap); |
| 47 | setFragments(comparison->getRightOperand(), originalClonedASTNodeMap); |
| 48 | break; |
| 49 | } |
| 50 | case MathML::AST::INode::CONSTANT: |
| 51 | case MathML::AST::INode::VARIABLE: |
| 52 | break; |
| 53 | case MathML::AST::INode::FRAGMENT: |
| 54 | { |
| 55 | MathML::AST::FragmentExpression* fragment = (MathML::AST::FragmentExpression*)astNode; |
| 56 | MathML::AST::INode* fragmentNode = fragment->getFragment(); |
| 57 | Formula::ASTNodeASTNodeMap::const_iterator it = originalClonedASTNodeMap.find(fragmentNode); |
| 58 | COLLADABU_ASSERT( it != originalClonedASTNodeMap.end() ); |
| 59 | fragment->setFragment( it->second ); |
| 60 | break; |
| 61 | } |
| 62 | case MathML::AST::INode::LOGICAL: |
| 63 | { |
| 64 | MathML::AST::LogicExpression* logical = (MathML::AST::LogicExpression*)astNode; |
| 65 | MathML::AST::NodeList& operands = logical->getOperands(); |
| 66 | for ( size_t i = 0, count = operands.size(); i < count; ++i ) |
| 67 | { |
| 68 | setFragments(operands[i], originalClonedASTNodeMap); |
| 69 | } |
| 70 | break; |
| 71 | } |
| 72 | case MathML::AST::INode::UNARY: |
| 73 | { |
| 74 | MathML::AST::UnaryExpression* unary = (MathML::AST::UnaryExpression*)astNode; |
| 75 | setFragments(unary->getOperand(), originalClonedASTNodeMap); |
| 76 | break; |
| 77 | } |
| 78 | case MathML::AST::INode::FUNCTION: |
| 79 | { |
| 80 | MathML::AST::FunctionExpression* func = (MathML::AST::FunctionExpression*)astNode; |
| 81 | MathML::AST::NodeList& operands = func->getParameterList(); |
| 82 | for ( size_t i = 0, count = operands.size(); i < count; ++i ) |
| 83 | { |
| 84 | setFragments(operands[i], originalClonedASTNodeMap); |
| 85 | } |
| 86 | break; |
no test coverage detected