libsbml.ASTNode.getRightChild C# (CSharp) Method

getRightChild() public method

public getRightChild ( ) : ASTNode
return ASTNode
        public ASTNode getRightChild()
        {
            IntPtr cPtr = libsbmlPINVOKE.ASTNode_getRightChild(swigCPtr);
            ASTNode ret = (cPtr == IntPtr.Zero) ? null : new ASTNode(cPtr, false);
            return ret;
        }

Usage Example

Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="anASTNode"></param>
        /// <returns></returns>
        private ASTNode convertVariableName(ASTNode anASTNode)
        {
            long aNumChildren = anASTNode.getNumChildren();

            if ( aNumChildren == 2 )
            {
                this.convertVariableName( anASTNode.getLeftChild() );
                this.convertVariableName( anASTNode.getRightChild() );

                return anASTNode;
            }
            else if ( aNumChildren == 1 )
            {
                this.convertVariableName( anASTNode.getLeftChild() );
                return anASTNode;
            }
            else if ( aNumChildren == 0 )
            {
                if ( anASTNode.isNumber() )
                {
                }
                else
                {
                    string aName = anASTNode.getName();
                    string variableName = "";

                    // Check Species
                    foreach(SpeciesStruct aSpecies in this.Model.SpeciesList)
                    {
                        if ( aSpecies.ID != aName && aSpecies.Name != aName)
                            continue;

                        // Check VariableReference
                        foreach(VariableReferenceStruct aVariableReference in this.VariableReferenceList)
                            if (aVariableReference.Variable.Split(':')[2] == aName)
                                variableName =  aVariableReference.Name;
                        if (variableName == "")
                        {
                            string aModifierID = this.Model.getSpeciesReferenceID(aName);

                            VariableReferenceStruct varRef = new VariableReferenceStruct(
                                "C" + this.ModifierNumber.ToString(),
                                "Variable:" + aModifierID,
                                0);
                            this.VariableReferenceList.Add(varRef);

                            variableName = varRef.Name;
                            this.ModifierNumber++;
                        }
                        //string compartmentName = this.setCompartmentToVariableReference( aSpecies.Compartment );
                        //anASTNode.setType( libsbml.libsbml.AST_DIVIDE );
                        //anASTNode.addChild( new ASTNode( libsbml.libsbml.AST_NAME ) );
                        //anASTNode.addChild( new ASTNode( libsbml.libsbml.AST_NAME ) );
                        //anASTNode.getLeftChild().setName( variableName + ".Value" );
                        //anASTNode.getRightChild().setName( compartmentName + ".Value" ) ;
                        anASTNode.setName(variableName + ".Value");
                        return anASTNode;
                    }

                    // Check Parameters.
                    foreach(ParameterStruct aParameter in this.Model.ParameterList)
                    {
                        if (aParameter.ID != aName && aParameter.Name != aName)
                            continue;
                        foreach(VariableReferenceStruct aVariableReference in this.VariableReferenceList)
                            if (aVariableReference.Variable.Split(':')[2] == aName)
                                variableName = aVariableReference.Name;

                        if( variableName == "" )
                        {
                            VariableReferenceStruct varRef = new VariableReferenceStruct(
                                aName,
                                "Variable:/:" + aName,
                                0 );
                            this.VariableReferenceList.Add( varRef );

                            this.ParameterNumber++;
                            variableName = varRef.Name;
                        }

                        anASTNode.setName( variableName + ".Value" );

                        return anASTNode;
                    }
            //                if variableName == '':
                    variableName = this.setCompartmentToVariableReference( aName );
                    if (variableName != "")
                        anASTNode.setName( variableName + ".Value" );
                }
            }
            return anASTNode;
        }
All Usage Examples Of libsbml.ASTNode::getRightChild