Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBase


        }
      } else if (pattern != null) {
        return cvt.filterResources(pattern).size() > 0;
      }
    } else if (o instanceof SBase) {
      SBase sbase = (SBase) o;
      if (qualifier != null) {
        if (pattern != null) {
          if (sbase.filterCVTerms(qualifier, pattern).size() > 0) {
            return true;
          }
        } else if (sbase.filterCVTerms(qualifier).size() > 0) {
          return true;
        }
      }
    }
    return false;
View Full Code Here


      XMLNode xmlNode = (XMLNode) contextObject;

      xmlNode.addChild(textNode);
     
    } else if (contextObject instanceof SBase) {
      SBase parentSBMLElement = (SBase) contextObject;
     
      XMLNode xmlNode = null;

      if (parentSBMLElement.isSetNotes() && typeOfNotes.equals("notes"))
      {
        xmlNode = parentSBMLElement.getNotes();
      }
      else if (typeOfNotes.equals("message") && parentSBMLElement instanceof Constraint
          && ((Constraint) parentSBMLElement).isSetMessage())
      {
        xmlNode = ((Constraint) parentSBMLElement).getMessage();
      }
      else
      {
        logger.warn("The type of String " + typeOfNotes + " on the element " +
            parentSBMLElement.getElementName() + " is unknown !! Some data might be lost");
        return;
      }

      xmlNode.addChild(textNode);
     
View Full Code Here

  {
    logger.debug("processStartElement: element name = " + elementName);
   
    if (elementName.equals("notes")
        && (contextObject instanceof SBase)) {
      SBase sbase = (SBase) contextObject;
      sbase.setNotes(new XMLNode(new XMLTriple("notes", null, null), new XMLAttributes()));
      return contextObject;
    }
   
    // Creating a StartElement XMLNode !! 
    XMLNode xmlNode = new XMLNode(new XMLTriple(elementName, null, prefix), new XMLAttributes(), new XMLNamespaces());
   
    if (contextObject instanceof SBase) {
      SBase parentSBMLElement = (SBase) contextObject;
     
      if (typeOfNotes.equals("notes")) {
        parentSBMLElement.getNotes().addChild(xmlNode);
      } else if (typeOfNotes.equals("message") && parentSBMLElement instanceof Constraint) {
        ((Constraint) parentSBMLElement).getMessage().addChild(xmlNode);
      } else {
        logger.warn("The type of String " + typeOfNotes + " on the element " +
            parentSBMLElement.getElementName() + " is unknown !! Some data might be lost");
      }
     
    } else if (contextObject instanceof XMLNode) {
      XMLNode parentNode = (XMLNode) contextObject;
     
View Full Code Here

   
    boolean isAttributeRead = false;

    if (contextObject instanceof SBase) {

      SBase sbase = (SBase) contextObject;
     
      // logger.debug("processAttribute: level, version = " + sbase.getLevel() + ", " + sbase.getVersion());
     
      try {
        isAttributeRead = sbase.readAttribute(attributeName, prefix,
            value);
      } catch (Throwable exc) {
        logger.error(exc.getMessage());
      }
    }
View Full Code Here

   * @see org.sbml.jsbml.xml.parsers.WritingParser#writeAttributes(SBMLObjectForXML xmlObject, Object sbmlElementToWrite)
   */
  public void writeAttributes(SBMLObjectForXML xmlObject,
      Object sbmlElementToWrite) {
    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;

      xmlObject.addAttributes(sbase.writeXMLAttributes());
    }

  }
View Full Code Here

      Object sbmlElementToWrite) {

    logger.debug("writeElement: " + sbmlElementToWrite.getClass().getSimpleName());

    if (sbmlElementToWrite instanceof SBase) {
      SBase sbase = (SBase) sbmlElementToWrite;

      if (!sbase.getNamespaces().contains(getNamespaceURI())) {
        logger.debug("writeElement: rejected an element as it does not seems to have the good namespace definition");
        logger.debug("writeElement: sbase.namespaces size = " + sbase.getNamespaces().size());
        logger.debug("writeElement: sbase.namespaces = " + sbase.getNamespaces());

        return;
      }

      if (sbase instanceof ListOfWithName<?>) {
        xmlObject.setName(sbase.getElementName());
      }
     
      if (!xmlObject.isSetName()) {
        if (sbase instanceof ListOf<?>) {
          ListOf<?> listOf = (ListOf<?>) sbase;

          if (listOf.size() > 0) {
            String listOfName = "listOf" + listOf.get(0).getClass().getSimpleName();
            if (!listOfName.endsWith("s") && !listOfName.toLowerCase().endsWith("information")) {
              listOfName += 's';
            }
            xmlObject.setName(listOfName);
          }

        } else {
          xmlObject.setName(sbase.getElementName());
        }
      }
      if (!xmlObject.isSetPrefix()) {
        xmlObject.setPrefix(getShortLabel());
      }
View Full Code Here

  {
    if (sbmlElementToWrite instanceof SBase) {
      xmlObject.setPrefix(getShortLabel());
      xmlObject.setNamespace(getNamespaceURI());
     
      SBase sbase = (SBase) sbmlElementToWrite;

      if (sbase.getDeclaredNamespaces().size() > 0)
      {
        // writing all declared namespaces
        // TODO: check that the prefix start with xmlns
       
        xmlObject.addAttributes(sbase.getDeclaredNamespaces());
      }

    }
  }
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

  }
 
 
  public boolean isSBMLNamespaceNeeded(ASTNode astNode) {

    SBase sbase = astNode.getParentSBMLObject();
   
    if ((sbase != null) && (sbase.getLevel() < 3)) {
      return false;
    }

    findUnitsCompiler.reset();
   
View Full Code Here

   *            nodes already visited in the path
   */
  @SuppressWarnings("unchecked")
  private void findShortestPath(int i, Node<SBase> node,
      List<Node<SBase>> path) {
    SBase value;
    // Path has reached the desired length -> store it in the list
    if (path.size() == i * 2) {
      paths.add(path);
    } else {
      value = matching.get(node.getValue());
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.