Inheritance: IDisposable
 public void test_Node_clone()
 {
     XMLAttributes att = new XMLAttributes();
       XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");
       XMLToken token = new XMLToken(t,att,3,4);
       XMLNode node = new XMLNode(token);
       XMLNode child = new XMLNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getName() ==  "sarah" );
       assertTrue( node.getURI() ==  "http://foo.org/" );
       assertTrue( node.getPrefix() ==  "bar" );
       assertTrue( node.isEnd() == false );
       assertTrue( node.isEOF() == false );
       assertTrue( node.getLine() == 3 );
       assertTrue( node.getColumn() == 4 );
       XMLNode node2 = (XMLNode) node.clone();
       assertTrue( node2.getNumChildren() == 1 );
       assertTrue( node2.getName() ==  "sarah" );
       assertTrue( node2.getURI() ==  "http://foo.org/" );
       assertTrue( node2.getPrefix() ==  "bar" );
       assertTrue( node2.isEnd() == false );
       assertTrue( node2.isEOF() == false );
       assertTrue( node2.getLine() == 3 );
       assertTrue( node2.getColumn() == 4 );
       t = null;
       token = null;
       node = null;
       node2 = null;
 }
 XMLNode(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces) : this(libsbmlPINVOKE.new_XMLNode__SWIG_4(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), XMLNamespaces.getCPtr(namespaces)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 XMLNode(XMLTriple triple, XMLAttributes attributes, long line, long column) : this(libsbmlPINVOKE.new_XMLNode__SWIG_5(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), line, column), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
        XMLAttributes clone()
        {
            IntPtr        cPtr = libsbmlPINVOKE.XMLAttributes_clone(swigCPtr);
            XMLAttributes ret  = (cPtr == IntPtr.Zero) ? null : new XMLAttributes(cPtr, true);

            return(ret);
        }
Beispiel #5
0
        XMLAttributes getResources()
        {
            IntPtr        cPtr = libsbmlPINVOKE.CVTerm_getResources__SWIG_0(swigCPtr);
            XMLAttributes ret  = (cPtr == IntPtr.Zero) ? null : new XMLAttributes(cPtr, false);

            return(ret);
        }
 XMLAttributes(XMLAttributes orig) : this(libsbmlPINVOKE.new_XMLAttributes__SWIG_1(XMLAttributes.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void test_XMLToken_newSetters_addAttributes1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       XMLTriple xt2 = new  XMLTriple("name3", "http://name3.org/", "p3");
       int i = token.addAttr( "name1", "val1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributesLength() == 1 );
       assertTrue( token.isAttributesEmpty() == false );
       assertTrue( (  "name1" != token.getAttrName(0) ) == false );
       assertTrue( (  "val1"  != token.getAttrValue(0) ) == false );
       i = token.addAttr( "name2", "val2", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributesLength() == 2 );
       assertTrue( token.isAttributesEmpty() == false );
       assertTrue( (  "name2" != token.getAttrName(1) ) == false );
       assertTrue( (  "val2"  != token.getAttrValue(1) ) == false );
       assertTrue( (  "http://name1.org/" != token.getAttrURI(1) ) == false );
       assertTrue( (  "p1"    != token.getAttrPrefix(1) ) == false );
       i = token.addAttr(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributesLength() == 3 );
       assertTrue( token.isAttributesEmpty() == false );
       assertTrue( (  "name3" != token.getAttrName(2) ) == false );
       assertTrue( (  "val2"  != token.getAttrValue(2) ) == false );
       assertTrue( (  "http://name3.org/" != token.getAttrURI(2) ) == false );
       assertTrue( (  "p3"    != token.getAttrPrefix(2) ) == false );
       xt2 = null;
       triple = null;
       attr = null;
       token = null;
 }
 public void test_XMLNode_clearAttributes()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLTriple xt2 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1 = new  XMLTriple("name5", "http://name5.org/", "p5");
       int i = node.addAttr( "name1", "val1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 1 );
       i = node.addAttr( "name2", "val2", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 2 );
       i = node.addAttr(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 3 );
       i = node.addAttr( "name4", "val4");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 4 );
       i = node.clearAttributes();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getAttributes().getLength() == 0 );
       xt1 = null;
       xt2 = null;
       triple = null;
       attr = null;
       node = null;
 }
Beispiel #9
0
        bool readAttributes(XMLAttributes attributes, SWIGTYPE_p_ExpectedAttributes expectedAttributes, XMLInputStream stream, XMLToken element)
        {
            bool ret = libsbmlPINVOKE.ASTBase_readAttributes(swigCPtr, XMLAttributes.getCPtr(attributes), SWIGTYPE_p_ExpectedAttributes.getCPtr(expectedAttributes), XMLInputStream.getCPtr(stream), XMLToken.getCPtr(element));

            if (libsbmlPINVOKE.SWIGPendingException.Pending)
            {
                throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        internal static HandleRef getCPtrAndDisown(XMLAttributes obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
                ptr             = obj.swigCPtr;
                obj.swigCMemOwn = false;
            }

            return(ptr);
        }
 public void test_XMLNode_addChild2()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNode node2 = new XMLNode();
       int i = node.addChild(node2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       triple = null;
       attr = null;
       node = null;
       node2 = null;
 }
 public void test_XMLAttributes_add1()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       int i = xa.add( "name1", "val1", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       i = xa.add( "noprefix", "val3");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       xa = null;
       xt2 = null;
 }
 public void test_XMLAttributes_assignment()
 {
     XMLAttributes att1 = new XMLAttributes();
       att1.add("xmlns", "http://foo.org/");
       assertTrue( att1.getLength() == 1 );
       assertTrue( att1.isEmpty() == false );
       assertTrue( att1.getIndex("xmlns") == 0 );
       assertTrue( att1.getName(0) ==   "xmlns"  );
       assertTrue( att1.getValue("xmlns") ==  "http://foo.org/"  );
       XMLAttributes att2 = new XMLAttributes();
       att2 = att1;
       assertTrue( att2.getLength() == 1 );
       assertTrue( att2.isEmpty() == false );
       assertTrue( att2.getIndex("xmlns") == 0 );
       assertTrue( att2.getName(0) ==   "xmlns"  );
       assertTrue( att2.getValue("xmlns") ==  "http://foo.org/"  );
       att2 = null;
       att1 = null;
 }
 public void test_XMLAttributes_add_get()
 {
     XMLAttributes attrs = new XMLAttributes();
       assertTrue( attrs.getLength() == 0 );
       assertEquals( true, attrs.isEmpty() );
       attrs.add("xmlns", "http://foo.org/");
       assertTrue( attrs.getLength() == 1 );
       assertTrue( attrs.isEmpty() == false );
       attrs.add("foo", "bar");
       assertTrue( attrs.getLength() == 2 );
       assertTrue( attrs.isEmpty() == false );
       assertTrue( attrs.getIndex("xmlns") == 0 );
       assertTrue( attrs.getIndex("foo"  ) == 1 );
       assertTrue( attrs.getIndex("bar"  ) == -1 );
       assertTrue( attrs.getValue("xmlns") ==  "http://foo.org/"  );
       assertTrue( attrs.getValue("foo"  ) ==  "bar"              );
       assertTrue( attrs.getValue("bar"  ) ==  ""                 );
       assertTrue( attrs.getName(0) ==  "xmlns"  );
       assertTrue( attrs.getName(1) ==  "foo"    );
       assertTrue( attrs.getName(2) ==  ""       );
 }
 public void test_SyntaxChecker_validXHTML()
 {
     XMLToken token;
       XMLNode node;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken tt = new  XMLToken("This is my text");
       XMLNode n1 = new XMLNode(tt);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
       triple = new  XMLTriple("html", "", "");
       ns.clear();
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(n1);
       assertTrue( SyntaxChecker.hasExpectedXHTMLSyntax(node,null) == false );
 }
Beispiel #16
0
 public void test_CVTerm_createFromNode()
 {
     XMLAttributes xa;
       XMLTriple qual_triple = new  XMLTriple("is", "", "bqbiol");
       XMLTriple bag_triple = new  XMLTriple();
       XMLTriple li_triple = new  XMLTriple();
       XMLAttributes att = new  XMLAttributes();
       att.add( "", "This is my resource");
       XMLAttributes att1 = new  XMLAttributes();
       XMLToken li_token = new  XMLToken(li_triple,att);
       XMLToken bag_token = new  XMLToken(bag_triple,att1);
       XMLToken qual_token = new  XMLToken(qual_triple,att1);
       XMLNode li = new XMLNode(li_token);
       XMLNode bag = new XMLNode(bag_token);
       XMLNode node = new XMLNode(qual_token);
       bag.addChild(li);
       node.addChild(bag);
       CVTerm term = new  CVTerm(node);
       assertTrue( term != null );
       assertTrue( term.getQualifierType() == libsbml.BIOLOGICAL_QUALIFIER );
       assertTrue( term.getBiologicalQualifierType() == libsbml.BQB_IS );
       xa = term.getResources();
       assertTrue( xa.getLength() == 1 );
       assertTrue((  "rdf:resource" == xa.getName(0) ));
       assertTrue((  "This is my resource" == xa.getValue(0) ));
       qual_triple = null;
       bag_triple = null;
       li_triple = null;
       li_token = null;
       bag_token = null;
       qual_token = null;
       att = null;
       att1 = null;
       term = null;
       node = null;
       bag = null;
       li = null;
 }
 public void test_XMLAttributes_remove1()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       int i = xa.add( "name1", "val1", "http://name1.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add(xt2, "val2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add( "noprefix", "val3");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       i = xa.add( "name4", "val4", "http://name4.org/", "p1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 4 );
       i = xa.remove(4);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       i = xa.remove(3);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 3 );
       i = xa.remove( "noprefix");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 2 );
       i = xa.remove(xt2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 1 );
       i = xa.remove( "name1", "http://name1.org/");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( xa.getLength() == 0 );
       xa = null;
       xt2 = null;
 }
Beispiel #18
0
 public void test_Constraint_copyConstructor()
 {
     Constraint o1 = new Constraint(2,4);
       o1.setMetaId("c");
       assertTrue( o1.getMetaId() ==  "c" );
       XMLNode text = XMLNode.convertStringToXMLNode(" Some text ");
       XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", "");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces xmlns = new XMLNamespaces();
       xmlns.add("http://www.w3.org/1999/xhtml");
       XMLNode p = new XMLNode(triple,att,xmlns);
       p.addChild(text);
       XMLTriple triple1 = new XMLTriple("message", "", "");
       XMLAttributes att1 = new XMLAttributes();
       XMLNode message = new XMLNode(triple1,att1);
       message.addChild(p);
       ASTNode math = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(math);
       o1.setMessage(message);
       math = null;
       message = null;
       XMLNode msg;
       assertTrue( o1.getMath() != null );
       msg = o1.getMessage();
       assertTrue( msg != null );
       Constraint o2 = new Constraint(o1);
       assertTrue( o2.getMetaId() ==  "c" );
       assertTrue( o2.getMath() != null );
       msg = o2.getMessage();
       assertTrue( msg != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 /**
    * Copy constructor; creates a copy of this XMLAttributes object.
    *
    * @p orig the XMLAttributes object to copy.
    */
 public XMLAttributes(XMLAttributes orig)
     : this(libsbmlPINVOKE.new_XMLAttributes__SWIG_1(XMLAttributes.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_XMLToken_newSetters_removeNamespaces1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       token.addNamespace( "http://test1.org/", "test1");
       assertTrue( token.getNamespacesLength() == 1 );
       int i = token.removeNamespace( "test2");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( token.getNamespacesLength() == 1 );
       i = token.removeNamespace( "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getNamespacesLength() == 0 );
       token = null;
       triple = null;
       attr = null;
 }
 internal static HandleRef getCPtr(XMLAttributes obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #22
0
 /**
    * Sets the MathML attribute @c definitionURL.
    *
    * @param url the URL value for the @c definitionURL attribute.
    *
    * @return integer value indicating success/failure of the
    * function.  The possible values returned by this function are:
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink
    *
    * @see setDefinitionURL(string url)
    * @see getDefinitionURL()
    * @see getDefinitionURLString()
    */
 public int setDefinitionURL(XMLAttributes url)
 {
     int ret = libsbmlPINVOKE.ASTNode_setDefinitionURL__SWIG_0(swigCPtr, XMLAttributes.getCPtr(url));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Beispiel #23
0
 public void test_SBase_appendNotes()
 {
     XMLToken token;
       XMLNode node;
       XMLToken token1;
       XMLNode node1;
       XMLNode node2;
       XMLTriple triple = new  XMLTriple("p", "", "");
       XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLToken token4 = new  XMLToken("This is my text");
       XMLNode node4 = new XMLNode(token4);
       XMLToken token5 = new  XMLToken("This is additional text");
       XMLNode node5 = new XMLNode(token5);
       token = new  XMLToken(triple,att,ns);
       node = new XMLNode(token);
       node.addChild(node4);
       S.setNotes(node);
       assertTrue( S.isSetNotes() == true );
       token1 = new  XMLToken(triple,att,ns);
       node1 = new XMLNode(token1);
       node1.addChild(node5);
       S.appendNotes(node1);
       assertTrue( S.isSetNotes() == true );
       node2 = S.getNotes();
       assertTrue( node2.getNumChildren() == 2 );
       assertTrue((  "p" == node2.getChild(0).getName() ));
       assertTrue( node2.getChild(0).getNumChildren() == 1 );
       assertTrue((  "p" == node2.getChild(1).getName() ));
       assertTrue( node2.getChild(1).getNumChildren() == 1 );
       string chars1 = node2.getChild(0).getChild(0).getCharacters();
       string chars2 = node2.getChild(1).getChild(0).getCharacters();
       assertTrue((  "This is my text" == chars1 ));
       assertTrue((  "This is additional text" == chars2 ));
       node = null;
       node1 = null;
 }
Beispiel #24
0
 /** */
 /* libsbml-internal */
 public new bool readAttributes(XMLAttributes attributes, SWIGTYPE_p_ExpectedAttributes expectedAttributes, XMLInputStream stream, XMLToken element)
 {
     bool ret = libsbmlPINVOKE.ASTBase_readAttributes(swigCPtr, XMLAttributes.getCPtr(attributes), SWIGTYPE_p_ExpectedAttributes.getCPtr(expectedAttributes), XMLInputStream.getCPtr(stream), XMLToken.getCPtr(element));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Beispiel #25
0
 /**
    * Returns the attributes of the XML element represented by this token.
    *
    * @return the attributes of this XML element, stored in an XMLAttributes
    * object.
    */
 public XMLAttributes getAttributes()
 {
     XMLAttributes ret = new XMLAttributes(libsbmlPINVOKE.XMLToken_getAttributes(swigCPtr), false);
     return ret;
 }
Beispiel #26
0
 /**
    * Creates an XML start element with attributes.
    *
    * @param triple an XMLTriple object describing the start tag.
    *
    * @param attributes XMLAttributes, the attributes to set on the element to
    * be created.
    *
    * @param line a long integer, the line number to associate with the
    * token (default = 0).
    *
    * @param column a long integer, the column number to associate with the
    * token (default = 0).
    *
    * The XML namespace component of this XMLToken object will be left empty.
    * See the other variants of the XMLToken constructors for versions that
    * take namespace arguments.
    *
    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
    */
 public XMLToken(XMLTriple triple, XMLAttributes attributes)
     : this(libsbmlPINVOKE.new_XMLToken__SWIG_6(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_XMLToken_newSetters_removeAttributes1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       XMLTriple xt2 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1 = new  XMLTriple("name5", "http://name5.org/", "p5");
       int i = token.addAttr( "name1", "val1");
       i = token.addAttr( "name2", "val2", "http://name1.org/", "p1");
       i = token.addAttr(xt2, "val2");
       i = token.addAttr( "name4", "val4");
       assertTrue( token.getAttributes().getLength() == 4 );
       i = token.removeAttr(7);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       i = token.removeAttr( "name7");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       i = token.removeAttr( "name7", "namespaces7");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       i = token.removeAttr(xt1);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( token.getAttributes().getLength() == 4 );
       i = token.removeAttr(3);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributes().getLength() == 3 );
       i = token.removeAttr( "name1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributes().getLength() == 2 );
       i = token.removeAttr( "name2", "http://name1.org/");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributes().getLength() == 1 );
       i = token.removeAttr(xt2);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getAttributes().getLength() == 0 );
       xt1 = null;
       xt2 = null;
       triple = null;
       attr = null;
       token = null;
 }
Beispiel #28
0
 /**
    * Creates an XML start element with attributes and namespace declarations.
    *
    * @param triple an XMLTriple object describing the start tag.
    *
    * @param attributes XMLAttributes, the attributes to set on the element to
    * be created.
    *
    * @param namespaces XMLNamespaces, the namespaces to set on the element to
    * be created.
    *
    * @param line a long integer, the line number to associate with the
    * token (default = 0).
    *
    * @param column a long integer, the column number to associate with the
    * token (default = 0).
    *
    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
    */
 public XMLToken(XMLTriple triple, XMLAttributes attributes, XMLNamespaces namespaces, long line)
     : this(libsbmlPINVOKE.new_XMLToken__SWIG_2(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), XMLNamespaces.getCPtr(namespaces), line), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Beispiel #29
0
 /**
    * Creates a start element XMLNode with the given set of attributes.
    *
    * @param triple XMLTriple.
    * @param attributes XMLAttributes, the attributes to set.
    * @param line a long integer, the line number (default = 0).
    * @param column a long integer, the column number (default = 0).
    *
    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
   */
 public XMLNode(XMLTriple triple, XMLAttributes attributes, long line, long column)
     : this(libsbmlPINVOKE.new_XMLNode__SWIG_5(XMLTriple.getCPtr(triple), XMLAttributes.getCPtr(attributes), line, column), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_XMLToken_newSetters_addNamespaces1()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLToken token = new  XMLToken(triple,attr);
       assertTrue( token.getNamespacesLength() == 0 );
       assertTrue( token.isNamespacesEmpty() == true );
       int i = token.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( token.getNamespacesLength() == 1 );
       assertTrue( token.isNamespacesEmpty() == false );
       attr = null;
       triple = null;
       token = null;
 }
 public void test_XMLAttributes_add_remove_qname_C()
 {
     XMLAttributes xa = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       XMLTriple xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
       XMLTriple xt3 = new  XMLTriple("name3", "http://name3.org/", "p3");
       XMLTriple xt1a = new  XMLTriple("name1", "http://name1a.org/", "p1a");
       XMLTriple xt2a = new  XMLTriple("name2", "http://name2a.org/", "p2a");
       xa.add( "name1", "val1", "http://name1.org/", "p1");
       xa.add(xt2, "val2");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "val1"  != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2" != xa.getName(1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"    != xa.getPrefix(1) ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1"  != xa.getValue( "name1", "http://name1.org/") ) == false );
       assertTrue( (  "val2"  != xa.getValue( "name2", "http://name2.org/") ) == false );
       assertTrue( (  "val1"  != xa.getValue(xt1) ) == false );
       assertTrue( (  "val2"  != xa.getValue(xt2) ) == false );
       assertTrue( xa.hasAttribute(-1) == false );
       assertTrue( xa.hasAttribute(2) == false );
       assertTrue( xa.hasAttribute(0) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "name2", "http://name2.org/") == true );
       assertTrue( xa.hasAttribute( "name3", "http://name3.org/") == false );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute(xt2) == true );
       assertTrue( xa.hasAttribute(xt3) == false );
       xa.add( "noprefix", "val3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "val3"     != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( (  "val3"  != xa.getValue( "noprefix", "") ) == false );
       assertTrue( xa.hasAttribute( "noprefix"    ) == true );
       assertTrue( xa.hasAttribute( "noprefix", "") == true );
       xa.add(xt1, "mval1");
       xa.add( "name2", "mval2", "http://name2.org/", "p2");
       xa.add( "noprefix", "mval3");
       assertTrue( xa.getLength() == 3 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name1" != xa.getName(0) ) == false );
       assertTrue( (  "mval1" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name1.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p1"    != xa.getPrefix(0) ) == false );
       assertTrue( (  "name2"    != xa.getName(1) ) == false );
       assertTrue( (  "mval2"    != xa.getValue(1) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(1) ) == false );
       assertTrue( (  "p2"       != xa.getPrefix(1) ) == false );
       assertTrue( (  "noprefix" != xa.getName(2) ) == false );
       assertTrue( (  "mval3"    != xa.getValue(2) ) == false );
       assertTrue( xa.getURI(2) == "" );
       assertTrue( xa.getPrefix(2) == "" );
       assertTrue( xa.hasAttribute(xt1) == true );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == true );
       assertTrue( xa.hasAttribute( "noprefix") == true );
       xa.add(xt1a, "val1a");
       xa.add(xt2a, "val2a");
       assertTrue( xa.getLength() == 5 );
       assertTrue( (  "name1" != xa.getName(3) ) == false );
       assertTrue( (  "val1a" != xa.getValue(3) ) == false );
       assertTrue( (  "http://name1a.org/" != xa.getURI(3) ) == false );
       assertTrue( (  "p1a" != xa.getPrefix(3) ) == false );
       assertTrue( (  "name2" != xa.getName(4) ) == false );
       assertTrue( (  "val2a" != xa.getValue(4) ) == false );
       assertTrue( (  "http://name2a.org/" != xa.getURI(4) ) == false );
       assertTrue( (  "p2a" != xa.getPrefix(4) ) == false );
       assertTrue( (  "mval1"  != xa.getValue( "name1") ) == false );
       assertTrue( (  "mval2"  != xa.getValue( "name2") ) == false );
       assertTrue( (  "val1a"  != xa.getValue( "name1", "http://name1a.org/") ) == false );
       assertTrue( (  "val2a"  != xa.getValue( "name2", "http://name2a.org/") ) == false );
       assertTrue( (  "val1a"  != xa.getValue(xt1a) ) == false );
       assertTrue( (  "val2a"  != xa.getValue(xt2a) ) == false );
       xa.remove(xt1a);
       xa.remove(xt2a);
       assertTrue( xa.getLength() == 3 );
       xa.remove( "name1", "http://name1.org/");
       assertTrue( xa.getLength() == 2 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "name2" != xa.getName(0) ) == false );
       assertTrue( (  "mval2" != xa.getValue(0) ) == false );
       assertTrue( (  "http://name2.org/" != xa.getURI(0) ) == false );
       assertTrue( (  "p2" != xa.getPrefix(0) ) == false );
       assertTrue( (  "noprefix" != xa.getName(1) ) == false );
       assertTrue( (  "mval3" != xa.getValue(1) ) == false );
       assertTrue( xa.getURI(1) == "" );
       assertTrue( xa.getPrefix(1) == "" );
       assertTrue( xa.hasAttribute( "name1", "http://name1.org/") == false );
       xa.remove(xt2);
       assertTrue( xa.getLength() == 1 );
       assertTrue( xa.isEmpty() == false );
       assertTrue( (  "noprefix" != xa.getName(0) ) == false );
       assertTrue( (  "mval3" != xa.getValue(0) ) == false );
       assertTrue( xa.getURI(0) == "" );
       assertTrue( xa.getPrefix(0) == "" );
       assertTrue( xa.hasAttribute(xt2) == false );
       assertTrue( xa.hasAttribute( "name2", "http://name2.org/") == false );
       xa.remove( "noprefix", "");
       assertTrue( xa.getLength() == 0 );
       assertTrue( xa.isEmpty() == true );
       assertTrue( xa.hasAttribute( "noprefix"    ) == false );
       assertTrue( xa.hasAttribute( "noprefix", "") == false );
       xa = null;
       xt1 = null;
       xt2 = null;
       xt3 = null;
       xt1a = null;
       xt2a = null;
 }
Beispiel #32
0
 public void test_WriteSBML_Constraint_full()
 {
     D.setLevelAndVersion(2,2,false);
       string expected = "<constraint sboTerm=\"SBO:0000064\">\n" +
     "  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "    <apply>\n" +
     "      <leq/>\n" +
     "      <ci> P1 </ci>\n" +
     "      <ci> t </ci>\n" +
     "    </apply>\n" +
     "  </math>\n" +
     "  <message>\n" +
     "    <p xmlns=\"http://www.w3.org/1999/xhtml\"> Species P1 is out of range </p>\n" +
     "  </message>\n" +
     "</constraint>";
       Constraint c = D.createModel().createConstraint();
       ASTNode node = libsbml.parseFormula("leq(P1,t)");
       c.setMath(node);
       c.setSBOTerm(64);
       XMLNode text = XMLNode.convertStringToXMLNode(" Species P1 is out of range ");
       XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", "");
       XMLAttributes att = new XMLAttributes();
       XMLNamespaces xmlns = new XMLNamespaces();
       xmlns.add("http://www.w3.org/1999/xhtml");
       XMLNode p = new XMLNode(triple,att,xmlns);
       p.addChild(text);
       XMLTriple triple1 = new XMLTriple("message", "", "");
       XMLAttributes att1 = new XMLAttributes();
       XMLNode message = new XMLNode(triple1,att1);
       message.addChild(p);
       c.setMessage(message);
       assertEquals( true, equals(expected,c.toSBML()) );
 }
Beispiel #33
0
 public void test_SBase_appendNotes8()
 {
     XMLAttributes att = new  XMLAttributes();
       XMLNamespaces ns = new  XMLNamespaces();
       ns.add( "http://www.w3.org/1999/xhtml", "");
       XMLTriple body_triple = new  XMLTriple("body", "", "");
       XMLTriple p_triple = new  XMLTriple("p", "", "");
       XMLToken body_token = new  XMLToken(body_triple,att,ns);
       XMLToken p_token = new  XMLToken(p_triple,att);
       XMLToken text_token = new  XMLToken("This is my text");
       XMLNode body_node = new XMLNode(body_token);
       XMLNode p_node = new XMLNode(p_token);
       XMLNode text_node = new XMLNode(text_token);
       XMLToken p_token1 = new  XMLToken(p_triple,att,ns);
       XMLToken text_token1 = new  XMLToken("This is more text");
       XMLNode p_node1 = new XMLNode(p_token1);
       XMLNode text_node1 = new XMLNode(text_token1);
       XMLNode notes;
       XMLNode child, child1;
       p_node.addChild(text_node);
       body_node.addChild(p_node);
       p_node1.addChild(text_node1);
       S.setNotes(body_node);
       S.appendNotes(p_node1);
       notes = S.getNotes();
       assertTrue((  "notes" == notes.getName() ));
       assertTrue( notes.getNumChildren() == 1 );
       child = notes.getChild(0);
       assertTrue((  "body" == child.getName() ));
       assertTrue( child.getNumChildren() == 2 );
       child1 = child.getChild(0);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is my text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       child1 = child.getChild(1);
       assertTrue((  "p" == child1.getName() ));
       assertTrue( child1.getNumChildren() == 1 );
       child1 = child1.getChild(0);
       assertTrue((  "This is more text" == child1.getCharacters() ));
       assertTrue( child1.getNumChildren() == 0 );
       att = null;
       ns = null;
       body_triple = null;
       p_triple = null;
       body_token = null;
       p_token = null;
       text_token = null;
       text_token1 = null;
       p_token1 = null;
       body_node = null;
       p_node = null;
       text_node = null;
       p_node1 = null;
       text_node1 = null;
 }
 internal static HandleRef getCPtr(XMLAttributes obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void test_XMLNode_removeNamespaces()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLAttributes attr = new  XMLAttributes();
       XMLNode node = new XMLNode(triple,attr);
       XMLNamespaces nms;
       int i = node.addNamespace( "http://test1.org/", "test1");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.addNamespace( "http://test2.org/", "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(7);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace( "name7");
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 2 );
       i = node.removeNamespace(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 1 );
       i = node.removeNamespace( "test2");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       nms = node.getNamespaces();
       assertTrue( nms.getLength() == 0 );
       triple = null;
       attr = null;
       node = null;
 }
        internal static HandleRef getCPtrAndDisown(XMLAttributes obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Beispiel #37
0
 /**
    * Sets the attributes on the XML element represented by this token.
    *
    *
  *
  * This operation only makes sense for XML start elements.  This
  * method will return @link libsbml#LIBSBML_INVALID_XML_OPERATION LIBSBML_INVALID_XML_OPERATION@endlink if this XMLToken object is not an XML start
  * element.
  *
  *
    *
    * @param attributes an XMLAttributes object to be assigned to this
    * XMLToken object, thereby setting the XML attributes associated with this
    * token.
    *
    *
  * @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 libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
    * @li @link libsbml#LIBSBML_INVALID_XML_OPERATION LIBSBML_INVALID_XML_OPERATION@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    *
    * @note This function replaces any existing XMLAttributes object
    * on this XMLToken object with the one given by @p attributes.
    */
 public int setAttributes(XMLAttributes attributes)
 {
     int ret = libsbmlPINVOKE.XMLToken_setAttributes(swigCPtr, XMLAttributes.getCPtr(attributes));
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
 public void test_XMLToken_newSetters_setAttributes2()
 {
     XMLTriple triple = new  XMLTriple("test","","");
       XMLToken token = new  XMLToken(triple);
       XMLAttributes nattr = new  XMLAttributes();
       XMLTriple xt1 = new  XMLTriple("name1", "http://name1.org/", "p1");
       nattr.add(xt1, "val1");
       int i = token.setAttributes(nattr);
       assertTrue( i == libsbml.LIBSBML_INVALID_XML_OPERATION );
       assertTrue( token.isAttributesEmpty() == true );
       nattr = null;
       triple = null;
       token = null;
       xt1 = null;
 }