Package org.sbml.jsbml

Examples of org.sbml.jsbml.SBMLException


    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


   * (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 formula String");
  }
View Full Code Here

      SpatialCompartmentPlugin spatialCompartment = (SpatialCompartmentPlugin) compartment.getExtension(SpatialConstants.namespaceURI);

      boolean cmSet = spatialCompartment.isSetCompartmentMapping();

      if (!cmSet) {
        throw new SBMLException(bundle.getString("COMPARTMENT_MAPPING_NOT_SET"));
      }
    }


  }
View Full Code Here

    if (attributeName.equals(SpatialConstants.isSpatial)) {
      try {
        setSpatial(StringTools.parseSBMLBoolean(value));
        isAttributeRead = true;
      } catch (Exception e) {
        throw new SBMLException(
          MessageFormat.format(bundle.getString("COULD_NOT_READ"), value,
            SpatialConstants.isSpatial));
      }

    }
View Full Code Here

    // Now you have a list of Parameter Type coefficients, go through and check if there is one
    if (diffCoeffs.isEmpty()) {
      if  (advCoeffs.isEmpty()) {
        check = false;
        throw new SBMLException("There is no species Id set for this parameter.");
      } else {
        for (AdvectionCoefficient ac : advCoeffs) {
          if (coordDimensions.contains(ac.getCoordinateIndex())) {
            check = false;
          } else {
View Full Code Here

    if (!isAttributeRead && attributeName.equals("kind")) {
      try {
        setKind(GroupKind.valueOf(value));
        isAttributeRead = true;
      } catch (Exception e) {
        throw new SBMLException("Could not recognized the value '" + value
          + "' for the attribute 'kind' on the 'group' element.");
      }
    }

    return isAttributeRead;
View Full Code Here

        setThresholdLevel(StringTools.parseSBMLInt(value));
      } else if (attributeName.equals(QualConstants.sign)) {
        try {
          setSign(Sign.valueOf(value));
        } catch (Exception e) {
          throw new SBMLException("Could not recognized the value '" + value
            + "' for the attribute " + QualConstants.sign
            + " on the 'input' element.");
        }
      } else if (attributeName.equals(QualConstants.transitionEffect)) {
        try {
          setTransitionEffect(InputTransitionEffect.valueOf(value));
        } catch (Exception e) {
          throw new SBMLException("Could not recognized the value '" + value
            + "' for the attribute " + QualConstants.transitionEffect
            + " on the 'input' element.");
        }
      } else {
        isAttributeRead = false;
View Full Code Here

  public boolean equals(Object object) {
    boolean equal = super.equals(object);
    if (equal) {
      ParameterType param = (ParameterType) object;
      if (param.isSetSpId() && param.isSetSpeciesReference()) {
        throw new SBMLException("Both SpId and SpIdRef cannot be set");
      } else {
        if (param.isSetSpId()) {
          equal &= param.getSpId().equals(getSpId());
        }
        else if (param.isSetSpeciesReference()){
View Full Code Here

      else if (attributeName.equals(LayoutConstants.role))
      {
        try {
          setRole(SpeciesReferenceRole.valueOf(value.toUpperCase()));
        } catch (Exception e) {
          throw new SBMLException("Could not recognized the value '" + value
            + "' for the attribute " + LayoutConstants.role
            + " on the 'SpeciesReferenceGlyph' element.");
        }
      }
      else
View Full Code Here

            SpatialConstants.domainType);
        }
      }
      else if (attributeName.equals(SpatialConstants.functionType)) {
        if (!Pattern.matches("[a-z]*", value)) {
          throw new SBMLException("The value is not all lower-case.");
        }
        setFunctionType(FunctionType.valueOf(value.toUpperCase()));
      }
      else {
        isAttributeRead = false;
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.