Ejemplo n.º 1
0
  virtual bool visit(const SBase &x)
  {
    if (&x == NULL || x.getPackageName() != "arrays")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      return SBMLVisitor::visit(x);
    }
    else
    {
      if (code == SBML_ARRAYS_DIMENSION)
      {
        return visit((const Dimension&)x);
      }
      else if (code == SBML_ARRAYS_INDEX)
      {
        return visit((const Index&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }
Ejemplo n.º 2
0
  virtual bool visit(const SBase &x)
  {
    if (&x == NULL || x.getPackageName() != "req")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      return SBMLVisitor::visit(x);
    }
    else
    {
      if (code == SBML_REQ_CHANGED_MATH)
      {
        return visit((const ChangedMath&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }
Ejemplo n.º 3
0
  virtual bool visit(const SBase &x)
  {
    if (&x == NULL || x.getPackageName() != "groups")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      return SBMLVisitor::visit(x);
    }
    else
    {
      if (code == SBML_GROUPS_MEMBER)
      {
        return visit((const Member&)x);
      }
      else if (code == SBML_GROUPS_MEMBER_CONSTRAINT)
      {
        return visit((const MemberConstraint&)x);
      }
      else if (code == SBML_GROUPS_GROUP)
      {
        return visit((const Group&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }
Ejemplo n.º 4
0
  virtual bool visit(const SBase &x)
  {
    if (&x == NULL || x.getPackageName() != "distrib")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      return SBMLVisitor::visit(x);
    }
    else
    {
      if (code == SBML_DISTRIB_DRAW_FROM_DISTRIBUTION)
      {
        return visit((const DrawFromDistribution&)x);
      }
      else if (code == SBML_DISTRIB_INPUT)
      {
        return visit((const DistribInput&)x);
      }
      else if (code == SBML_DISTRIB_UNCERTAINTY)
      {
        return visit((const Uncertainty&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }
Ejemplo n.º 5
0
  virtual bool visit (const SBase &x)
  {
    if(&x == NULL || x.getPackageName() != "qual")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      code = list->getItemTypeCode();

      if (code == SBML_QUAL_FUNCTION_TERM)
      {
        return visit((const ListOfFunctionTerms&)x);
      }
      else
      {
        return SBMLVisitor::visit(x);
      }
    }
    else
    {
      if (code == SBML_QUAL_QUALITATIVE_SPECIES)
      {
        return visit((const QualitativeSpecies&)x);
      }
      else if (code == SBML_QUAL_TRANSITION)
      {
        return visit((const Transition&)x);
      }
      else if (code == SBML_QUAL_INPUT)
      {
        return visit((const Input&)x);
      }
      else if (code == SBML_QUAL_OUTPUT)
      {
        return visit((const Output&)x);
      }
      else if (code == SBML_QUAL_FUNCTION_TERM)
      {
        return visit((const FunctionTerm&)x);
      }
      else if (code == SBML_QUAL_DEFAULT_TERM)
      {
        return visit((const DefaultTerm&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }
Ejemplo n.º 6
0
/*
 * Logs a constraint failure to the validator for the given SBML object.
 * The parameter message is used instead of the constraint's member
 * variable msg.
 */
void
VConstraint::logFailure (const SBase& object, const std::string& message)
{
  std::string pkg = object.getPackageName();
  unsigned int pkgVersion = object.getPackageVersion();
  if (mId > 99999 && pkg == "core")
  {
    // we are dealing with a core object that is logging errors 
    // relating to a package
    // need to work out which pkg

    unsigned int offset = (unsigned int)(floor((double)mId/100000.0)) * 100000;

    if (offset == 9900000)
    {
      // we are dealing with the strict units validator
      mId = mId - offset;
    }
    else
    {
      // it is possible that the object does not have a direct plugin
      // it may the child of an object that does
      // so lets cut straight to the parent document
      const SBMLDocument * doc = object.getSBMLDocument();
      if (doc != NULL)
      {
        for (unsigned int i = 0; i < doc->getNumPlugins(); i++)
        {
          const SBMLExtension * ext = doc->getPlugin(i)->getSBMLExtension();

          if (ext->getErrorIdOffset() == offset)
          {
            pkg = doc->getPlugin(i)->getPackageName();
            pkgVersion = doc->getPlugin(i)->getPackageVersion();
            break;
          }
        }
      }
    }
  }

  SBMLError error = SBMLError( mId, object.getLevel(), object.getVersion(),
			       message, object.getLine(), object.getColumn(),
             LIBSBML_SEV_ERROR, LIBSBML_CAT_SBML, pkg, pkgVersion);

  if (error.getSeverity() != LIBSBML_SEV_NOT_APPLICABLE)
    mValidator.logFailure(error);

/*    ( SBMLError( mId, object.getLevel(), object.getVersion(),
                 message, object.getLine(), object.getColumn(),
                 LIBSBML_SEV_ERROR, LIBSBML_CAT_SBML ));*/

}
void 
ReportEmptyListOf::logEmptyList(const ListOf* list, const SBase& parent)
{
  msg = "The ListOf";
  msg += SBMLTypeCode_toString( list->getItemTypeCode(), list->getPackageName().c_str());
  msg += "s in the ";
  msg += SBMLTypeCode_toString(parent.getTypeCode(), parent.getPackageName().c_str());
  msg += " with id '";
  msg += parent.getId();
  msg += "' has no child ";
  msg += SBMLTypeCode_toString( list->getItemTypeCode(), list->getPackageName().c_str());
  msg += " elements.";
  
  logFailure(*list);
}
/*
  * Logs a message about dupliacte top level annotations.
  */
void
DuplicateTopLevelAnnotation::logDuplicate (std::string name, const SBase& object )
{

  msg = "The namespaces '";
  msg += name;
  msg += "' is duplicated within the annotation of the ";
  msg += SBMLTypeCode_toString( object.getTypeCode(), object.getPackageName().c_str() );
  msg += " with id '";
  msg += object.getId();
  msg += "'.";

  
  logFailure(object);
}
Ejemplo n.º 9
0
  virtual bool visit(const SBase &x)
  {
    if (&x == NULL || x.getPackageName() != "multi")
    {
      return SBMLVisitor::visit(x);
    }

    int code = x.getTypeCode();

    const ListOf* list = dynamic_cast<const ListOf*>(&x);

    if (list != NULL)
    {
      return SBMLVisitor::visit(x);
    }
    else
    {
      if (code == SBML_MULTI_POSSIBLE_SPECIES_FEATURE_VALUE)
      {
        return visit((const PossibleSpeciesFeatureValue&)x);
      }
      else if (code == SBML_MULTI_SPECIES_FEATURE_VALUE)
      {
        return visit((const SpeciesFeatureValue&)x);
      }
      else if (code == SBML_MULTI_COMPARTMENT_REFERENCE)
      {
        return visit((const CompartmentReference&)x);
      }
      else if (code == SBML_MULTI_SPECIES_TYPE_INSTANCE)
      {
        return visit((const SpeciesTypeInstance&)x);
      }
      else if (code == SBML_MULTI_IN_SPECIES_TYPE_BOND)
      {
        return visit((const InSpeciesTypeBond&)x);
      }
      else if (code == SBML_MULTI_DENOTED_SPECIES_TYPE_COMPONENT_INDEX)
      {
        return visit((const DenotedSpeciesTypeComponentIndex&)x);
      }
      else if (code == SBML_MULTI_OUTWARD_BINDING_SITE)
      {
        return visit((const OutwardBindingSite&)x);
      }
      else if (code == SBML_MULTI_SPECIES_FEATURE_CHANGE)
      {
        return visit((const SpeciesFeatureChange&)x);
      }
      else if (code == SBML_MULTI_SPECIES_FEATURE_TYPE)
      {
        return visit((const SpeciesFeatureType&)x);
      }
      else if (code == SBML_MULTI_SPECIES_TYPE_COMPONENT_INDEX)
      {
        return visit((const SpeciesTypeComponentIndex&)x);
      }
      else if (code == SBML_MULTI_SPECIES_FEATURE)
      {
        return visit((const SpeciesFeature&)x);
      }
      else if (code == SBML_MULTI_SPECIES_TYPE_COMPONENT_MAP_IN_PRODUCT)
      {
        return visit((const SpeciesTypeComponentMapInProduct&)x);
      }
      else if (code == SBML_MULTI_SPECIES_TYPE)
      {
        return visit((const MultiSpeciesType&)x);
      }
      else 
      {
        return SBMLVisitor::visit(x);
      } 
    }
  }