Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLException


      if (attributeName.equals(MultiConstants.occurrence)) {
        try {
          setOccurence(BOND_OCCURRENCE_TYPE.valueOf(value));
          isAttributeRead = true;
        } catch (Exception e) {
          throw new SBMLException("Could not recognized the value '" + value
            + "' for the attribute " + MultiConstants.occurrence
            + " on the 'bond' element.");
        }
      }
    }
View Full Code Here


  public void removeSampledVolume(int i) {
    if (!isSetListOfSampledVolumes()) {
      throw new IndexOutOfBoundsException(Integer.toString(i));
    }
    if (getListOfSampledVolumes().size()<=1) {
      throw new SBMLException("There must be at least one SampledVolume defined for this list");
    }
    getListOfSampledVolumes().remove(i);
  }
View Full Code Here

  public void removeCSGObject(int i) {
    if (!isSetListOfCSGObjects()) {
      throw new IndexOutOfBoundsException(Integer.toString(i));
    }
    if (getListOfCSGObjects().size() == 1) {
      throw new SBMLException("There must be at least one AnalyticVolume defined for this list");
    }
    getListOfCSGObjects().remove(i);
  }
View Full Code Here

    firePropertyChange(SpatialConstants.type, oldType, this.type);
  }

  public void setType(String type) {
    if (!Pattern.matches("[a-z]*", type)) {
      throw new SBMLException("The value is not all lower-case.");
    }
    setType(Type.valueOf(type.toUpperCase()));
  }
View Full Code Here

  public void removeInteriorPoint(int i) {
    if (!isSetListOfInteriorPoints()) {
      throw new IndexOutOfBoundsException(Integer.toString(i));
    }
    if (getListOfInteriorPoints().size()<=1) {
      throw new SBMLException("There must be at least one InteriorPoint defined for this list");
    }
    getListOfInteriorPoints().remove(i);
  }
View Full Code Here

    {
      setType(Type.fromString(type));
    }
    catch (Exception e)
    {
      throw new SBMLException("Could not recognized the value '" + type
        + "' for the attribute " + FBCConstants.type
        + " on the 'objective' element.");
    }
  }
View Full Code Here

    System.out.println("Trying to add the cloned reaction to the model, which should not be possible");
    // Trying to add the
    boolean operationSuccessful = m.addReaction(clonedReaction);

    if (operationSuccessful != false) {
      throw new SBMLException("It should not be possible to add two elements with the same id in a ListOf class !!");
    }
    // Here the parent is still null as it should as the cloned reaction
    // was not added to the model as her id is the same as the reaction 'r'
    System.out.println("Cloned reaction parent and model still null  : " + clonedReaction.getParent() + " " + clonedReaction.getModel() + "\n");

    // setting a new unit id the the cloned reaction
    clonedReaction.setId("id2");
   
    System.out.println("Trying to add the cloned reaction to the model, with a new unique id. It is still not possible as the metaids are not unique.");
    try {
      m.addReaction(clonedReaction);
      throw new SBMLException("It should not be possible to add two elements with the same metaid in a SBML document !!");
    } catch (IllegalArgumentException e) {
      // success, the exception should be thrown there
    }

    // setting a new unique metaid to the reaction but not it's sub-elements
    clonedReaction.setMetaId("meta3");  
   
    System.out.println("Trying to add the cloned reaction to the model, with a new unique id and metaid. It is still not possible as the metaids are not unique.");
    try {
      operationSuccessful = m.addReaction(clonedReaction);
      throw new SBMLException("It should not be possible to add a reaction that has any sub-elements with a non unique metaid !!");
    } catch (IllegalArgumentException e) {
      // success, the exception should be thrown there
    }

    System.out.println("Trying to add the cloned reaction to the model, with a new unique id and metaid for all sub-elements.");
    // setting a new unique metaid to the reaction and all it's sub-elements
    clonedReaction.getReactant(0).setMetaId("meta4");

    // At the moment (rev 768), the reaction cannot be added to the model as the metaid 'meta3' as
    // been added in the list of metaids in the previous call to addReaction() where only the speciesReference id
    // was invalid
    try {
      operationSuccessful = m.addReaction(clonedReaction);

      if (operationSuccessful != true) {
        throw new SBMLException("It should be possible to add a reaction with an unique ids and metaids to a model !!");
      }
    } catch (IllegalArgumentException e) {
      // bug here
      System.out.println("Bug detected : there is a problem in the recursive adding of metaids !!!");
      System.out.println("The reaction was not added to the model where it should have been");
View Full Code Here

        setLevel(StringTools.parseSBMLInt(value));
      } else if (attributeName.equals(QualConstants.transitionEffect)) {
        try {
          setTransitionEffect(OutputTransitionEffect.valueOf(value));
        } catch (Exception e) {
          throw new SBMLException("Could not recognized the value '" + value + "' for the attribute " +
              QualConstants.transitionEffect + " on the 'output' element.");
        }

      } else {
        isAttributeRead = false;
View Full Code Here

           
            Type listType = toTest.getSBaseListType();
            if (listType == Type.none) {
              // Prevent writing invalid SBML if list types are
              // not set appropriately.
              throw new SBMLException(String.format(
                  "Unknown ListOf type \"%s\".",
                  toTest.getElementName()));
            }
            if (listType.equals(ListOf.Type.listOfReactants)
                || listType.equals(ListOf.Type.listOfProducts)
View Full Code Here

  /*
   * (non-Javadoc)
   * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#unknownValue()
   */
  public ASTNodeValue unknownValue() throws SBMLException {
    throw new SBMLException(
        "cannot write unknown syntax tree nodes to a MathML document");
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.SBMLException

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.