|
From: <sar...@us...> - 2013-07-25 15:06:34
|
Revision: 18266
http://sourceforge.net/p/sbml/code/18266
Author: sarahkeating
Date: 2013-07-25 15:06:31 +0000 (Thu, 25 Jul 2013)
Log Message:
-----------
I had an instance of the element filter that filters items with an id set (keeping out rules/initialassignments that cloud the issue) and one that filters items with metaid set that were local to comp validation. I have moved them to the general sbml/util folder so they are open to all.
Modified Paths:
--------------
trunk/libsbml/src/sbml/packages/comp/validator/constraints/CompConsistencyConstraints.cpp
Added Paths:
-----------
trunk/libsbml/src/sbml/util/IdFilter.h
trunk/libsbml/src/sbml/util/MetaIdFilter.h
Modified: trunk/libsbml/src/sbml/packages/comp/validator/constraints/CompConsistencyConstraints.cpp
===================================================================
--- trunk/libsbml/src/sbml/packages/comp/validator/constraints/CompConsistencyConstraints.cpp 2013-07-25 11:36:12 UTC (rev 18265)
+++ trunk/libsbml/src/sbml/packages/comp/validator/constraints/CompConsistencyConstraints.cpp 2013-07-25 15:06:31 UTC (rev 18266)
@@ -35,7 +35,8 @@
#include <sbml/packages/comp/util/SBMLUri.h>
#include <sbml/SBMLTypes.h>
#include <sbml/packages/comp/common/CompExtensionTypes.h>
-#include <sbml/util/ElementFilter.h>
+#include <sbml/util/MetaIdFilter.h>
+#include <sbml/util/IdFilter.h>
#include "ExtModelReferenceCycles.h"
#include "SubmodelReferenceCycles.h"
@@ -52,64 +53,6 @@
/** @endcond */
-/**
- * This class implements an element filter, that can be used to find elements
- * with an id set
- */
-class IdFilter : public ElementFilter
-{
-public:
- IdFilter() : ElementFilter()
- {
- }
-
- virtual bool filter(const SBase* element)
- {
- // return in case we don't have a valid element with an id
- if (element == NULL || element->isSetId() == false)
- {
- return false;
- }
-
- // otherwise we have an id set and want to keep the element
- // unless it is a rule or intialAssignment/eventAssignment
- int tc = element->getTypeCode();
- if (tc == SBML_ASSIGNMENT_RULE || tc == SBML_RATE_RULE
- || tc == SBML_INITIAL_ASSIGNMENT || tc == SBML_EVENT_ASSIGNMENT)
- {
- return false;
- }
-
-
- return true;
- }
-
-};
-
-/**
- * This class implements an element filter, that can be used to find elements
- * with an metaid set
- */
-class MetaIdFilter : public ElementFilter
-{
-public:
- MetaIdFilter() : ElementFilter()
- {
- }
-
- virtual bool filter(const SBase* element)
- {
- // return in case we don't have a valid element with an id
- if (element == NULL || element->isSetMetaId() == false)
- {
- return false;
- }
-
- return true;
- }
-
-};
-
class ReferencedModel
{
public:
Added: trunk/libsbml/src/sbml/util/IdFilter.h
===================================================================
--- trunk/libsbml/src/sbml/util/IdFilter.h (rev 0)
+++ trunk/libsbml/src/sbml/util/IdFilter.h 2013-07-25 15:06:31 UTC (rev 18266)
@@ -0,0 +1,74 @@
+/**
+ * @cond doxygen-libsbml-internal
+ *
+ * @file IdFilterFilter.h
+ * @brief Filter to return only elements with an id set
+ * @author Sarah Keating
+ *
+ * <!--------------------------------------------------------------------------
+ * This file is part of libSBML. Please visit http://sbml.org for more
+ * information about SBML, and the latest version of libSBML.
+ *
+ * Copyright (C) 2009-2013 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK
+ *
+ * Copyright (C) 2006-2008 by the California Institute of Technology,
+ * Pasadena, CA, USA
+ *
+ * Copyright (C) 2002-2005 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. Japan Science and Technology Agency, Japan
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation. A copy of the license agreement is provided
+ * in the file named "LICENSE.txt" included with this software distribution
+ * and also available online as http://sbml.org/software/libsbml/license.html
+ * ---------------------------------------------------------------------- -->*/
+
+#ifndef IdFilter_h
+#define IdFilter_h
+
+
+#ifdef __cplusplus
+
+#include <sbml/util/ElementFilter.h>
+
+LIBSBML_CPP_NAMESPACE_BEGIN
+
+class IdFilter : public ElementFilter
+{
+public:
+ IdFilter() : ElementFilter()
+ {
+ }
+
+ virtual bool filter(const SBase* element)
+ {
+ // return in case we don't have a valid element with an id
+ if (element == NULL || element->isSetId() == false)
+ {
+ return false;
+ }
+
+ // otherwise we have an id set and want to keep the element
+ // unless it is a rule or intialAssignment/eventAssignment
+ int tc = element->getTypeCode();
+ if (tc == SBML_ASSIGNMENT_RULE || tc == SBML_RATE_RULE
+ || tc == SBML_INITIAL_ASSIGNMENT || tc == SBML_EVENT_ASSIGNMENT)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+};
+
+LIBSBML_CPP_NAMESPACE_END
+
+#endif /* __cplusplus */
+#endif /* IdFilter_h */
+
+/** @endcond */
Added: trunk/libsbml/src/sbml/util/MetaIdFilter.h
===================================================================
--- trunk/libsbml/src/sbml/util/MetaIdFilter.h (rev 0)
+++ trunk/libsbml/src/sbml/util/MetaIdFilter.h 2013-07-25 15:06:31 UTC (rev 18266)
@@ -0,0 +1,65 @@
+/**
+ * @cond doxygen-libsbml-internal
+ *
+ * @file MetaMetaIdFilterFilter.h
+ * @brief Filter to return only elements with a metaid set
+ * @author Sarah Keating
+ *
+ * <!--------------------------------------------------------------------------
+ * This file is part of libSBML. Please visit http://sbml.org for more
+ * information about SBML, and the latest version of libSBML.
+ *
+ * Copyright (C) 2009-2013 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK
+ *
+ * Copyright (C) 2006-2008 by the California Institute of Technology,
+ * Pasadena, CA, USA
+ *
+ * Copyright (C) 2002-2005 jointly by the following organizations:
+ * 1. California Institute of Technology, Pasadena, CA, USA
+ * 2. Japan Science and Technology Agency, Japan
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation. A copy of the license agreement is provided
+ * in the file named "LICENSE.txt" included with this software distribution
+ * and also available online as http://sbml.org/software/libsbml/license.html
+ * ---------------------------------------------------------------------- -->*/
+
+#ifndef MetaIdFilter_h
+#define MetaIdFilter_h
+
+
+#ifdef __cplusplus
+
+#include <sbml/util/ElementFilter.h>
+
+LIBSBML_CPP_NAMESPACE_BEGIN
+
+class MetaIdFilter : public ElementFilter
+{
+public:
+ MetaIdFilter() : ElementFilter()
+ {
+ }
+
+ virtual bool filter(const SBase* element)
+ {
+ // return in case we don't have a valid element with an id
+ if (element == NULL || element->isSetMetaId() == false)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+};
+
+LIBSBML_CPP_NAMESPACE_END
+
+#endif /* __cplusplus */
+#endif /* MetaIdFilter_h */
+
+/** @endcond */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|