Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBase


    Set<String> packageNamespaces = null;

    // logger.debug("getInitializedParsers: name space, object = " + name space + ", " + object);

    if (object instanceof SBase) {
      SBase sbase = (SBase) object;
      packageNamespaces = new TreeSet<String>();

      for (String sbaseNamespace : sbase.getNamespaces()) {
        if (!packageNamespaces.contains(sbaseNamespace)) {
          packageNamespaces.add(sbaseNamespace);
        }
      }
View Full Code Here


      // TODO: add all other namespaces !!

      if (isSBMLNamespaceNeeded) {
        // writing the SBML namespace
        SBMLDocument doc = null;
        SBase sbase = m.getMath().getParentSBMLObject();
        String sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
       
        if (sbase != null) {
          doc = sbase.getSBMLDocument();
          sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns");
         
          if (sbmlNamespace == null) {
            logger.warn("writeMathML: the SBML namespace of this SBMLDocument" +
                " could not be found, using the default namespace (" +
View Full Code Here

        {
          newOutPutElement.addAttribute(attributeName, childXmlObject.getAttributes().get(attributeName));         
        }
       
        if (nextObjectToWrite instanceof SBase) {
          SBase s = (SBase) nextObjectToWrite;
          if (s.isSetNotes()) {
            writeNotes(s, newOutPutElement, streamWriter,
                newOutPutElement.getNamespace()
                .getURI(), indent + indentCount);
            elementIsNested = true;
          }
          if (s.isSetAnnotation()) {
            writeAnnotation(s, newOutPutElement,
                streamWriter,
                indent + indentCount, false);
            elementIsNested = isClosedAnnotation = true;
          }
          if (s.getChildCount() > 0) {
            // make sure that we'll have line breaks if an element has any sub elements.
            elementIsNested = true;
          }
        }
        if (nextObjectToWrite instanceof MathContainer) {
View Full Code Here

        ListOf<SBase> listOf = (ListOf<SBase>) sbase;

        if (!listOf.isEmpty()) {
          listOfElementsToWrite = new ArrayList<Object>();
          for (int i = 0; i < listOf.size(); i++) {
            SBase element = listOf.get(i);

            if (element != null) {
              listOfElementsToWrite.add(element);
            }
          }
View Full Code Here

  public void processAttribute(String elementName, String attributeName,
      String value, String prefix, boolean isLastAttribute,
      Object contextObject) {
    boolean isAttributeRead = false;
    if (contextObject instanceof SBase) {
      SBase sbase = (SBase) contextObject;
      try {
        isAttributeRead = sbase.readAttribute(attributeName, prefix,
            value);
      } catch (Throwable exc) {
        System.err.println(exc.getMessage());
      }
    } else if (contextObject instanceof Annotation) {
View Full Code Here

        Object newContextObject = SBMLCoreElements.get(elementName)
            .newInstance();
       
        if (elementName.equals("notes")
            && contextObject instanceof SBase) {
          SBase sbase = (SBase) contextObject;
          sbase.setNotes(new XMLNode(new XMLTriple("notes", null, null), new XMLAttributes()));
        } else if (elementName.equals("annotation")
            && contextObject instanceof SBase) {
          SBase sbase = (SBase) contextObject;
          Annotation annotation = (Annotation) newContextObject;
          sbase.setAnnotation(annotation);

          return annotation;
        } else if (contextObject instanceof SBMLDocument) {
          SBMLDocument sbmlDocument = (SBMLDocument) contextObject;
          if (elementName.equals("model")) {
View Full Code Here

   * xml.stax.SBMLObjectForXML, java.lang.Object)
   */
  public void writeAttributes(SBMLObjectForXML xmlObject,
      Object sbmlElementToWrite) {
    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;

      xmlObject.addAttributes(sbase.writeXMLAttributes());
    }
  }
View Full Code Here

   */
  public void writeElement(SBMLObjectForXML xmlObject,
      Object sbmlElementToWrite) {

    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;
      if (!xmlObject.isSetName()) {
        if (sbase.getElementName().equals("species")) {
          xmlObject.setName("specie");
        } else if (sbase.getElementName().equals("speciesReference")) {
          xmlObject.setName("specieReference");
        } else if (sbase.getElementName().equals("assignementRule")) {
          AssignmentRule assignmentRule = (AssignmentRule) sbase;
          Variable variable = assignmentRule.getVariableInstance();

          if (variable instanceof Species) {
            xmlObject.setName("specieConcentrationRule");
          } else if (variable instanceof Compartment) {
            xmlObject.setName("compartmentVolumeRule");
          } else if (variable instanceof Parameter) {
            xmlObject.setName("parameterRule");
          }
        } else {
          xmlObject.setName(sbase.getElementName());
        }
      }
    }
  }
View Full Code Here

   * xml.stax.SBMLObjectForXML, java.lang.Object)
   */
  public void writeNamespaces(SBMLObjectForXML xmlObject,
      Object sbmlElementToWrite) {
    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;

      if (sbase instanceof SBMLDocument) {
        SBMLDocument sbmlDocument = (SBMLDocument) sbmlElementToWrite;

        xmlObject.addAttributes(sbmlDocument
View Full Code Here

      writer.writeNamespace(null, ASTNode.URI_MATHML_DEFINITION)
     
      if (isSBMLNamespaceNeeded) {
        // writing the SBML namespace
        SBMLDocument doc = null;
        SBase sbase = astNode.getParentSBMLObject();
        String sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core;
       
        if (sbase != null) {
          doc = sbase.getSBMLDocument();
          sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns");         
        }
        writer.writeNamespace("sbml", sbmlNamespace);
      }
     
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.SBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.