Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBase


      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


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

   * 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

   *            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

      List<SBase> variables, int level) {
    // found node with species 
    if ((node.getChildCount() == 0) && (node.isString()) && (node.getType() != Type.NAME_TIME) && (node.getType() != Type.NAME_AVOGADRO)) {
      if (!node.isConstant()) {       
        if (param == null) {
          SBase variable=node.getVariable();
          if(level==1) {
            int insertingPosition=0;
            for(SBase element:variables) {
              if(!(element instanceof Parameter) || (!((Parameter)element).isSetValue())) {
                insertingPosition++;
              }
            }
            variables.add(insertingPosition, variable);
          }
          else {
            variables.add(variable);
          }
        } else {
          if (!param.contains(node.getVariable())) {
            SBase variable=node.getVariable();
            if(level==1) {
              int insertingPosition=0;
              for(SBase element:variables) {
                if(!(element instanceof Parameter) || (!((Parameter)element).isSetValue())) {
                  insertingPosition++;
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) {
              boolean add = true;
              if (element instanceof UnitDefinition) {
                UnitDefinition ud = (UnitDefinition) element;
View Full Code Here

    // A SBMLCoreParser can modify a contextObject which is an instance of
    // SBase.
    // Try to read the attributes.
    if (contextObject instanceof SBase) {
      SBase sbase = (SBase) contextObject;
      try {
        isAttributeRead = sbase.readAttribute(attributeName, prefix,
            value);
      } catch (Throwable exc) {
        log4jLogger.error(exc.getMessage());
        log4jLogger.info("Attribute = " + attributeName + ", element = " + elementName);
      }
View Full Code Here

      }
     
      log4jLogger.debug("processNamespace : " + prefix + " = " + URI);
    }
    else if (contextObject instanceof SBase) {
      SBase sbase = (SBase) contextObject;
     
      if (prefix != null && prefix.length() > 0) {
        sbase.addDeclaredNamespace(prefix + ":" + localName, URI);
      } else {
        sbase.addDeclaredNamespace(localName, URI);
      }

      log4jLogger.debug("processNamespace : " + prefix + " = " + URI);
    }
    else if (contextObject instanceof Annotation) {
      Annotation sbase = (Annotation) contextObject;
      sbase.addAnnotationNamespace(localName, prefix, URI);
     
      log4jLogger.debug("processNamespace : " + prefix + " = " + URI);
    }
  }
View Full Code Here

              (SBase) contextObject);
        }

        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

   * @param newContextObject
   * @param parent
   */
  private void setLevelAndVersionFor(Object newContextObject, SBase parent) {
    if (newContextObject instanceof SBase) {
      SBase sb = (SBase) newContextObject;
      // Level and version will be -1 if not set, so we don't
      // have to check.
      sb.setLevel(parent.getLevel());
      sb.setVersion(parent.getVersion());
    }
  }
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.