상속: IDisposable
 public void test_EventAssignment_setMath2()
 {
     ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       int i = E.setMath(math);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, E.isSetMath() );
       math = null;
 }
 public void test_Constraint_setMath2()
 {
     ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       int i = C.setMath(math);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, C.isSetMath() );
       math = null;
 }
예제 #3
0
 public void test_ASTNode_addSemanticsAnnotation()
 {
     XMLNode ann = new XMLNode();
       ASTNode node = new  ASTNode();
       int i = 0;
       i = node.addSemanticsAnnotation(ann);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumSemanticsAnnotations() == 1 );
       i = node.addSemanticsAnnotation(null);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( node.getNumSemanticsAnnotations() == 1 );
       node = null;
 }
예제 #4
0
 public void test_ASTNode_addChild1()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       ASTNode c1_1 = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_LOGICAL_AND);
       c1.setName( "a");
       c2.setName( "b");
       node.addChild(c1);
       node.addChild(c2);
       assertTrue( node.getNumChildren() == 2 );
       assertTrue((  "and(a, b)" == libsbml.formulaToString(node) ));
       c1_1.setName( "d");
       i = node.addChild(c1_1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(a, b, d)" == libsbml.formulaToString(node) ));
       assertTrue((  "a" == node.getChild(0).getName() ));
       assertTrue((  "b" == node.getChild(1).getName() ));
       assertTrue((  "d" == node.getChild(2).getName() ));
       node = null;
 }
예제 #5
0
 public void test_ASTNode_removeChild()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_PLUS);
       c1.setName( "foo");
       c2.setName( "foo2");
       node.addChild(c1);
       node.addChild(c2);
       assertTrue( node.getNumChildren() == 2 );
       i = node.removeChild(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       i = node.removeChild(1);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( node.getNumChildren() == 1 );
       i = node.removeChild(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 0 );
       node = null;
 }
예제 #6
0
 public void test_ASTNode_one_child()
 {
     ASTNode node = new  ASTNode();
       ASTNode child = new  ASTNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getLeftChild() == child );
       assertTrue( node.getRightChild() == null );
       assertTrue( node.getChild(0) == child );
       assertTrue( node.getChild(1) == null );
       node = null;
 }
예제 #7
0
 public void test_ASTNode_children()
 {
     ASTNode parent = new  ASTNode();
       ASTNode left = new  ASTNode();
       ASTNode right = new  ASTNode();
       ASTNode right2 = new  ASTNode();
       parent.setType(libsbml.AST_PLUS);
       left.setValue(1);
       right.setValue(2);
       right2.setValue(3);
       parent.addChild(left);
       parent.addChild(right);
       assertTrue( parent.getNumChildren() == 2 );
       assertTrue( left.getNumChildren() == 0 );
       assertTrue( right.getNumChildren() == 0 );
       assertTrue( parent.getLeftChild() == left );
       assertTrue( parent.getRightChild() == right );
       assertTrue( parent.getChild(0) == left );
       assertTrue( parent.getChild(1) == right );
       assertTrue( parent.getChild(2) == null );
       parent.addChild(right2);
       assertTrue( parent.getNumChildren() == 3 );
       assertTrue( left.getNumChildren() == 0 );
       assertTrue( right.getNumChildren() == 0 );
       assertTrue( right2.getNumChildren() == 0 );
       assertTrue( parent.getLeftChild() == left );
       assertTrue( parent.getRightChild() == right2 );
       assertTrue( parent.getChild(0) == left );
       assertTrue( parent.getChild(1) == right );
       assertTrue( parent.getChild(2) == right2 );
       assertTrue( parent.getChild(3) == null );
       parent = null;
 }
예제 #8
0
 /**
    * Replace all nodes with the name 'id' from the child 'math' object with the provided function.
    *
    */
 /* libsbml-internal */
 public new void replaceSIDWithFunction(string id, ASTNode function)
 {
     libsbmlPINVOKE.Priority_replaceSIDWithFunction(swigCPtr, id, ASTNode.getCPtr(function));
 }
예제 #9
0
 public void test_ASTNode_create()
 {
     ASTNode n = new  ASTNode();
       EventAssignment ea = new  EventAssignment(2,4);
       assertTrue( n.getType() == libsbml.AST_UNKNOWN );
       assertTrue( n.getCharacter() == '\0' );
       assertTrue( n.getName() == null );
       assertTrue( n.getInteger() == 0 );
       assertTrue( n.getExponent() == 0 );
       assertTrue( n.getNumChildren() == 0 );
       assertTrue( n.getParentSBMLObject() == null );
       ea = null;
       n = null;
 }
예제 #10
0
 public void test_ASTNode_canonicalizeConstants()
 {
     ASTNode n = new  ASTNode();
       n.setName( "ExponentialE");
       assertEquals( true, n.isName() );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_CONSTANT_E );
       n.setType(libsbml.AST_NAME);
       n.setName( "False");
       assertEquals( true, n.isName() );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_CONSTANT_FALSE );
       n.setType(libsbml.AST_NAME);
       n.setName( "Pi");
       assertEquals( true, n.isName() );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_CONSTANT_PI );
       n.setType(libsbml.AST_NAME);
       n.setName( "True");
       assertEquals( true, n.isName() );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_CONSTANT_TRUE );
       n.setType(libsbml.AST_NAME);
       n.setName( "Foo");
       assertEquals( true, n.isName() );
       n.canonicalize();
       assertEquals( true, n.isName() );
       n = null;
 }
예제 #11
0
 public void test_ASTNode_setCharacter()
 {
     ASTNode node = new  ASTNode();
       node.setName( "foo");
       assertTrue( node.getType() == libsbml.AST_NAME );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue((  "foo" == node.getName() ));
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '+');
       assertTrue( node.getType() == libsbml.AST_PLUS );
       assertTrue( node.getCharacter() == '+' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '-');
       assertTrue( node.getType() == libsbml.AST_MINUS );
       assertTrue( node.getCharacter() == '-' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '*');
       assertTrue( node.getType() == libsbml.AST_TIMES );
       assertTrue( node.getCharacter() == '*' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '/');
       assertTrue( node.getType() == libsbml.AST_DIVIDE );
       assertTrue( node.getCharacter() == '/' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '^');
       assertTrue( node.getType() == libsbml.AST_POWER );
       assertTrue( node.getCharacter() == '^' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setCharacter( '$');
       assertTrue( node.getType() == libsbml.AST_UNKNOWN );
       assertTrue( node.getCharacter() == '$' );
       assertTrue( node.getName() == null );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node = null;
 }
예제 #12
0
 public void test_ASTNode_getPrecedence()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_PLUS);
       assertTrue( n.getPrecedence() == 2 );
       n.setType(libsbml.AST_MINUS);
       assertTrue( n.getPrecedence() == 2 );
       n.setType(libsbml.AST_TIMES);
       assertTrue( n.getPrecedence() == 3 );
       n.setType(libsbml.AST_DIVIDE);
       assertTrue( n.getPrecedence() == 3 );
       n.setType(libsbml.AST_POWER);
       assertTrue( n.getPrecedence() == 4 );
       n.setType(libsbml.AST_MINUS);
       n.addChild(new  ASTNode(libsbml.AST_NAME));
       assertTrue( n.isUMinus() == true );
       assertTrue( n.getPrecedence() == 5 );
       n.setType(libsbml.AST_NAME);
       assertTrue( n.getPrecedence() == 6 );
       n.setType(libsbml.AST_FUNCTION);
       assertTrue( n.getPrecedence() == 6 );
       n = null;
 }
예제 #13
0
 public void test_ASTNode_getName()
 {
     ASTNode n = new  ASTNode();
       n.setName( "foo");
       assertTrue((  "foo" == n.getName() ));
       n.setType(libsbml.AST_NAME_TIME);
       assertTrue((  "foo" == n.getName() ));
       n.setName(null);
       assertTrue( n.getName() == null );
       n.setType(libsbml.AST_CONSTANT_E);
       assertTrue((  "exponentiale" == n.getName() ));
       n.setType(libsbml.AST_CONSTANT_FALSE);
       assertTrue((  "false" == n.getName() ));
       n.setType(libsbml.AST_CONSTANT_PI);
       assertTrue((  "pi" == n.getName() ));
       n.setType(libsbml.AST_CONSTANT_TRUE);
       assertTrue((  "true" == n.getName() ));
       n.setType(libsbml.AST_LAMBDA);
       assertTrue((  "lambda" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION);
       n.setName( "f");
       assertTrue((  "f" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION_DELAY);
       assertTrue((  "f" == n.getName() ));
       n.setName(null);
       assertTrue((  "delay" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION);
       assertTrue( n.getName() == null );
       n.setType(libsbml.AST_FUNCTION_ABS);
       assertTrue((  "abs" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION_ARCCOS);
       assertTrue((  "arccos" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION_TAN);
       assertTrue((  "tan" == n.getName() ));
       n.setType(libsbml.AST_FUNCTION_TANH);
       assertTrue((  "tanh" == n.getName() ));
       n.setType(libsbml.AST_LOGICAL_AND);
       assertTrue((  "and" == n.getName() ));
       n.setType(libsbml.AST_LOGICAL_NOT);
       assertTrue((  "not" == n.getName() ));
       n.setType(libsbml.AST_LOGICAL_OR);
       assertTrue((  "or" == n.getName() ));
       n.setType(libsbml.AST_LOGICAL_XOR);
       assertTrue((  "xor" == n.getName() ));
       n.setType(libsbml.AST_RELATIONAL_EQ);
       assertTrue((  "eq" == n.getName() ));
       n.setType(libsbml.AST_RELATIONAL_GEQ);
       assertTrue((  "geq" == n.getName() ));
       n.setType(libsbml.AST_RELATIONAL_LT);
       assertTrue((  "lt" == n.getName() ));
       n.setType(libsbml.AST_RELATIONAL_NEQ);
       assertTrue((  "neq" == n.getName() ));
       n = null;
 }
예제 #14
0
 public void test_ASTNode_freeName()
 {
     ASTNode node = new  ASTNode();
       int i = 0;
       i = node.setName( "a");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue((  "a" == libsbml.formulaToString(node) ));
       assertTrue((  "a" == node.getName() ));
       i = node.freeName();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getName() == null );
       i = node.freeName();
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertTrue( node.getName() == null );
       node.setType(libsbml.AST_UNKNOWN);
       i = node.freeName();
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertTrue( node.getName() == null );
       node = null;
 }
예제 #15
0
 public void test_ASTNode_deepCopy_4()
 {
     ASTNode node = new  ASTNode(libsbml.AST_FUNCTION_ABS);
       ASTNode copy;
       node.setName( "ABS");
       assertTrue( node.getType() == libsbml.AST_FUNCTION_ABS );
       assertTrue((  "ABS" == node.getName() ));
       assertTrue( node.getNumChildren() == 0 );
       copy = node.deepCopy();
       assertTrue( copy != node );
       assertTrue( copy.getType() == libsbml.AST_FUNCTION_ABS );
       assertTrue((  "ABS" == copy.getName() ));
       assertTrue( copy.getNumChildren() == 0 );
       node = null;
       copy = null;
 }
예제 #16
0
 public void test_ASTNode_deepCopy_2()
 {
     ASTNode node = new  ASTNode();
       ASTNode copy;
       node.setName( "Foo");
       assertTrue( node.getType() == libsbml.AST_NAME );
       assertTrue((  "Foo" == node.getName() ));
       assertTrue( node.getNumChildren() == 0 );
       copy = node.deepCopy();
       assertTrue( copy != node );
       assertTrue( copy.getType() == libsbml.AST_NAME );
       assertTrue((  "Foo" == copy.getName() ));
       assertTrue( copy.getNumChildren() == 0 );
       node = null;
       copy = null;
 }
예제 #17
0
 public void test_ASTNode_deepCopy_1()
 {
     ASTNode node = new  ASTNode();
       ASTNode child, copy;
       node.setCharacter( '+');
       node.addChild(new  ASTNode());
       node.addChild(new  ASTNode());
       node.getLeftChild().setValue(1);
       node.getRightChild().setValue(2);
       assertTrue( node.getType() == libsbml.AST_PLUS );
       assertTrue( node.getCharacter() == '+' );
       assertTrue( node.getNumChildren() == 2 );
       child = node.getLeftChild();
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 1 );
       assertTrue( child.getNumChildren() == 0 );
       child = node.getRightChild();
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 2 );
       assertTrue( child.getNumChildren() == 0 );
       copy = node.deepCopy();
       assertTrue( copy != node );
       assertTrue( copy.getType() == libsbml.AST_PLUS );
       assertTrue( copy.getCharacter() == '+' );
       assertTrue( copy.getNumChildren() == 2 );
       child = copy.getLeftChild();
       assertTrue( child != node.getLeftChild() );
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 1 );
       assertTrue( child.getNumChildren() == 0 );
       child = copy.getRightChild();
       assertTrue( child != node.getRightChild() );
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 2 );
       assertTrue( child.getNumChildren() == 0 );
       node = null;
       copy = null;
 }
예제 #18
0
 public void test_ASTNode_avogadro()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_NAME_AVOGADRO);
       n.setName( "NA");
       assertTrue((  "NA" == n.getName() ));
       double val = n.getReal();
       assertTrue( val == 6.02214179e23 );
       n = null;
 }
예제 #19
0
 public void test_ASTNode_replaceChild()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       ASTNode c3 = new  ASTNode();
       ASTNode newc = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_LOGICAL_AND);
       c1.setName( "a");
       c2.setName( "b");
       c3.setName( "c");
       node.addChild(c1);
       node.addChild(c2);
       node.addChild(c3);
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(a, b, c)" == libsbml.formulaToString(node) ));
       newc.setName( "d");
       i = node.replaceChild(0,newc);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, b, c)" == libsbml.formulaToString(node) ));
       i = node.replaceChild(3,newc);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, b, c)" == libsbml.formulaToString(node) ));
       i = node.replaceChild(1,c1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, a, c)" == libsbml.formulaToString(node) ));
       node = null;
 }
예제 #20
0
 public void test_ASTNode_getReal()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_REAL);
       n.setValue(1.6);
       assertTrue( n.getReal() == 1.6 );
       n.setType(libsbml.AST_REAL_E);
       n.setValue(12.3,3);
       double val = Math.Abs(n.getReal() - 12300.0);
       assertTrue( val < DBL_EPSILON );
       n.setType(libsbml.AST_RATIONAL);
       n.setValue(1,2);
       assertTrue( n.getReal() == 0.5 );
       n = null;
 }
예제 #21
0
 public void test_ASTNode_setInteger()
 {
     ASTNode node = new  ASTNode();
       node.setName( "foo");
       assertTrue( node.getType() == libsbml.AST_NAME );
       assertTrue((  "foo" == node.getName() ));
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setValue(3.2);
       assertTrue( node.getType() == libsbml.AST_REAL );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 3.2 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setValue(321);
       assertTrue( node.getType() == libsbml.AST_INTEGER );
       assertTrue( node.getInteger() == 321 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node = null;
 }
예제 #22
0
 /**
    * If this assignment assigns a value to the 'id' element, replace the 'math' object with the function (existing*function).
    */
 /* libsbml-internal */
 public new void multiplyAssignmentsToSIdByFunction(string id, ASTNode function)
 {
     libsbmlPINVOKE.SBasePlugin_multiplyAssignmentsToSIdByFunction(swigCPtr, id, ASTNode.getCPtr(function));
 }
예제 #23
0
 public void prepend(ASTNode item)
 {
     libsbmlPINVOKE.ASTNodeList_prepend(swigCPtr, ASTNode.getCPtr(item));
 }
 public void test_KineticLaw_setMath2()
 {
     ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       int i = kl.setMath(math);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, kl.isSetMath() );
       math = null;
 }
 public void test_KineticLaw_setMath1()
 {
     ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       ASTNode b = new  ASTNode();
       a.setName( "a");
       b.setName( "b");
       math.addChild(a);
       math.addChild(b);
       string formula;
       ASTNode math1;
       int i = kl.setMath(math);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, kl.isSetMath() );
       math1 = kl.getMath();
       assertTrue( math1 != null );
       formula = libsbml.formulaToString(math1);
       assertTrue( formula != null );
       assertTrue((  "a * b" == formula ));
       math = null;
 }
예제 #26
0
 public void test_ASTNode_isSqrt()
 {
     ASTNode n = new  ASTNode();
       ASTNode c;
       n.setType(libsbml.AST_FUNCTION);
       assertTrue( n.isSqrt() == false );
       n.setType(libsbml.AST_FUNCTION_ROOT);
       assertTrue( n.isSqrt() == false );
       c = new  ASTNode();
       n.addChild(c);
       c.setValue(2);
       assertTrue( n.isSqrt() == false );
       n.addChild(new  ASTNode());
       assertTrue( n.isSqrt() == true );
       c.setValue(3);
       assertTrue( n.isSqrt() == false );
       n = null;
 }
예제 #27
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;
        }
예제 #28
0
 public void test_ASTNode_isUMinus()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_MINUS);
       assertTrue( n.isUMinus() == false );
       n.addChild(new  ASTNode(libsbml.AST_NAME));
       assertTrue( n.isUMinus() == true );
       n = null;
 }
예제 #29
0
 /**
    * Sets the math expression of this Priority instance to a copy of the given
    * ASTNode.
    *
    * @param math an ASTNode representing a formula tree.
    *
    * @return integer value indicating success/failure of the
    * function.  @if clike The value is drawn from the
    * enumeration #OperationReturnValues_t.  @endif The possible values
    * returned by this function are:
    * @li @link libsbmlcs#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbmlcs#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    */
 public int setMath(ASTNode math)
 {
     int ret = libsbmlPINVOKE.Priority_setMath(swigCPtr, ASTNode.getCPtr(math));
     return ret;
 }
예제 #30
0
 public void test_ASTNode_no_children()
 {
     ASTNode node = new  ASTNode();
       assertTrue( node.getNumChildren() == 0 );
       assertTrue( node.getLeftChild() == null );
       assertTrue( node.getRightChild() == null );
       assertTrue( node.getChild(0) == null );
       node = null;
 }