本文整理汇总了C#中libsbml.ASTNode.isNumber方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.isNumber方法的具体用法?C# ASTNode.isNumber怎么用?C# ASTNode.isNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.ASTNode
的用法示例。
在下文中一共展示了ASTNode.isNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: convertVariableName
/// <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;
}
示例2: convertVariableName
/// <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() );
}
else if ( aNumChildren == 1 )
{
this.convertVariableName( anASTNode.getLeftChild() );
}
else if ( aNumChildren == 0 )
{
if ( anASTNode.isNumber() )
{
}
else
{
string aName = anASTNode.getName();
int aType = this.getVariableType( aName );
//# Species
if ( aType == libsbml.libsbml.SBML_SPECIES )
{
string variableName = this.setSpeciesToVariableReference( aName , 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
//# Parameter
else if ( aType == libsbml.libsbml.SBML_PARAMETER )
{
string variableName = this.setParameterToVariableReference( aName , 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
//# Compartment
else if (aType == libsbml.libsbml.SBML_COMPARTMENT)
{
string variableName = this.setCompartmentToVariableReference(aName, 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
}
}
return anASTNode;
}