public void test_Parameter_createWithNS() {
   XMLNamespaces xmlns = new XMLNamespaces();
   xmlns.add("http://www.sbml.org", "testsbml");
   SBMLNamespaces sbmlns = new SBMLNamespaces(2, 1);
   sbmlns.addNamespaces(xmlns);
   Parameter object = new Parameter(sbmlns);
   assertTrue(object.getTypeCode() == libsbml.SBML_PARAMETER);
   assertTrue(object.getMetaId().equals("") == true);
   assertTrue(object.getNotes() == null);
   assertTrue(object.getAnnotation() == null);
   assertTrue(object.getLevel() == 2);
   assertTrue(object.getVersion() == 1);
   assertTrue(object.getNamespaces() != null);
   assertTrue(object.getNamespaces().getLength() == 2);
   object = null;
 }
Ejemplo n.º 2
0
 /**
  * Returns <code>true</code> or <code>false</code> depending on whether the given {@link XMLNode}
  * object contains valid XHTML content.
  *
  * <p>In SBML, the content of the 'notes' subelement available on {@link SBase}, as well as the
  * 'message' subelement available on {@link Constraint}, must conform to <a target='_blank'
  * href='http://www.w3.org/TR/xhtml1/'>XHTML&nbsp;1.0</a> (which is simply an XML-ized version of
  * HTML). However, the content cannot be <em>entirely</em> free-form; it must satisfy certain
  * requirements defined in the <a target='_blank'
  * href='http://sbml.org/Documents/Specifications'>SBML specifications</a> for specific SBML
  * Levels. This method implements a verification process that lets callers check whether the
  * content of a given {@link XMLNode} object conforms to the SBML requirements for 'notes' and
  * 'message' structure.
  *
  * <p>An aspect of XHTML validity is that the content is declared to be in the XML namespace for
  * XHTML&nbsp;1.0. There is more than one way in which this can be done in XML. In particular, a
  * model might not contain the declaration within the 'notes' or 'message' subelement itself, but
  * might instead place the declaration on an enclosing element and use an XML namespace prefix
  * within the 'notes' element to refer to it. In other words, the following is valid: <div
  * class='fragment'>
  *
  * <pre>
  * &lt;sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3'
  * xmlns:xhtml='http://www.w3.org/1999/xhtml'&gt;
  * &lt;model&gt;
  * &lt;notes&gt;
  * &lt;xhtml:body&gt;
  * &lt;xhtml:center&gt;&lt;xhtml:h2&gt;A Simple Mitotic Oscillator&lt;/xhtml:h2&gt;&lt;/xhtml:center&gt;
  * &lt;xhtml:p&gt;A minimal cascade model for the mitotic oscillator.&lt;/xhtml:p&gt;
  * &lt;/xhtml:body&gt;
  * &lt;/notes&gt;
  * ... rest of model ...
  * &lt;/sbml&gt;
  * </pre>
  *
  * </div> Contrast the above with the following, self-contained version, which places the XML
  * namespace declaration within the <code>&lt;notes&gt;</code> element itself: <div
  * class='fragment'>
  *
  * <pre>
  * &lt;sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3'&gt;
  * &lt;model&gt;
  * &lt;notes&gt;
  * &lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;
  * &lt;head&gt;
  * &lt;title/&gt;
  * &lt;/head&gt;
  * &lt;body&gt;
  * &lt;center&gt;&lt;h2&gt;A Simple Mitotic Oscillator&lt;/h2&gt;&lt;/center&gt;
  * A minimal cascade model for the mitotic oscillator.&lt;/p&gt;
  * &lt;/body&gt;
  * &lt;/html&gt;
  * &lt;/notes&gt;
  * ... rest of model ...
  * &lt;/sbml&gt;
  * </pre>
  *
  * </div>
  *
  * <p>Both of the above are valid XML. The purpose of the <code>sbmlns</code> argument to this
  * method is to allow callers to check the validity of 'notes' and 'message' subelements whose XML
  * namespace declarations have been put elsewhere in the manner illustrated above. Callers can can
  * pass in the {@link SBMLNamespaces} object of a higher-level model component if the {@link
  * XMLNode} object does not itself have the XML namespace declaration for XHTML&nbsp;1.0.
  *
  * <p>
  *
  * @param xhtml the {@link XMLNode} to be checked for conformance.
  * @param sbmlns the {@link SBMLNamespaces} associated with the object.
  *     <p>
  * @return <code>true</code> if the {@link XMLNode} content conforms, <code>false</code>
  *     otherwise.
  *     <p>
  * @docnote The native C++ implementation of this method defines a default argument value. In the
  *     documentation generated for different libSBML language bindings, you may or may not see
  *     corresponding arguments in the method declarations. For example, in Java, a default
  *     argument is handled by declaring two separate methods, with one of them having the argument
  *     and the other one lacking the argument. However, the libSBML documentation will be
  *     <em>identical</em> for both methods. Consequently, if you are reading this and do not see
  *     an argument even though one is described, please look for descriptions of other variants of
  *     this method near where this one appears in the documentation.
  */
 public static boolean hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns) {
   return libsbmlJNI.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_0(
       XMLNode.getCPtr(xhtml), xhtml, SBMLNamespaces.getCPtr(sbmlns), sbmlns);
 }
Ejemplo n.º 3
0
 /**
  * Creates a new {@link UnitDefinition} using the given {@link SBMLNamespaces} object <code>sbmlns
  * </code>.
  *
  * <p>
  *
  * <p>The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces information. It
  * is used to communicate the SBML Level, Version, and (in Level&nbsp;3) packages used in addition
  * to SBML Level&nbsp;3 Core. A common approach to using libSBML's {@link SBMLNamespaces}
  * facilities is to create an {@link SBMLNamespaces} object somewhere in a program once, then hand
  * that object as needed to object constructors that accept {@link SBMLNamespaces} as arguments.
  *
  * <p>
  *
  * @param sbmlns an {@link SBMLNamespaces} object.
  *     <p>
  * @throws SBMLConstructorException Thrown if the given <code>level</code> and <code>version
  *     </code> combination, or this kind of SBML object, are either invalid or mismatched with
  *     respect to the parent {@link SBMLDocument} object.
  *     <p>
  *     <p>
  * @note Attempting to add an object to an {@link SBMLDocument} having a different combination of
  *     SBML Level, Version and XML namespaces than the object itself will result in an error at
  *     the time a caller attempts to make the addition. A parent object must have compatible
  *     Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML
  *     namespaces than a child, but the reverse is not permitted.) The restriction is necessary to
  *     ensure that an SBML model has a consistent overall structure. This requires callers to
  *     manage their objects carefully, but the benefit is increased flexibility in how models can
  *     be created by permitting callers to create objects bottom-up if desired. In situations
  *     where objects are not yet attached to parents (e.g., {@link SBMLDocument}), knowledge of
  *     the intented SBML Level and Version help libSBML determine such things as whether it is
  *     valid to assign a particular value to an attribute.
  */
 public UnitDefinition(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
   this(libsbmlJNI.new_UnitDefinition__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
 }
Ejemplo n.º 4
0
 /**
  * Creates a new {@link LocalParameter} object with the given {@link SBMLNamespaces} object <code>
  * sbmlns</code>.
  *
  * <p>
  *
  * <p>The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces information. It
  * is used to communicate the SBML Level, Version, and (in Level&nbsp;3) packages used in addition
  * to SBML Level&nbsp;3 Core. A common approach to using libSBML's {@link SBMLNamespaces}
  * facilities is to create an {@link SBMLNamespaces} object somewhere in a program once, then hand
  * that object as needed to object constructors that accept {@link SBMLNamespaces} as arguments.
  *
  * <p>It is worth emphasizing that although this constructor does not take an identifier argument,
  * in SBML Level&nbsp;2 and beyond, the 'id' (identifier) attribute of a {@link LocalParameter} is
  * required to have a value. Thus, callers are cautioned to assign a value after calling this
  * constructor if no identifier is provided as an argument. Setting the identifier can be
  * accomplished using the method setId(String id).
  *
  * <p>
  *
  * @param sbmlns an {@link SBMLNamespaces} object.
  *     <p>
  * @throws SBMLConstructorException Thrown if the given <code>level</code> and <code>version
  *     </code> combination, or this kind of SBML object, are either invalid or mismatched with
  *     respect to the parent {@link SBMLDocument} object.
  *     <p>
  *     <p>
  * @note Upon the addition of a {@link Compartment} object to an {@link SBMLDocument} (e.g., using
  *     {@link Model#addCompartment(Compartment c)}), the SBML Level, SBML Version and XML
  *     namespace of the document <em>override</em> the values used when creating the {@link
  *     Compartment} object via the {@link Compartment} constructors. This is necessary to ensure
  *     that an SBML document has a consistent overall structure. Nevertheless, the ability to
  *     supply the values at the time of creation of a {@link Compartment} is an important aid to
  *     producing valid SBML. Knowledge of the intented SBML Level and Version determine whether it
  *     is valid to assign a particular value to an attribute, or whether it is valid to add an
  *     object to an existing {@link SBMLDocument}.
  */
 public LocalParameter(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
   this(libsbmlJNI.new_LocalParameter__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
 }
 /**
  * Creates a new {@link ListOfSpeciesReferences} object.
  *
  * <p>The object is constructed such that it is valid for the SBML Level and Version combination
  * determined by the {@link SBMLNamespaces} object in <code>sbmlns</code>.
  *
  * <p>
  *
  * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the characteristics of
  *     the {@link ListOfSpeciesReferences} object to be created.
  */
 public ListOfSpeciesReferences(SBMLNamespaces sbmlns)
     throws org.sbml.libsbml.SBMLConstructorException {
   this(
       libsbmlJNI.new_ListOfSpeciesReferences__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns),
       true);
 }
Ejemplo n.º 6
0
 /**
  * Creates a new {@link Event} using the given {@link SBMLNamespaces} object <code>sbmlns</code>.
  *
  * <p>
  *
  * <p>The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces information. It
  * is used to communicate the SBML Level, Version, and (in Level&nbsp;3) packages used in addition
  * to SBML Level&nbsp;3 Core. A common approach to using libSBML's {@link SBMLNamespaces}
  * facilities is to create an {@link SBMLNamespaces} object somewhere in a program once, then hand
  * that object as needed to object constructors that accept {@link SBMLNamespaces} as arguments.
  *
  * <p>
  *
  * @param sbmlns an {@link SBMLNamespaces} object.
  *     <p>
  * @throws SBMLConstructorException Thrown if the given <code>level</code> and <code>version
  *     </code> combination, or this kind of SBML object, are either invalid or mismatched with
  *     respect to the parent {@link SBMLDocument} object.
  *     <p>
  *     <p>
  * @note Upon the addition of an {@link Event} object to an {@link SBMLDocument} (e.g., using
  *     {@link Model#addEvent(Event e)}), the SBML Level, SBML Version and XML namespace of the
  *     document <em>override</em> the values used when creating the {@link Event} object via this
  *     constructor. This is necessary to ensure that an SBML document is a consistent structure.
  *     Nevertheless, the ability to supply the values at the time of creation of an {@link Event}
  *     is an important aid to producing valid SBML. Knowledge of the intented SBML Level and
  *     Version determine whether it is valid to assign a particular value to an attribute, or
  *     whether it is valid to add an object to an existing {@link SBMLDocument}.
  */
 public Event(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException {
   this(libsbmlJNI.new_Event__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
 }