You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(121) |
Aug
(343) |
Sep
(98) |
Oct
(55) |
Nov
(158) |
Dec
(219) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(278) |
Feb
(170) |
Mar
(286) |
Apr
(32) |
May
(83) |
Jun
(140) |
Jul
(212) |
Aug
(242) |
Sep
(52) |
Oct
(29) |
Nov
(132) |
Dec
(259) |
| 2010 |
Jan
(251) |
Feb
(147) |
Mar
(76) |
Apr
(140) |
May
(43) |
Jun
(66) |
Jul
(273) |
Aug
(205) |
Sep
(260) |
Oct
(100) |
Nov
(58) |
Dec
(264) |
| 2011 |
Jan
(219) |
Feb
(344) |
Mar
(320) |
Apr
(334) |
May
(125) |
Jun
(131) |
Jul
(195) |
Aug
(155) |
Sep
(55) |
Oct
(261) |
Nov
(286) |
Dec
(216) |
| 2012 |
Jan
(188) |
Feb
(177) |
Mar
(39) |
Apr
(179) |
May
(148) |
Jun
(43) |
Jul
(229) |
Aug
(104) |
Sep
(76) |
Oct
(82) |
Nov
(93) |
Dec
(180) |
| 2013 |
Jan
(323) |
Feb
(335) |
Mar
(35) |
Apr
(220) |
May
(238) |
Jun
(122) |
Jul
(316) |
Aug
(73) |
Sep
(135) |
Oct
(515) |
Nov
(320) |
Dec
(185) |
| 2014 |
Jan
(81) |
Feb
(146) |
Mar
(337) |
Apr
(234) |
May
(112) |
Jun
(239) |
Jul
(323) |
Aug
(123) |
Sep
(83) |
Oct
(285) |
Nov
(321) |
Dec
(96) |
| 2015 |
Jan
(77) |
Feb
(79) |
Mar
(124) |
Apr
(71) |
May
(35) |
Jun
(45) |
Jul
(77) |
Aug
(44) |
Sep
(22) |
Oct
(84) |
Nov
(120) |
Dec
(37) |
| 2016 |
Jan
(38) |
Feb
(74) |
Mar
(242) |
Apr
(153) |
May
(59) |
Jun
(44) |
Jul
(67) |
Aug
(74) |
Sep
(150) |
Oct
(35) |
Nov
(69) |
Dec
(43) |
| 2017 |
Jan
(43) |
Feb
(9) |
Mar
(274) |
Apr
(40) |
May
(81) |
Jun
(81) |
Jul
(87) |
Aug
(46) |
Sep
(98) |
Oct
(50) |
Nov
(220) |
Dec
(66) |
| 2018 |
Jan
(110) |
Feb
(22) |
Mar
(20) |
Apr
(147) |
May
(148) |
Jun
(30) |
Jul
(83) |
Aug
(63) |
Sep
(40) |
Oct
(53) |
Nov
(51) |
Dec
(104) |
| 2019 |
Jan
(14) |
Feb
(81) |
Mar
(80) |
Apr
(102) |
May
(16) |
Jun
(5) |
Jul
(34) |
Aug
(24) |
Sep
(9) |
Oct
(12) |
Nov
(42) |
Dec
(76) |
| 2020 |
Jan
(15) |
Feb
(11) |
Mar
(12) |
Apr
(7) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(3) |
2
(8) |
3
(8) |
4
(1) |
5
(1) |
6
(21) |
7
(3) |
|
8
(6) |
9
(3) |
10
(23) |
11
(6) |
12
(14) |
13
(3) |
14
|
|
15
(1) |
16
(9) |
17
(4) |
18
(5) |
19
(3) |
20
(2) |
21
(11) |
|
22
|
23
(3) |
24
(7) |
25
(7) |
26
(11) |
27
(5) |
28
(2) |
|
From: <ajo...@us...> - 2009-02-28 08:36:16
|
Revision: 9146
http://sbml.svn.sourceforge.net/sbml/?rev=9146&view=rev
Author: ajouraku
Date: 2009-02-28 08:36:05 +0000 (Sat, 28 Feb 2009)
Log Message:
-----------
Removed patchlibSBML.pl from Perl bindings because the script
is needed only when SWIG 1.3.21 or before used and thus no longer
required by the current libSBML which depends on SWIG 1.3.33
or later.
Modified Paths:
--------------
branches/libsbml-4/src/bindings/perl/Makefile.in
Removed Paths:
-------------
branches/libsbml-4/src/bindings/perl/patchLibSBML.pl
Modified: branches/libsbml-4/src/bindings/perl/Makefile.in
===================================================================
--- branches/libsbml-4/src/bindings/perl/Makefile.in 2009-02-28 08:34:06 UTC (rev 9145)
+++ branches/libsbml-4/src/bindings/perl/Makefile.in 2009-02-28 08:36:05 UTC (rev 9146)
@@ -88,7 +88,6 @@
Makefile.PL.in \
MANIFEST \
README.txt \
- patchLibSBML.pl \
t/01__LoadModule.t \
t/02__CreateDocument.t \
t/02__ReadFromFile.t \
Deleted: branches/libsbml-4/src/bindings/perl/patchLibSBML.pl
===================================================================
--- branches/libsbml-4/src/bindings/perl/patchLibSBML.pl 2009-02-28 08:34:06 UTC (rev 9145)
+++ branches/libsbml-4/src/bindings/perl/patchLibSBML.pl 2009-02-28 08:36:05 UTC (rev 9146)
@@ -1,112 +0,0 @@
-#!/usr/bin/perl
-# -*-Perl-*-
-
-#
-# \file patchLibSBML.pl
-# \brief Patches SWIG generated LibSBML.pm
-# \author TBI {xtof,raim}@tbi.univie.ac.at
-#
-# $Id$
-# $HeadURL$
-
-#
-#
-# Copyright 2004 TBI
-#
-# 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; either version 2.1 of the License, or
-# any later version.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
-# documentation provided hereunder is on an "as is" basis, and the
-# California Institute of Technology and Japan Science and Technology
-# Corporation have no obligations to provide maintenance, support,
-# updates, enhancements or modifications. In no event shall the
-# California Institute of Technology or the Japan Science and Technology
-# Corporation be liable to any party for direct, indirect, special,
-# incidental or consequential damages, including lost profits, arising
-# out of the use of this software and its documentation, even if the
-# California Institute of Technology and/or Japan Science and Technology
-# Corporation have been advised of the possibility of such damage. See
-# the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-#
-# The original code contained here was initially developed by:
-#
-# Christoph Flamm and Rainer Machne
-#
-# Contributor(s):
-#
-
-
-use Data::Dumper;
-use strict;
-
-my $hash = parse_local_i();
-patch_libSBML_pm($hash);
-
-#---
-sub parse_local_i {
- local ($/, $_);
- my $hash = {};
- $/=""; # read in paragraph mode
- open(LFH, "< local.i") || die "Couldn't open file local.i: $!";
- while (<LFH>) {
- # extract the %feature directives from file local.i
- if (m/^%feature\(\"shadow\"\)\s+([\w:]+)/) { #.+%\{(.+)%\}/m) {
- my $func = $1; s/\n/\\n/g;
- (my $pkg = $func) =~ s/\A(\w+):.*/$1/;
- (my $code = $_) =~ s/.*%{\\n(.*)%}.*/$1/;
- $hash->{$func} = $code;
- $hash->{$pkg} = 1;
- }
- }
- close(LFH) || die "Couldn't close file local.i: $!";
- return $hash;
-}
-
-#---
-sub patch_libSBML_pm {
- local($_);
- my ($hash, $pkg, @funcs) = (shift(), '', ());
- open(PFH, "< LibSBML.pm") || die "Couldn't open file libSBML.pm: $!";
- while (<PFH>) {
- # recognize packages
- if (m/^package ([\w:]+);/) {
- ($pkg = $1) =~ s/\ALibSBML:://;
- @funcs = ();
- if (exists $hash->{$pkg}) {
- @funcs = grep {m/\A$pkg\:\:/} keys %$hash ;
- @funcs = map { s/$pkg\:\://; $_ } @funcs;
- }
- print;
- next;
- }
-
- # replace package functions
- if (m/^\*(\w+) =/ && @funcs && grep(m/$1/, @funcs)) {
- @funcs = grep(!m/$1/, @funcs);
- (my $code = $hash->{"$pkg\:\:$1"}) =~ s/\\n/\n/g;
- print "#$_$code";
- next;
- }
- else { print }
- }
-}
-
-#---
-sub dumpHash {
- my $href = shift;
- for my $key (sort keys %$href) {
- (my $code = $href->{$key}) =~ s/\\n/\n/g;
- print STDERR "$key\n$code\n";
- }
-}
-
-__END__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ajo...@us...> - 2009-02-28 08:34:20
|
Revision: 9145
http://sbml.svn.sourceforge.net/sbml/?rev=9145&view=rev
Author: ajouraku
Date: 2009-02-28 08:34:06 +0000 (Sat, 28 Feb 2009)
Log Message:
-----------
Removed patchlibSBML.pl from Perl bindings because the script
is needed only when SWIG 1.3.21 or before used and thus no longer
required by the current libSBML which depends on SWIG 1.3.33
or later.
Modified Paths:
--------------
trunk/libsbml/src/bindings/perl/Makefile.in
Removed Paths:
-------------
trunk/libsbml/src/bindings/perl/patchLibSBML.pl
Modified: trunk/libsbml/src/bindings/perl/Makefile.in
===================================================================
--- trunk/libsbml/src/bindings/perl/Makefile.in 2009-02-27 22:09:39 UTC (rev 9144)
+++ trunk/libsbml/src/bindings/perl/Makefile.in 2009-02-28 08:34:06 UTC (rev 9145)
@@ -88,7 +88,6 @@
Makefile.PL.in \
MANIFEST \
README.txt \
- patchLibSBML.pl \
t/01__LoadModule.t \
t/02__CreateDocument.t \
t/02__ReadFromFile.t \
Deleted: trunk/libsbml/src/bindings/perl/patchLibSBML.pl
===================================================================
--- trunk/libsbml/src/bindings/perl/patchLibSBML.pl 2009-02-27 22:09:39 UTC (rev 9144)
+++ trunk/libsbml/src/bindings/perl/patchLibSBML.pl 2009-02-28 08:34:06 UTC (rev 9145)
@@ -1,112 +0,0 @@
-#!/usr/bin/perl
-# -*-Perl-*-
-
-#
-# \file patchLibSBML.pl
-# \brief Patches SWIG generated LibSBML.pm
-# \author TBI {xtof,raim}@tbi.univie.ac.at
-#
-# $Id$
-# $HeadURL$
-
-#
-#
-# Copyright 2004 TBI
-#
-# 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; either version 2.1 of the License, or
-# any later version.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
-# documentation provided hereunder is on an "as is" basis, and the
-# California Institute of Technology and Japan Science and Technology
-# Corporation have no obligations to provide maintenance, support,
-# updates, enhancements or modifications. In no event shall the
-# California Institute of Technology or the Japan Science and Technology
-# Corporation be liable to any party for direct, indirect, special,
-# incidental or consequential damages, including lost profits, arising
-# out of the use of this software and its documentation, even if the
-# California Institute of Technology and/or Japan Science and Technology
-# Corporation have been advised of the possibility of such damage. See
-# the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-#
-# The original code contained here was initially developed by:
-#
-# Christoph Flamm and Rainer Machne
-#
-# Contributor(s):
-#
-
-
-use Data::Dumper;
-use strict;
-
-my $hash = parse_local_i();
-patch_libSBML_pm($hash);
-
-#---
-sub parse_local_i {
- local ($/, $_);
- my $hash = {};
- $/=""; # read in paragraph mode
- open(LFH, "< local.i") || die "Couldn't open file local.i: $!";
- while (<LFH>) {
- # extract the %feature directives from file local.i
- if (m/^%feature\(\"shadow\"\)\s+([\w:]+)/) { #.+%\{(.+)%\}/m) {
- my $func = $1; s/\n/\\n/g;
- (my $pkg = $func) =~ s/\A(\w+):.*/$1/;
- (my $code = $_) =~ s/.*%{\\n(.*)%}.*/$1/;
- $hash->{$func} = $code;
- $hash->{$pkg} = 1;
- }
- }
- close(LFH) || die "Couldn't close file local.i: $!";
- return $hash;
-}
-
-#---
-sub patch_libSBML_pm {
- local($_);
- my ($hash, $pkg, @funcs) = (shift(), '', ());
- open(PFH, "< LibSBML.pm") || die "Couldn't open file libSBML.pm: $!";
- while (<PFH>) {
- # recognize packages
- if (m/^package ([\w:]+);/) {
- ($pkg = $1) =~ s/\ALibSBML:://;
- @funcs = ();
- if (exists $hash->{$pkg}) {
- @funcs = grep {m/\A$pkg\:\:/} keys %$hash ;
- @funcs = map { s/$pkg\:\://; $_ } @funcs;
- }
- print;
- next;
- }
-
- # replace package functions
- if (m/^\*(\w+) =/ && @funcs && grep(m/$1/, @funcs)) {
- @funcs = grep(!m/$1/, @funcs);
- (my $code = $hash->{"$pkg\:\:$1"}) =~ s/\\n/\n/g;
- print "#$_$code";
- next;
- }
- else { print }
- }
-}
-
-#---
-sub dumpHash {
- my $href = shift;
- for my $key (sort keys %$href) {
- (my $code = $href->{$key}) =~ s/\\n/\n/g;
- print STDERR "$key\n$code\n";
- }
-}
-
-__END__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-27 22:09:43
|
Revision: 9144
http://sbml.svn.sourceforge.net/sbml/?rev=9144&view=rev
Author: sarahkeating
Date: 2009-02-27 22:09:39 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
changed the names of isValidXXX functions to hasRequiredAttributes
except isValidDate which changed to representsValidDate
added C implementations and exposed functions
documentation is still needed
Modified Paths:
--------------
branches/libsbml-4/src/annotation/CVTerm.cpp
branches/libsbml-4/src/annotation/CVTerm.h
branches/libsbml-4/src/annotation/ModelHistory.cpp
branches/libsbml-4/src/annotation/ModelHistory.h
branches/libsbml-4/src/annotation/test/TestValidation.cpp
branches/libsbml-4/src/sbml/Model.cpp
branches/libsbml-4/src/sbml/SBase.cpp
Modified: branches/libsbml-4/src/annotation/CVTerm.cpp
===================================================================
--- branches/libsbml-4/src/annotation/CVTerm.cpp 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/annotation/CVTerm.cpp 2009-02-27 22:09:39 UTC (rev 9144)
@@ -361,7 +361,7 @@
/** @cond doxygen-libsbml-internal */
bool
-CVTerm::isValidCVTerm()
+CVTerm::hasRequiredAttributes()
{
bool valid = true;
@@ -687,4 +687,14 @@
}
+LIBSBML_EXTERN
+int
+CVTerm_hasRequiredAttributes(CVTerm_t *cvt)
+{
+ return static_cast<int> (cvt->hasRequiredAttributes());
+}
+
+
+
+
/** @endcond doxygen-c-only */
Modified: branches/libsbml-4/src/annotation/CVTerm.h
===================================================================
--- branches/libsbml-4/src/annotation/CVTerm.h 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/annotation/CVTerm.h 2009-02-27 22:09:39 UTC (rev 9144)
@@ -329,9 +329,11 @@
*/
int removeResource(std::string resource);
- /** @cond doxygen-libsbml-internal */
- bool isValidCVTerm();
- /** @endcond doxygen-libsbml-internal */
+ /* The required attributes for a CVTerm are:
+ * qualifierType and appropriate biologicalQualifierType or
+ * modelQualifierType and at least one resource.
+ */
+ bool hasRequiredAttributes();
protected:
/** @cond doxygen-libsbml-internal */
@@ -432,6 +434,11 @@
CVTerm_removeResource(CVTerm_t * CVT, const char * resource);
+LIBSBML_EXTERN
+int
+CVTerm_hasRequiredAttributes(CVTerm_t *cvt);
+
+
END_C_DECLS
#endif /* !SWIG */
Modified: branches/libsbml-4/src/annotation/ModelHistory.cpp
===================================================================
--- branches/libsbml-4/src/annotation/ModelHistory.cpp 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/annotation/ModelHistory.cpp 2009-02-27 22:09:39 UTC (rev 9144)
@@ -353,53 +353,20 @@
/* Date must be: YYYY-MM-DDThh:mm:ssTZD
* where TZD is either Z or +/-HH:MM
*/
- if (date.length() != 20 && date.length() != 25)
- {
- mDate = "";
- // rewrite date string to reflect existing numbers
- parseDateNumbersToString();
- return LIBSBML_INVALID_ATTRIBUTE_VALUE;
- }
+ mDate = date;
- const char * cdate = date.c_str();
- /* check for - and :*/
- if (cdate[4] != '-' ||
- cdate[7] != '-' ||
- cdate[10] != 'T' ||
- cdate[13] != ':' ||
- cdate[16] != ':')
+ if (!representsValidDate())
{
mDate = "";
- // rewrite date string to reflect existing numbers
parseDateNumbersToString();
return LIBSBML_INVALID_ATTRIBUTE_VALUE;
}
-
- /* check TZD */
- if (cdate[19] != 'Z' &&
- cdate[19] != '+' &&
- cdate[19] != '-')
+ else
{
- mDate = "";
- // rewrite date string to reflect existing numbers
+ parseDateStringToNumbers();
parseDateNumbersToString();
- return LIBSBML_INVALID_ATTRIBUTE_VALUE;
+ return LIBSBML_OPERATION_SUCCESS;
}
-
- if (cdate[19] != 'Z')
- {
- if (cdate[22] != ':')
- {
- mDate = "";
- // rewrite date string to reflect existing numbers
- parseDateNumbersToString();
- return LIBSBML_INVALID_ATTRIBUTE_VALUE;
- }
- }
-
- mDate = date;
- parseDateStringToNumbers();
- return LIBSBML_OPERATION_SUCCESS;
}
@@ -562,10 +529,10 @@
}
bool
-Date::isValidDate()
+Date::representsValidDate()
{
bool valid = true;
- parseDateNumbersToString();
+// parseDateNumbersToString();
const char * cdate = mDate.c_str();
if (mDate.length() != 20 && mDate.length() != 25)
@@ -885,7 +852,7 @@
}
bool
-ModelCreator::isValidModelCreator()
+ModelCreator::hasRequiredAttributes()
{
bool valid = true;
@@ -1015,7 +982,7 @@
{
return LIBSBML_OPERATION_FAILED;
}
- else if (!creator->isValidModelCreator())
+ else if (!creator->hasRequiredAttributes())
{
return LIBSBML_INVALID_OBJECT;
}
@@ -1043,7 +1010,7 @@
mCreatedDate = 0;
return LIBSBML_OPERATION_SUCCESS;
}
- else if (!date->isValidDate())
+ else if (!date->representsValidDate())
{
return LIBSBML_INVALID_OBJECT;
}
@@ -1077,7 +1044,7 @@
//mModifiedDate = 0;
return LIBSBML_OPERATION_FAILED;
}
- else if (!date->isValidDate())
+ else if (!date->representsValidDate())
{
return LIBSBML_INVALID_OBJECT;
}
@@ -1188,7 +1155,7 @@
}
bool
-ModelHistory::isValidModelHistory()
+ModelHistory::hasRequiredAttributes()
{
bool valid = true;
@@ -1203,7 +1170,7 @@
while(valid && i < getNumCreators())
{
valid = static_cast<ModelCreator *>(getCreator(i))
- ->isValidModelCreator();
+ ->hasRequiredAttributes();
i++;
}
@@ -1212,14 +1179,14 @@
return valid;
}
- valid = getCreatedDate()->isValidDate();
+ valid = getCreatedDate()->representsValidDate();
if (!valid)
{
return valid;
}
- valid = getModifiedDate()->isValidDate();
+ valid = getModifiedDate()->representsValidDate();
return valid;
}
@@ -1674,6 +1641,14 @@
}
+LIBSBML_EXTERN
+int
+Date_representsValidDate(Date_t *date)
+{
+ return static_cast<int> (date->representsValidDate());
+}
+
+
/**
* Creates a new ModelCreator_t structure and returns a pointer to it.
*
@@ -2070,6 +2045,14 @@
}
+LIBSBML_EXTERN
+int
+ModelCreator_hasRequiredAttributes(ModelCreator_t *mc)
+{
+ return static_cast<int> (mc->hasRequiredAttributes());
+}
+
+
/**
* Creates a new ModelHistory_t structure and returns a pointer to it.
*
@@ -2362,6 +2345,12 @@
return mh->getModifiedDate(n);
}
+LIBSBML_EXTERN
+int
+ModelHistory_hasRequiredAttributes(ModelHistory_t *mh)
+{
+ return static_cast<int> (mh->hasRequiredAttributes());
+}
Modified: branches/libsbml-4/src/annotation/ModelHistory.h
===================================================================
--- branches/libsbml-4/src/annotation/ModelHistory.h 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/annotation/ModelHistory.h 2009-02-27 22:09:39 UTC (rev 9144)
@@ -386,12 +386,16 @@
* where TZD is the time zone designator.
*/
int setDateAsString (std::string date);
- /** @cond doxygen-libsbml-internal */
- bool isValidDate();
- /** @endcond doxygen-libsbml-internal */
+ /* a valid date has member variables consistent with
+ * appropriate date
+ * Date must be: YYYY-MM-DDThh:mm:ssTZD
+ * where TZD is either Z or +/-HH:MM
+ */
+ bool representsValidDate();
+
protected:
/** @cond doxygen-libsbml-internal */
@@ -647,10 +651,11 @@
int unsetOrganisation();
/** @endcond doxygen-libsbml-internal */
- /** @cond doxygen-libsbml-internal */
- bool isValidModelCreator();
+ /* The required attributes for a ModelCreator are:
+ * familyName and givenName.
+ */
+ bool hasRequiredAttributes();
- /** @endcond doxygen-libsbml-internal */
protected:
/** @cond doxygen-libsbml-internal */
@@ -837,10 +842,12 @@
*/
unsigned int getNumCreators();
- /** @cond doxygen-libsbml-internal */
- bool isValidModelHistory();
+
+ /* The required attributes for a ModelHistory are:
+ * createdDate, modifiedDate and at least one ModelCreator.
+ */
+ bool hasRequiredAttributes();
- /** @endcond doxygen-libsbml-internal */
protected:
@@ -972,6 +979,11 @@
LIBSBML_EXTERN
+int
+Date_representsValidDate(Date_t *date);
+
+
+LIBSBML_EXTERN
ModelCreator_t *
ModelCreator_create();
@@ -1069,6 +1081,11 @@
ModelCreator_unsetOrganization(ModelCreator_t *mc);
LIBSBML_EXTERN
+int
+ModelCreator_hasRequiredAttributes(ModelCreator_t *mc);
+
+
+LIBSBML_EXTERN
ModelHistory_t * ModelHistory_create ();
LIBSBML_EXTERN
@@ -1129,7 +1146,11 @@
ModelHistory_getModifiedDateFromList(ModelHistory_t * mh, unsigned int n);
+LIBSBML_EXTERN
+int
+ModelHistory_hasRequiredAttributes(ModelHistory_t *mh);
+
END_C_DECLS
#endif /* !SWIG */
Modified: branches/libsbml-4/src/annotation/test/TestValidation.cpp
===================================================================
--- branches/libsbml-4/src/annotation/test/TestValidation.cpp 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/annotation/test/TestValidation.cpp 2009-02-27 22:09:39 UTC (rev 9144)
@@ -44,7 +44,7 @@
Date * date = new Date(200, 12, 30, 12, 15, 45, 1, 2, 0);
fail_unless(date != NULL);
- fail_unless (!(date->isValidDate()));
+ fail_unless (!(date->representsValidDate()));
delete date;
}
@@ -56,7 +56,7 @@
Date * date = new Date(2007, 14, 30, 12, 15, 45, 1, 2, 0);
fail_unless(date != NULL);
- fail_unless (!(date->isValidDate()));
+ fail_unless (!(date->representsValidDate()));
delete date;
}
@@ -68,7 +68,7 @@
Date * date = new Date("Jan 12");
fail_unless(date != NULL);
- fail_unless (!(date->isValidDate()));
+ fail_unless (!(date->representsValidDate()));
delete date;
}
@@ -80,7 +80,7 @@
Date * date = new Date(2007, 12, 30, 12, 15, 45, 1, 2, 0);
fail_unless(date != NULL);
- fail_unless (date->isValidDate());
+ fail_unless (date->representsValidDate());
delete date;
}
@@ -92,19 +92,19 @@
ModelCreator * mc = new ModelCreator();
fail_unless(mc != NULL);
- fail_unless (!(mc->isValidModelCreator()));
+ fail_unless (!(mc->hasRequiredAttributes()));
mc->setEmail("k123");
- fail_unless (!(mc->isValidModelCreator()));
+ fail_unless (!(mc->hasRequiredAttributes()));
mc->setFamilyName("Keating");
- fail_unless (!(mc->isValidModelCreator()));
+ fail_unless (!(mc->hasRequiredAttributes()));
mc->setGivenName("Sarah");
- fail_unless (mc->isValidModelCreator());
+ fail_unless (mc->hasRequiredAttributes());
delete mc;
}
@@ -116,16 +116,16 @@
ModelHistory * mh = new ModelHistory();
fail_unless(mh != NULL);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
Date * date = new Date(2007, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
mh->setModifiedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
ModelCreator * mc = new ModelCreator();
mc->setFamilyName("Keating");
@@ -133,7 +133,7 @@
mh->addCreator(mc);
- fail_unless (mh->isValidModelHistory());
+ fail_unless (mh->hasRequiredAttributes());
delete mh;
}
@@ -145,16 +145,16 @@
ModelHistory * mh = new ModelHistory();
fail_unless(mh != NULL);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
Date * date = new Date(200, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
mh->setModifiedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
ModelCreator * mc = new ModelCreator();
mc->setFamilyName("Keating");
@@ -162,7 +162,7 @@
mh->addCreator(mc);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
delete mh;
}
@@ -174,23 +174,23 @@
ModelHistory * mh = new ModelHistory();
fail_unless(mh != NULL);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
Date * date = new Date(2007, 12, 30, 12, 15, 45, 1, 2, 0);
mh->setCreatedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
mh->setModifiedDate(date);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
ModelCreator * mc = new ModelCreator();
mc->setFamilyName("Keating");
mh->addCreator(mc);
- fail_unless (!(mh->isValidModelHistory()));
+ fail_unless (!(mh->hasRequiredAttributes()));
delete mh;
}
@@ -202,19 +202,19 @@
CVTerm * cv = new CVTerm();
fail_unless(cv != NULL);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->setQualifierType(MODEL_QUALIFIER);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->setModelQualifierType(BQM_IS);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->addResource("ggg");
- fail_unless ((cv->isValidCVTerm()));
+ fail_unless ((cv->hasRequiredAttributes()));
delete cv;
}
@@ -226,19 +226,19 @@
CVTerm * cv = new CVTerm();
fail_unless(cv != NULL);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->setQualifierType(BIOLOGICAL_QUALIFIER);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->setBiologicalQualifierType(BQB_IS);
- fail_unless (!(cv->isValidCVTerm()));
+ fail_unless (!(cv->hasRequiredAttributes()));
cv->addResource("ggg");
- fail_unless ((cv->isValidCVTerm()));
+ fail_unless ((cv->hasRequiredAttributes()));
delete cv;
}
Modified: branches/libsbml-4/src/sbml/Model.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Model.cpp 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/sbml/Model.cpp 2009-02-27 22:09:39 UTC (rev 9144)
@@ -251,7 +251,7 @@
mHistory = 0;
return LIBSBML_OPERATION_SUCCESS;
}
- else if (!(history->isValidModelHistory()))
+ else if (!(history->hasRequiredAttributes()))
{
return LIBSBML_INVALID_OBJECT;
}
Modified: branches/libsbml-4/src/sbml/SBase.cpp
===================================================================
--- branches/libsbml-4/src/sbml/SBase.cpp 2009-02-27 18:53:18 UTC (rev 9143)
+++ branches/libsbml-4/src/sbml/SBase.cpp 2009-02-27 22:09:39 UTC (rev 9144)
@@ -1499,7 +1499,7 @@
{
return LIBSBML_OPERATION_FAILED;
}
- else if (!term->isValidCVTerm())
+ else if (!term->hasRequiredAttributes())
{
return LIBSBML_INVALID_OBJECT;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-27 18:53:32
|
Revision: 9143
http://sbml.svn.sourceforge.net/sbml/?rev=9143&view=rev
Author: sarahkeating
Date: 2009-02-27 18:53:18 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
notes need to declare xhtml namespace to pass tests
Modified Paths:
--------------
branches/libsbml-4/src/sbml/layout/test/TestLayoutFormatter.cpp
Modified: branches/libsbml-4/src/sbml/layout/test/TestLayoutFormatter.cpp
===================================================================
--- branches/libsbml-4/src/sbml/layout/test/TestLayoutFormatter.cpp 2009-02-27 12:49:44 UTC (rev 9142)
+++ branches/libsbml-4/src/sbml/layout/test/TestLayoutFormatter.cpp 2009-02-27 18:53:18 UTC (rev 9143)
@@ -161,7 +161,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<layout id=\"layout_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <dimensions width=\"200\" height=\"400\"/>\n"
"</layout>\n"
@@ -173,7 +173,7 @@
Dimensions dim=Dimensions(200.0,400.0);
Layout l("layout_1",&dim);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
l.appendNotes(¬es);
@@ -275,7 +275,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<compartmentGlyph id=\"compartmentGlyph_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -291,7 +291,7 @@
CompartmentGlyph cg=CompartmentGlyph();
cg.setId("compartmentGlyph_1");
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
cg.appendNotes(¬es);
@@ -413,7 +413,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<speciesGlyph id=\"speciesGlyph_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -429,7 +429,7 @@
SpeciesGlyph sg=SpeciesGlyph();
sg.setId("speciesGlyph_1");
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
sg.appendNotes(¬es);
@@ -586,7 +586,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<reactionGlyph id=\"reactionGlyph_1\" reaction=\"reaction_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -602,7 +602,7 @@
ReactionGlyph rg=ReactionGlyph();
rg.setId("reactionGlyph_1");
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
rg.appendNotes(¬es);
@@ -766,7 +766,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<speciesReferenceGlyph id=\"speciesReferenceGlyph_1\" role=\"modifier\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -781,7 +781,7 @@
SpeciesReferenceGlyph srg=SpeciesReferenceGlyph();
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
srg.appendNotes(¬es);
@@ -939,7 +939,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<textGlyph id=\"textGlyph_1\" graphicalObject=\"speciesGlyph_1\" originOfText=\"reactionGlyph_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -955,7 +955,7 @@
TextGlyph tg=TextGlyph();
tg.setId("textGlyph_1");
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
tg.appendNotes(¬es);
@@ -1083,7 +1083,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<graphicalObject id=\"graphicalObject_1\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <boundingBox>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
@@ -1098,7 +1098,7 @@
GraphicalObject go=GraphicalObject();
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
go.appendNotes(¬es);
@@ -1195,7 +1195,7 @@
"<annotation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
"<curve>\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <listOfCurveSegments>\n"
" <curveSegment xsi:type=\"LineSegment\">\n"
@@ -1212,7 +1212,7 @@
Curve c=Curve();
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
c.appendNotes(¬es);
@@ -1320,7 +1320,7 @@
"<annotation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
"<curveSegment xsi:type=\"LineSegment\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <start x=\"10\" y=\"10\"/>\n"
" <end x=\"20\" y=\"10\"/>\n"
@@ -1335,7 +1335,7 @@
LineSegment ls=LineSegment();
ls.setStart(10.0,10.0);
ls.setEnd(20.0,10.0);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
ls.appendNotes(¬es);
@@ -1419,7 +1419,7 @@
"<annotation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
"<curveSegment xsi:type=\"CubicBezier\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <start x=\"10\" y=\"10\"/>\n"
" <end x=\"20\" y=\"10\"/>\n"
@@ -1438,7 +1438,7 @@
cb.setEnd(20.0,10.0);
cb.setBasePoint1(15.0,5.0);
cb.setBasePoint2(15.0,15.0);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
cb.appendNotes(¬es);
@@ -1514,7 +1514,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<point x=\"200.5\" y=\"400.5\" z=\"455.2\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
"</point>\n"
;
@@ -1524,7 +1524,7 @@
XMLNode node(stream);
Point p=Point(200.5,400.5,455.2);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
p.appendNotes(¬es);
@@ -1608,7 +1608,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<dimensions width=\"200.5\" height=\"400.5\" depth=\"455.2\">\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
"</dimensions>\n"
;
@@ -1618,7 +1618,7 @@
XMLNode node(stream);
Dimensions dim=Dimensions(200.5,400.5,455.2);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
dim.appendNotes(¬es);
@@ -1709,7 +1709,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<boundingBox>\n"
" <notes>\n"
- " <body>Test note.</body>\n"
+ " <body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>\n"
"</notes>\n"
" <position x=\"10.3\" y=\"20\"/>\n"
" <dimensions width=\"200.5\" height=\"400.5\"/>\n"
@@ -1723,7 +1723,7 @@
Dimensions dim=Dimensions(200.5,400.5);
Point pos=Point(10.3,20.0);
BoundingBox box=BoundingBox("",&pos,&dim);
- XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body>Test note.</body>",false);
+ XMLInputStream stream2("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<body xmlns=\"http://www.w3.org/1999/xhtml\">Test note.</body>",false);
XMLNode notes(stream2);
box.appendNotes(¬es);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ajo...@us...> - 2009-02-27 12:49:51
|
Revision: 9142
http://sbml.svn.sourceforge.net/sbml/?rev=9142&view=rev
Author: ajouraku
Date: 2009-02-27 12:49:44 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
Fixed a function in which the default constructor of UnitDefinition class
(protected in libsbml-4) is invoked.
Modified Paths:
--------------
branches/libsbml-4/src/units/UnitFormulaFormatter.cpp
Modified: branches/libsbml-4/src/units/UnitFormulaFormatter.cpp
===================================================================
--- branches/libsbml-4/src/units/UnitFormulaFormatter.cpp 2009-02-27 12:41:57 UTC (rev 9141)
+++ branches/libsbml-4/src/units/UnitFormulaFormatter.cpp 2009-02-27 12:49:44 UTC (rev 9142)
@@ -1242,7 +1242,7 @@
// units is undefined
// as a safety catch
- return new UnitDefinition();
+ return new UnitDefinition(model->getLevel(), model->getVersion());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ajo...@us...> - 2009-02-27 12:42:04
|
Revision: 9141
http://sbml.svn.sourceforge.net/sbml/?rev=9141&view=rev
Author: ajouraku
Date: 2009-02-27 12:41:57 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
Fixed a conditional macro which hides a protected modifier of ModifierSpeciesReference
class if USE_LAYOUT is not defined.
Modified Paths:
--------------
branches/libsbml-4/src/sbml/SpeciesReference.h
Modified: branches/libsbml-4/src/sbml/SpeciesReference.h
===================================================================
--- branches/libsbml-4/src/sbml/SpeciesReference.h 2009-02-27 01:57:18 UTC (rev 9140)
+++ branches/libsbml-4/src/sbml/SpeciesReference.h 2009-02-27 12:41:57 UTC (rev 9141)
@@ -1117,7 +1117,11 @@
/** @endcond doxygen-libsbml-internal */
+#endif // USE_LAYOUT
+
protected:
+
+#ifdef USE_LAYOUT
/** @cond doxygen-libsbml-internal */
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-27 01:57:26
|
Revision: 9140
http://sbml.svn.sourceforge.net/sbml/?rev=9140&view=rev
Author: sarahkeating
Date: 2009-02-27 01:57:18 +0000 (Fri, 27 Feb 2009)
Log Message:
-----------
added LIBSBML_DUPLICATE_OBJECT_ID to the documentation of add functions
Modified Paths:
--------------
branches/libsbml-4/src/sbml/Event.cpp
branches/libsbml-4/src/sbml/Event.h
branches/libsbml-4/src/sbml/KineticLaw.cpp
branches/libsbml-4/src/sbml/KineticLaw.h
branches/libsbml-4/src/sbml/Model.cpp
branches/libsbml-4/src/sbml/Model.h
branches/libsbml-4/src/sbml/UnitDefinition.cpp
branches/libsbml-4/src/sbml/UnitDefinition.h
Modified: branches/libsbml-4/src/sbml/Event.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Event.cpp 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/Event.cpp 2009-02-27 01:57:18 UTC (rev 9140)
@@ -1551,6 +1551,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
Modified: branches/libsbml-4/src/sbml/Event.h
===================================================================
--- branches/libsbml-4/src/sbml/Event.h 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/Event.h 2009-02-27 01:57:18 UTC (rev 9140)
@@ -531,6 +531,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
Modified: branches/libsbml-4/src/sbml/KineticLaw.cpp
===================================================================
--- branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-27 01:57:18 UTC (rev 9140)
@@ -1430,6 +1430,7 @@
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
* LIBSBML_OPERATION_FAILED<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/KineticLaw.h
===================================================================
--- branches/libsbml-4/src/sbml/KineticLaw.h 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/KineticLaw.h 2009-02-27 01:57:18 UTC (rev 9140)
@@ -500,6 +500,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
Modified: branches/libsbml-4/src/sbml/Model.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Model.cpp 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/Model.cpp 2009-02-27 01:57:18 UTC (rev 9140)
@@ -3952,6 +3952,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -3976,6 +3977,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4000,6 +4002,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4024,6 +4027,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4048,6 +4052,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4072,6 +4077,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4096,6 +4102,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4120,6 +4127,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4144,6 +4152,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4192,6 +4201,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -4216,6 +4226,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
Modified: branches/libsbml-4/src/sbml/Model.h
===================================================================
--- branches/libsbml-4/src/sbml/Model.h 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/Model.h 2009-02-27 01:57:18 UTC (rev 9140)
@@ -359,6 +359,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -389,6 +390,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -419,6 +421,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -449,6 +452,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -479,6 +483,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -509,6 +514,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -539,6 +545,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -569,6 +576,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -599,6 +607,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -659,6 +668,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
@@ -689,6 +699,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
Modified: branches/libsbml-4/src/sbml/UnitDefinition.cpp
===================================================================
--- branches/libsbml-4/src/sbml/UnitDefinition.cpp 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/UnitDefinition.cpp 2009-02-27 01:57:18 UTC (rev 9140)
@@ -1617,6 +1617,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
Modified: branches/libsbml-4/src/sbml/UnitDefinition.h
===================================================================
--- branches/libsbml-4/src/sbml/UnitDefinition.h 2009-02-26 23:55:34 UTC (rev 9139)
+++ branches/libsbml-4/src/sbml/UnitDefinition.h 2009-02-27 01:57:18 UTC (rev 9140)
@@ -441,6 +441,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_LEVEL_MISMATCH<br>
* LIBSBML_VERSION_MISMATCH<br>
+ * LIBSBML_DUPLICATE_OBJECT_ID<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @note This method should be used with some caution. The fact that
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 23:55:39
|
Revision: 9139
http://sbml.svn.sourceforge.net/sbml/?rev=9139&view=rev
Author: sarahkeating
Date: 2009-02-26 23:55:34 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
merged from trunk ---
Akiya's fix for the crash if converting from an L2V4 model
plus other fixes to unit code
plus tests
Modified Paths:
--------------
branches/libsbml-4/src/units/UnitFormulaFormatter.cpp
branches/libsbml-4/src/units/test/TestUnitFormulaFormatter.cpp
branches/libsbml-4/src/units/test/TestUnitFormulaFormatter1.cpp
Modified: branches/libsbml-4/src/units/UnitFormulaFormatter.cpp
===================================================================
--- branches/libsbml-4/src/units/UnitFormulaFormatter.cpp 2009-02-26 23:54:04 UTC (rev 9138)
+++ branches/libsbml-4/src/units/UnitFormulaFormatter.cpp 2009-02-26 23:55:34 UTC (rev 9139)
@@ -228,7 +228,9 @@
ud = new UnitDefinition(model->getLevel(), model->getVersion());
}
- UnitDefinition::simplify(ud);
+ // dont simplify an empty ud
+ if (ud->getNumUnits() > 1)
+ UnitDefinition::simplify(ud);
--depthRecursiveCall;
@@ -345,21 +347,28 @@
int numChildren = node->getNumChildren();
int n = 0;
unsigned int i;
- unsigned int currentIgnore = mCanIgnoreUndeclaredUnits;;
+ unsigned int currentIgnore = mCanIgnoreUndeclaredUnits;
ud = getUnitDefinition(node->getChild(n), inKL, reactNo);
if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
- for(n = 1; n < numChildren; n++)
+ if (ud)
{
- tempUD = getUnitDefinition(node->getChild(n), inKL, reactNo);
- if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
- for (i = 0; i < tempUD->getNumUnits(); i++)
+ for(n = 1; n < numChildren; n++)
{
- ud->addUnit(tempUD->getUnit(i));
+ tempUD = getUnitDefinition(node->getChild(n), inKL, reactNo);
+ if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
+ for (i = 0; i < tempUD->getNumUnits(); i++)
+ {
+ ud->addUnit(tempUD->getUnit(i));
+ }
+ delete tempUD;
}
- delete tempUD;
}
+ else
+ {
+ ud = new UnitDefinition(model->getLevel(), model->getVersion());
+ }
mCanIgnoreUndeclaredUnits = currentIgnore;
return ud;
@@ -1228,6 +1237,14 @@
delete unit;
}
}
+ else if (subsUD == NULL)
+ {
+ // units is undefined
+
+ // as a safety catch
+ return new UnitDefinition();
+ }
+
}
if (species->getHasOnlySubstanceUnits())
{
@@ -1238,7 +1255,7 @@
/* get the compartment containing the species */
c = model->getCompartment(species->getCompartment().c_str());
- if (c->getSpatialDimensions() == 0)
+ if (c && c->getSpatialDimensions() == 0)
{
ud = subsUD;
return ud;
Modified: branches/libsbml-4/src/units/test/TestUnitFormulaFormatter.cpp
===================================================================
--- branches/libsbml-4/src/units/test/TestUnitFormulaFormatter.cpp 2009-02-26 23:54:04 UTC (rev 9138)
+++ branches/libsbml-4/src/units/test/TestUnitFormulaFormatter.cpp 2009-02-26 23:55:34 UTC (rev 9139)
@@ -199,8 +199,17 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check an invalid node */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+ ASTNode *node = new ASTNode(AST_PLUS);
+
+ ud1 = uff->getUnitDefinition(node);
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
}
END_TEST
@@ -259,8 +268,18 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check an invalid node */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+ ASTNode *node = new ASTNode(AST_TIMES);
+
+ ud1 = uff->getUnitDefinition(node);
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
+
}
END_TEST
@@ -301,8 +320,24 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+ ASTNode *node = new ASTNode(AST_FUNCTION_PIECEWISE);
+ ud1 == uff->getUnitDefinition(node);
+
+ fail_unless (ud1->getNumUnits() == 0);
+
+ ASTNode *c = new ASTNode(AST_UNKNOWN);
+ node->addChild(c);
+
+ ud1 == uff->getUnitDefinition(node);
+
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
}
END_TEST
Modified: branches/libsbml-4/src/units/test/TestUnitFormulaFormatter1.cpp
===================================================================
--- branches/libsbml-4/src/units/test/TestUnitFormulaFormatter1.cpp 2009-02-26 23:54:04 UTC (rev 9138)
+++ branches/libsbml-4/src/units/test/TestUnitFormulaFormatter1.cpp 2009-02-26 23:55:34 UTC (rev 9139)
@@ -229,7 +229,18 @@
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+
+ Compartment *c = new Compartment(m->getLevel(), m->getVersion());
+ c->setId("c");
+ c->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromCompartment(c);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete c;
+ delete ud1;
}
END_TEST
@@ -377,8 +388,26 @@
fail_unless(ud->getUnit(1)->getOffset() == 0.0);
fail_unless(ud->getUnit(1)->getKind() == UNIT_KIND_LITRE);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+
+ Species *s = new Species(m->getLevel(), m->getVersion());
+ s->setId("s");
+ s->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromSpecies(s);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ s->setUnits("mole"); // here the compartment size will be NULL
+
+ ud1 = uff->getUnitDefinitionFromSpecies(s);
+
+ fail_unless (ud->getNumUnits() == 0);
+ delete s;
+ delete ud1;
+
}
END_TEST
@@ -438,8 +467,21 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_SECOND);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+
+ Parameter *p = new Parameter(m->getLevel(), m->getVersion());
+ p->setId("p");
+ p->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromParameter(p);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete p;
+ delete ud1;
+
}
END_TEST
@@ -560,9 +602,21 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_SECOND);
-
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition(m->getLevel(), m->getVersion());
+
+ Event *e = new Event(m->getLevel(), m->getVersion());
+ e->setId("p");
+ e->setTimeUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromEventTime(e);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete e;
+ delete ud1;
+
}
END_TEST
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 23:54:09
|
Revision: 9138
http://sbml.svn.sourceforge.net/sbml/?rev=9138&view=rev
Author: sarahkeating
Date: 2009-02-26 23:54:04 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
merged from trunk ---
when checking whether species appearing within a KineticLaw have been declared as reactants/products/modifiers the list was not being cleared each time - and thus failing to report missing species. Thanks to Lukas Endler for reporting this.
Modified Paths:
--------------
branches/libsbml-4/src/validator/constraints/KineticLawVars.cpp
Modified: branches/libsbml-4/src/validator/constraints/KineticLawVars.cpp
===================================================================
--- branches/libsbml-4/src/validator/constraints/KineticLawVars.cpp 2009-02-26 23:39:31 UTC (rev 9137)
+++ branches/libsbml-4/src/validator/constraints/KineticLawVars.cpp 2009-02-26 23:54:04 UTC (rev 9138)
@@ -91,6 +91,8 @@
}
delete names;
}
+
+ mSpecies.clear();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 23:39:36
|
Revision: 9137
http://sbml.svn.sourceforge.net/sbml/?rev=9137&view=rev
Author: sarahkeating
Date: 2009-02-26 23:39:31 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
added tests to check that incorrect nodes/ units will not crash code
Modified Paths:
--------------
trunk/libsbml/src/units/UnitFormulaFormatter.cpp
trunk/libsbml/src/units/test/TestUnitFormulaFormatter.cpp
trunk/libsbml/src/units/test/TestUnitFormulaFormatter1.cpp
Modified: trunk/libsbml/src/units/UnitFormulaFormatter.cpp
===================================================================
--- trunk/libsbml/src/units/UnitFormulaFormatter.cpp 2009-02-26 22:19:14 UTC (rev 9136)
+++ trunk/libsbml/src/units/UnitFormulaFormatter.cpp 2009-02-26 23:39:31 UTC (rev 9137)
@@ -228,7 +228,9 @@
ud = new UnitDefinition();
}
- UnitDefinition::simplify(ud);
+ // dont simplify an empty ud
+ if (ud->getNumUnits() > 1)
+ UnitDefinition::simplify(ud);
--depthRecursiveCall;
@@ -344,21 +346,28 @@
int numChildren = node->getNumChildren();
int n = 0;
unsigned int i;
- unsigned int currentIgnore = mCanIgnoreUndeclaredUnits;;
+ unsigned int currentIgnore = mCanIgnoreUndeclaredUnits;
ud = getUnitDefinition(node->getChild(n), inKL, reactNo);
if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
- for(n = 1; n < numChildren; n++)
+ if (ud)
{
- tempUD = getUnitDefinition(node->getChild(n), inKL, reactNo);
- if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
- for (i = 0; i < tempUD->getNumUnits(); i++)
+ for(n = 1; n < numChildren; n++)
{
- ud->addUnit(tempUD->getUnit(i));
+ tempUD = getUnitDefinition(node->getChild(n), inKL, reactNo);
+ if (mCanIgnoreUndeclaredUnits == 0) currentIgnore = 0;
+ for (i = 0; i < tempUD->getNumUnits(); i++)
+ {
+ ud->addUnit(tempUD->getUnit(i));
+ }
+ delete tempUD;
}
- delete tempUD;
}
+ else
+ {
+ ud = new UnitDefinition();
+ }
mCanIgnoreUndeclaredUnits = currentIgnore;
return ud;
Modified: trunk/libsbml/src/units/test/TestUnitFormulaFormatter.cpp
===================================================================
--- trunk/libsbml/src/units/test/TestUnitFormulaFormatter.cpp 2009-02-26 22:19:14 UTC (rev 9136)
+++ trunk/libsbml/src/units/test/TestUnitFormulaFormatter.cpp 2009-02-26 23:39:31 UTC (rev 9137)
@@ -199,8 +199,17 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check an invalid node */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+ ASTNode *node = new ASTNode(AST_PLUS);
+
+ ud1 = uff->getUnitDefinition(node);
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
}
END_TEST
@@ -259,8 +268,18 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check an invalid node */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+ ASTNode *node = new ASTNode(AST_TIMES);
+
+ ud1 = uff->getUnitDefinition(node);
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
+
}
END_TEST
@@ -301,8 +320,24 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+ ASTNode *node = new ASTNode(AST_FUNCTION_PIECEWISE);
+ ud1 == uff->getUnitDefinition(node);
+
+ fail_unless (ud1->getNumUnits() == 0);
+
+ ASTNode *c = new ASTNode(AST_UNKNOWN);
+ node->addChild(c);
+
+ ud1 == uff->getUnitDefinition(node);
+
+ fail_unless (ud1->getNumUnits() == 0);
+
+ delete ud1;
+ delete node;
}
END_TEST
Modified: trunk/libsbml/src/units/test/TestUnitFormulaFormatter1.cpp
===================================================================
--- trunk/libsbml/src/units/test/TestUnitFormulaFormatter1.cpp 2009-02-26 22:19:14 UTC (rev 9136)
+++ trunk/libsbml/src/units/test/TestUnitFormulaFormatter1.cpp 2009-02-26 23:39:31 UTC (rev 9137)
@@ -228,8 +228,20 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_METRE);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+
+ Compartment *c = new Compartment();
+ c->setId("c");
+ c->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromCompartment(c);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete c;
+ delete ud1;
}
END_TEST
@@ -377,8 +389,26 @@
fail_unless(ud->getUnit(1)->getOffset() == 0.0);
fail_unless(ud->getUnit(1)->getKind() == UNIT_KIND_LITRE);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+
+ Species *s = new Species();
+ s->setId("s");
+ s->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromSpecies(s);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ s->setUnits("mole"); // here the compartment size will be NULL
+
+ ud1 = uff->getUnitDefinitionFromSpecies(s);
+
+ fail_unless (ud->getNumUnits() == 0);
+ delete s;
+ delete ud1;
+
}
END_TEST
@@ -438,8 +468,21 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_SECOND);
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+
+ Parameter *p = new Parameter();
+ p->setId("p");
+ p->setUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromParameter(p);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete p;
+ delete ud1;
+
}
END_TEST
@@ -560,9 +603,21 @@
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_SECOND);
-
+ /* check deals with invalid nodes */
delete ud;
+ UnitDefinition * ud1 = new UnitDefinition();
+
+ Event *e = new Event();
+ e->setId("p");
+ e->setTimeUnits("undefined");
+ ud1 = uff->getUnitDefinitionFromEventTime(e);
+
+ fail_unless (ud->getNumUnits() == 0);
+
+ delete e;
+ delete ud1;
+
}
END_TEST
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 22:19:19
|
Revision: 9136
http://sbml.svn.sourceforge.net/sbml/?rev=9136&view=rev
Author: sarahkeating
Date: 2009-02-26 22:19:14 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
updated news with latest fixes
Modified Paths:
--------------
trunk/libsbml/NEWS.txt
Modified: trunk/libsbml/NEWS.txt
===================================================================
--- trunk/libsbml/NEWS.txt 2009-02-26 21:49:04 UTC (rev 9135)
+++ trunk/libsbml/NEWS.txt 2009-02-26 22:19:14 UTC (rev 9136)
@@ -6,29 +6,41 @@
* New features:
- - The ASTNode class has as a user data field. This is a new member
+ - [Tracker issue #1820528]
+ The ASTNode class has as a user data field. This is a new member
variable of type void * which allows a user to add/retrieve their
own data. Thanks to Sebastian Bauer for contributing this code.
* Bug fixes:
- - An object being read from a file/string was not correctly recording
- the SBMLDocument and ParentSBMLObject information. This is fixed.
- Thanks to Andreas Drager for reporting this.
+ - Conversion of an L2V4 model to an earlier version of SBML was
+ causing the code to crash if an invalid unit had been used within
+ the model. This has been fixed. Thanks to Norihiro Kikuchi for
+ reporting this
+
+ - An object being read from a file/string was not correctly
+ recording the SBMLDocument and ParentSBMLObject information. This
+ is fixed. Thanks to Andreas Drager for reporting this.
- - In a couple of cases the return type for the clone function in the
- C API was still an SBase_t *, rather than a pointer to the structure
- being cloned. These have been changed.
+ - In a couple of cases the return type for the clone function in
+ the C API was still an SBase_t *, rather than a pointer to the
+ structure being cloned. These have been changed.
- - The code that converted a string to an XMLNode uses a dummy node as
- part of the process. This empty dummy node was left in the resulting
- XMLNode which, whilst not invalid, meant manipulating the XMLNode was
- not intuitive. The code has been changed to remove the dummy node
- from the resulting XMLNode.
+ - The code that converted a string to an XMLNode uses a dummy node
+ as part of the process. This empty dummy node was left in the
+ resulting XMLNode which, whilst not invalid, meant manipulating
+ the XMLNode was not intuitive. The code has been changed to
+ remove the dummy node from the resulting XMLNode.
- - Potential memory leaks present within the appendNotes function have
- been identified and fixed.
+ - Potential memory leaks present within the appendNotes function
+ have been identified and fixed.
+ - [Tracker issue #2641323]
+ In certain cases validation was failing to report that a species
+ used in a kineticLaw had not been listed as a reactant/product/
+ modifier of the reaction. Thanks to Lukas Endler and Ralph Gauges
+ who independently reported this (on the same day!).
+
- [Tracker issue #2599679]
Python bindings didn't work with the latest SWIG 1.3.38 due to
incompatible changes in SWIG-generated Python proxy code (libsbml.py).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 21:49:08
|
Revision: 9135
http://sbml.svn.sourceforge.net/sbml/?rev=9135&view=rev
Author: sarahkeating
Date: 2009-02-26 21:49:04 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
when checking whether species appearing within a KineticLaw have been declared as reactants/products/modifiers the list was not being cleared each time - and thus failing to report missing species. Thanks to Lukas Endler for reporting this.
Modified Paths:
--------------
trunk/libsbml/src/validator/constraints/KineticLawVars.cpp
Modified: trunk/libsbml/src/validator/constraints/KineticLawVars.cpp
===================================================================
--- trunk/libsbml/src/validator/constraints/KineticLawVars.cpp 2009-02-26 17:27:31 UTC (rev 9134)
+++ trunk/libsbml/src/validator/constraints/KineticLawVars.cpp 2009-02-26 21:49:04 UTC (rev 9135)
@@ -91,6 +91,8 @@
}
delete names;
}
+
+ mSpecies.clear();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 17:27:41
|
Revision: 9134
http://sbml.svn.sourceforge.net/sbml/?rev=9134&view=rev
Author: sarahkeating
Date: 2009-02-26 17:27:31 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
Akiya's fix for the crash if converting from an L2V4 model
Modified Paths:
--------------
trunk/libsbml/src/units/UnitFormulaFormatter.cpp
Modified: trunk/libsbml/src/units/UnitFormulaFormatter.cpp
===================================================================
--- trunk/libsbml/src/units/UnitFormulaFormatter.cpp 2009-02-25 23:07:26 UTC (rev 9133)
+++ trunk/libsbml/src/units/UnitFormulaFormatter.cpp 2009-02-26 17:27:31 UTC (rev 9134)
@@ -1205,6 +1205,14 @@
delete unit;
}
}
+ else if (subsUD == NULL)
+ {
+ // units is undefined
+
+ // as a safety catch
+ return new UnitDefinition();
+ }
+
}
if (species->getHasOnlySubstanceUnits())
{
@@ -1215,7 +1223,7 @@
/* get the compartment containing the species */
c = model->getCompartment(species->getCompartment().c_str());
- if (c->getSpatialDimensions() == 0)
+ if (c && c->getSpatialDimensions() == 0)
{
ud = subsUD;
return ud;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 00:23:07
|
Revision: 9129
http://sbml.svn.sourceforge.net/sbml/?rev=9129&view=rev
Author: sarahkeating
Date: 2009-02-25 21:53:25 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
fixed typo
Modified Paths:
--------------
branches/libsbml-4/src/sbml/test/TestModel.c
Modified: branches/libsbml-4/src/sbml/test/TestModel.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:52:09 UTC (rev 9128)
+++ branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:53:25 UTC (rev 9129)
@@ -731,9 +731,9 @@
START_TEST (test_Model_addRules)
{
- Rule_t *r1 = Rule_createAlgebraicWithLevelVersionAndNamespaces(2, 4, NULL));
- Rule_t *r2 = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL));
- Rule_t *r3 = Rule_createRateWithLevelVersionAndNamespaces(2, 4, NULL));
+ Rule_t *r1 = Rule_createAlgebraicWithLevelVersionAndNamespaces(2, 4, NULL);
+ Rule_t *r2 = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL);
+ Rule_t *r3 = Rule_createRateWithLevelVersionAndNamespaces(2, 4, NULL);
Rule_setVariable(r2, "r2");
Rule_setVariable(r3, "r3");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 00:22:47
|
Revision: 9132
http://sbml.svn.sourceforge.net/sbml/?rev=9132&view=rev
Author: sarahkeating
Date: 2009-02-25 22:59:42 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
merged the addition of the UserDataField from SVN trunk
Modified Paths:
--------------
branches/libsbml-4/src/math/ASTNode.cpp
branches/libsbml-4/src/math/ASTNode.h
Modified: branches/libsbml-4/src/math/ASTNode.cpp
===================================================================
--- branches/libsbml-4/src/math/ASTNode.cpp 2009-02-25 22:38:53 UTC (rev 9131)
+++ branches/libsbml-4/src/math/ASTNode.cpp 2009-02-25 22:59:42 UTC (rev 9132)
@@ -175,6 +175,7 @@
mInteger = 0;
mDenominator = 1;
mParentSBMLObject = NULL;
+ mUserData = NULL;
setType(type);
@@ -201,6 +202,7 @@
mInteger = 0;
mDenominator = 1;
mParentSBMLObject = NULL;
+ mUserData = NULL;
mChildren = new List;
mSemanticsAnnotations = new List;
@@ -246,6 +248,7 @@
,mChildren ( new List() )
,mSemanticsAnnotations ( new List() )
,mParentSBMLObject ( orig.mParentSBMLObject )
+ ,mUserData ( orig.mUserData )
{
if (orig.mName)
{
@@ -1777,9 +1780,24 @@
/** @endcond doxygen-libsbml-internal */
+LIBSBML_EXTERN
+void
+ASTNode::replaceArgument(const std::string bvar, ASTNode * arg)
+{
+ this->ReplaceArgument(bvar, arg);
+}
+
LIBSBML_EXTERN
void
+ASTNode::reduceToBinary()
+{
+ this->ReduceToBinary();
+}
+
+/** @cond doxygen-libsbml-internal */
+LIBSBML_EXTERN
+void
ASTNode::ReplaceArgument(const std::string bvar, ASTNode * arg)
{
if (arg == NULL)
@@ -1881,6 +1899,7 @@
ReduceToBinary();
}
+/** @endcond doxygen-libsbml-internal */
/** @cond doxygen-libsbml-internal */
@@ -1911,7 +1930,29 @@
return mDefinitionURL;
}
+LIBSBML_EXTERN
+void *
+ASTNode::getUserData() const
+{
+ return this->mUserData;
+}
+
+LIBSBML_EXTERN
+int
+ASTNode::setUserData(void *userData)
+{
+ this->mUserData = userData;
+ if (mUserData != NULL)
+ {
+ return LIBSBML_OPERATION_SUCCESS;
+ }
+ else
+ {
+ return LIBSBML_OPERATION_FAILED;
+ }
+}
+
/**
* Creates a new ASTNode and returns a pointer to it. The returned node
* will have a type of AST_UNKNOWN and should be set to something else as
@@ -2878,4 +2919,41 @@
{
return node->getSemanticsAnnotation(n);
}
+/**
+ * Sets the user data of this node. This can be used by the application
+ * developer to attach custom information to the node. In case of a deep
+ * copy this attribute will passed as it is. The attribute will be never
+ * interpreted by this class.
+ *
+ * @param node defines the node of which the user data should be set.
+ * @param userData specifies the new user data.
+ *
+ * @return integer value indicating success/failure of the
+ * function. The value is drawn from the
+ * enumeration operationReturnValues_t. The possible values
+ * returned by this function are:
+ *
+ * LIBSBML_OPERATION_SUCCESS<br>
+ * LIBSBML_OPERATION_FAILED<br>
+ */
+LIBSBML_EXTERN
+int
+ASTNode_setUserData(ASTNode_t* node, void *userData)
+{
+ return node->setUserData(userData);
+}
+
+/**
+ * Returns the user data that has been previously set by setUserData().
+ *
+ * @param node defines the node of interest.
+ * @return the user data of this node. NULL if no user data has been.
+ * @see ASTNode_setUserData
+ */
+LIBSBML_EXTERN
+void *ASTNode_getUserData(ASTNode_t* node)
+{
+ return node->getUserData();
+}
+
Modified: branches/libsbml-4/src/math/ASTNode.h
===================================================================
--- branches/libsbml-4/src/math/ASTNode.h 2009-02-25 22:38:53 UTC (rev 9131)
+++ branches/libsbml-4/src/math/ASTNode.h 2009-02-25 22:59:42 UTC (rev 9132)
@@ -1274,10 +1274,24 @@
*/
LIBSBML_EXTERN
- void ReplaceArgument(const std::string bvar, ASTNode * arg);
+ void replaceArgument(const std::string bvar, ASTNode * arg);
/** @cond doxygen-libsbml-internal */
+ /*
+ * Replaces occurences of a name within this ASTNode with the name/value/formula
+ * represented by the second argument ASTNode
+ * e.g. if the formula in this ASTNode is x + y; bvar is x and arg is an
+ * ASTNode representing the real value 3 ReplaceArgument substitutes 3 for
+ * x within this ASTNode
+ *
+ * @param bvar a string representing the variable name to be substituted
+ * @param arg an ASTNode representing the name/value/formula to substitute
+ */
+
+ LIBSBML_EXTERN
+ void ReplaceArgument(const std::string bvar, ASTNode * arg);
+
/**
* Sets the parent SBML object.
*
@@ -1297,14 +1311,55 @@
LIBSBML_EXTERN
SBase * getParentSBMLObject() const;
-/**
+ /** @cond doxygen-libsbml-internal */
+ /*
* Reduces this ASTNode to a binary tree
* e.g. if the formula in this ASTNode is and(x, y, z) then the
* formula of the reduced node would be and(and(x, y), z)
*/
LIBSBML_EXTERN
void ReduceToBinary();
+ /** @endcond doxygen-libsbml-internal */
+
+ /**
+ * Reduces this ASTNode to a binary tree
+ * e.g. if the formula in this ASTNode is and(x, y, z) then the
+ * formula of the reduced node would be and(and(x, y), z)
+ */
+ LIBSBML_EXTERN
+ void reduceToBinary();
+
+
+ /**
+ * Sets the user data of this node. This can be used by the application
+ * developer to attach custom information to the node. In case of a deep
+ * copy this attribute will passed as it is. The attribute will be never
+ * interpreted by this class.
+ *
+ * @param userData specifies the new user data.
+ *
+ * @return integer value indicating success/failure of the
+ * function. The value is drawn from the
+ * enumeration operationReturnValues_t. The possible values
+ * returned by this function are:
+ *
+ * LIBSBML_OPERATION_SUCCESS<br>
+ * LIBSBML_OPERATION_FAILED<br>
+ */
+ LIBSBML_EXTERN
+ int
+ setUserData(void *userData);
+
+ /**
+ * Returns the user data that has been previously set via setUserData().
+ *
+ * @return the user data of this node. NULL if no user data has been.
+ * @see ASTNode::setUserData
+ */
+ LIBSBML_EXTERN
+ void *getUserData() const;
+
/** @cond doxygen-libsbml-internal */
bool isValidASTNode() const;
@@ -1345,7 +1400,9 @@
SBase *mParentSBMLObject;
+ void *mUserData;
+
friend class MathMLFormatter;
friend class MathMLHandler;
@@ -1912,6 +1969,14 @@
XMLNode_t *
ASTNode_getSemanticsAnnotation(ASTNode_t* node, unsigned int n);
+LIBSBML_EXTERN
+int
+ASTNode_setUserData(ASTNode_t* node, void *userData);
+
+LIBSBML_EXTERN
+void *
+ASTNode_getUserData(ASTNode_t* node);
+
END_C_DECLS
#endif /* !SWIG */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 00:22:25
|
Revision: 9133
http://sbml.svn.sourceforge.net/sbml/?rev=9133&view=rev
Author: sarahkeating
Date: 2009-02-25 23:07:26 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
functions for setting and retrieving semanticsAnnotation on an ASTNode were missing from the C API - so I've added them :-)
Modified Paths:
--------------
trunk/libsbml/src/math/ASTNode.cpp
trunk/libsbml/src/math/ASTNode.h
Modified: trunk/libsbml/src/math/ASTNode.cpp
===================================================================
--- trunk/libsbml/src/math/ASTNode.cpp 2009-02-25 22:59:42 UTC (rev 9132)
+++ trunk/libsbml/src/math/ASTNode.cpp 2009-02-25 23:07:26 UTC (rev 9133)
@@ -2566,8 +2566,51 @@
return node->insertChild(n, newChild);
}
+/**
+ * Adds the given XMLNode as a semantic annotation of this ASTNode.
+ *
+ * @param node the ASTNode_t to which the annotation is to be added.
+ * @param annotation the XMLNode_t representing the annotation to add.
+ */
+LIBSBML_EXTERN
+void
+ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * annotation)
+{
+ node->addSemanticsAnnotation(annotation);
+}
/**
+ * Get the number of semantic annotation elements inside this node.
+ *
+ * @param node the ASTNode_t structure to query.
+ *
+ * @return the number of annotations of this ASTNode.
+ */
+LIBSBML_EXTERN
+unsigned int
+ASTNode_getNumSemanticsAnnotations(ASTNode_t* node)
+{
+ return node->getNumSemanticsAnnotations();
+}
+
+/**
+ * Get the nth semantic annotation of this node.
+ *
+ * @param node the ASTNode_t structure to query.
+ * @param n unsigned int the index of the annotation to be retrieved.
+ *
+ * @return the nth annotation of this ASTNode, or NULL if this node has no nth
+ * annotation (<code>n > ASTNode_getNumSemanticsAnnotations() - 1</code>).
+ */
+LIBSBML_EXTERN
+XMLNode_t *
+ASTNode_getSemanticsAnnotation(ASTNode_t* node, unsigned int n)
+{
+ return node->getSemanticsAnnotation(n);
+}
+
+
+/**
* Sets the user data of this node. This can be used by the application
* developer to attach custom information to the node. In case of a deep
* copy this attribute will passed as it is. The attribute will be never
Modified: trunk/libsbml/src/math/ASTNode.h
===================================================================
--- trunk/libsbml/src/math/ASTNode.h 2009-02-25 22:59:42 UTC (rev 9132)
+++ trunk/libsbml/src/math/ASTNode.h 2009-02-25 23:07:26 UTC (rev 9133)
@@ -1814,6 +1814,18 @@
ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * newChild);
LIBSBML_EXTERN
+void
+ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * annotation);
+
+LIBSBML_EXTERN
+unsigned int
+ASTNode_getNumSemanticsAnnotations(ASTNode_t* node);
+
+LIBSBML_EXTERN
+XMLNode_t *
+ASTNode_getSemanticsAnnotation(ASTNode_t* node, unsigned int n);
+
+LIBSBML_EXTERN
void
ASTNode_setUserData(ASTNode_t* node, void *userData);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 00:22:22
|
Revision: 9131
http://sbml.svn.sourceforge.net/sbml/?rev=9131&view=rev
Author: sarahkeating
Date: 2009-02-25 22:38:53 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
append function now returns an int to indicate success/failure
Modified Paths:
--------------
branches/libsbml-4/src/xml/XMLToken.cpp
branches/libsbml-4/src/xml/XMLToken.h
Modified: branches/libsbml-4/src/xml/XMLToken.cpp
===================================================================
--- branches/libsbml-4/src/xml/XMLToken.cpp 2009-02-25 21:56:52 UTC (rev 9130)
+++ branches/libsbml-4/src/xml/XMLToken.cpp 2009-02-25 22:38:53 UTC (rev 9131)
@@ -208,13 +208,22 @@
/*
* Appends characters to this XML text content.
*/
-void
+int
XMLToken::append (const std::string& chars)
{
- mChars.append(chars);
+ if (chars.empty())
+ {
+ return LIBSBML_OPERATION_FAILED;
+ }
+ else
+ {
+ mChars.append(chars);
+ return LIBSBML_OPERATION_SUCCESS;
+ }
}
+
/*
* @return the characters of this XML text.
*/
@@ -1360,15 +1369,27 @@
*
* @param token XMLToken_t structure to be appended to.
* @param text string, characters to append
+ *
+ * @return integer value indicating success/failure of the
+ * function. The value is drawn from the
+ * enumeration operationReturnValues_t. The possible values
+ * returned by this function are:
+ *
+ * LIBSBML_OPERATION_SUCCESS<br>
+ * LIBSBML_OPERATION_FAILED<br>
**/
LIBLAX_EXTERN
-void
+int
XMLToken_append (XMLToken_t *token, const char *text)
{
if (text != NULL)
{
- token->append(text);
+ return token->append(text);
}
+ else
+ {
+ return LIBSBML_OPERATION_FAILED;
+ }
}
Modified: branches/libsbml-4/src/xml/XMLToken.h
===================================================================
--- branches/libsbml-4/src/xml/XMLToken.h 2009-02-25 21:56:52 UTC (rev 9130)
+++ branches/libsbml-4/src/xml/XMLToken.h 2009-02-25 22:38:53 UTC (rev 9131)
@@ -899,8 +899,16 @@
* Appends characters to this XML text content.
*
* @param chars string, characters to append
+ *
+ * @return integer value indicating success/failure of the
+ * function. The value is drawn from the
+ * enumeration operationReturnValues_t. The possible values
+ * returned by this function are:
+ *
+ * LIBSBML_OPERATION_SUCCESS<br>
+ * LIBSBML_OPERATION_FAILED<br>
*/
- void append (const std::string& chars);
+ int append (const std::string& chars);
/**
@@ -1128,7 +1136,7 @@
LIBLAX_EXTERN
-void
+int
XMLToken_append (XMLToken_t *token, const char *text);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-26 00:22:12
|
Revision: 9127
http://sbml.svn.sourceforge.net/sbml/?rev=9127&view=rev
Author: sarahkeating
Date: 2009-02-25 21:33:31 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
caught typo
Modified Paths:
--------------
branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
Modified: branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 21:31:56 UTC (rev 9126)
+++ branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 21:33:31 UTC (rev 9127)
@@ -902,12 +902,12 @@
int i = Model_addSpecies(m, s);
fail_unless( i == LIBSBML_OPERATION_SUCCESS);
- fail_unless( Model_getNumSpeciess(m) == 1);
+ fail_unless( Model_getNumSpecies(m) == 1);
i = Model_addSpecies(m, s1);
fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
- fail_unless( Model_getNumSpeciess(m) == 1);
+ fail_unless( Model_getNumSpecies(m) == 1);
Species_free(s);
Species_free(s1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 23:35:28
|
Revision: 9128
http://sbml.svn.sourceforge.net/sbml/?rev=9128&view=rev
Author: sarahkeating
Date: 2009-02-25 21:52:09 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
caught places where test code added multiple objects with no id set and thus a duplicate was being found
Modified Paths:
--------------
branches/libsbml-4/src/sbml/test/TestKineticLaw.c
branches/libsbml-4/src/sbml/test/TestModel.c
Modified: branches/libsbml-4/src/sbml/test/TestKineticLaw.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestKineticLaw.c 2009-02-25 21:33:31 UTC (rev 9127)
+++ branches/libsbml-4/src/sbml/test/TestKineticLaw.c 2009-02-25 21:52:09 UTC (rev 9128)
@@ -338,8 +338,8 @@
Parameter_t *k1 = Parameter_createWithLevelVersionAndNamespaces(2, 4, NULL);
Parameter_t *k2 = Parameter_createWithLevelVersionAndNamespaces(2, 4, NULL);
- Parameter_setName(k1, "k1");
- Parameter_setName(k2, "k2");
+ Parameter_setId(k1, "k1");
+ Parameter_setId(k2, "k2");
Parameter_setValue(k1, 3.14);
Parameter_setValue(k2, 2.72);
Modified: branches/libsbml-4/src/sbml/test/TestModel.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:33:31 UTC (rev 9127)
+++ branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:52:09 UTC (rev 9128)
@@ -667,6 +667,8 @@
FunctionDefinition_t *fd1 = FunctionDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
FunctionDefinition_t *fd2 = FunctionDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
+ FunctionDefinition_setId(fd1, "fd1");
+ FunctionDefinition_setId(fd2, "fd2");
Model_addFunctionDefinition(M, fd1);
Model_addFunctionDefinition(M, fd2);
@@ -685,6 +687,8 @@
UnitDefinition_t *ud1 = UnitDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
UnitDefinition_t *ud2 = UnitDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
+ UnitDefinition_setId(ud1, "ud1");
+ UnitDefinition_setId(ud2, "ud2");
Model_addUnitDefinition(M, ud1);
Model_addUnitDefinition(M, ud2);
@@ -727,13 +731,17 @@
START_TEST (test_Model_addRules)
{
- Model_addRule( M,
- (Rule_t *) Rule_createAlgebraicWithLevelVersionAndNamespaces(2, 4, NULL));
- Model_addRule( M,
- (Rule_t *) Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL));
- Model_addRule( M,
- (Rule_t *) Rule_createRateWithLevelVersionAndNamespaces(2, 4, NULL));
+ Rule_t *r1 = Rule_createAlgebraicWithLevelVersionAndNamespaces(2, 4, NULL));
+ Rule_t *r2 = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL));
+ Rule_t *r3 = Rule_createRateWithLevelVersionAndNamespaces(2, 4, NULL));
+ Rule_setVariable(r2, "r2");
+ Rule_setVariable(r3, "r3");
+
+ Model_addRule( M, r1);
+ Model_addRule( M, r2);
+ Model_addRule( M, r3);
+
fail_unless( Model_getNumRules(M) == 3 );
}
END_TEST
@@ -791,8 +799,8 @@
UnitDefinition_t *ud1 = UnitDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
UnitDefinition_t *ud2 = UnitDefinition_createWithLevelVersionAndNamespaces(2, 4, NULL);
- UnitDefinition_setName( ud1, "mmls" );
- UnitDefinition_setName( ud2, "volume" );
+ UnitDefinition_setId( ud1, "mmls" );
+ UnitDefinition_setId( ud2, "volume" );
Model_addUnitDefinition(M, ud1);
Model_addUnitDefinition(M, ud2);
@@ -833,8 +841,8 @@
Compartment_t *c1 = Compartment_createWithLevelVersionAndNamespaces(2, 4, NULL);
Compartment_t *c2 = Compartment_createWithLevelVersionAndNamespaces(2, 4, NULL);
- Compartment_setName(c1, "A");
- Compartment_setName(c2, "B");
+ Compartment_setId(c1, "A");
+ Compartment_setId(c2, "B");
Model_addCompartment(M, c1);
Model_addCompartment(M, c2);
@@ -876,8 +884,8 @@
Species_t *s1 = Species_createWithLevelVersionAndNamespaces(2, 4, NULL);
Species_t *s2 = Species_createWithLevelVersionAndNamespaces(2, 4, NULL);
- Species_setName( s1, "Glucose" );
- Species_setName( s2, "Glucose_6_P" );
+ Species_setId( s1, "Glucose" );
+ Species_setId( s2, "Glucose_6_P" );
Model_addSpecies(M, s1);
Model_addSpecies(M, s2);
@@ -918,8 +926,8 @@
Parameter_t *p1 = Parameter_createWithLevelVersionAndNamespaces(2, 4, NULL);
Parameter_t *p2 = Parameter_createWithLevelVersionAndNamespaces(2, 4, NULL);
- Parameter_setName(p1, "Km1");
- Parameter_setName(p2, "Km2");
+ Parameter_setId(p1, "Km1");
+ Parameter_setId(p2, "Km2");
Model_addParameter(M, p1);
Model_addParameter(M, p2);
@@ -962,7 +970,11 @@
Rule_t *cvr = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL);
Rule_t *pr = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 4, NULL);
+ Rule_setVariable(scr, "r2");
+ Rule_setVariable(cvr, "r3");
+ Rule_setVariable(pr, "r4");
+
Rule_setFormula( ar , "x + 1" );
Rule_setFormula( scr, "k * t/(1 + k)" );
Rule_setFormula( cvr, "0.10 * t" );
@@ -993,8 +1005,8 @@
Reaction_t *r1 = Reaction_createWithLevelVersionAndNamespaces(2, 4, NULL);
Reaction_t *r2 = Reaction_createWithLevelVersionAndNamespaces(2, 4, NULL);
- Reaction_setName(r1, "reaction_1");
- Reaction_setName(r2, "reaction_2");
+ Reaction_setId(r1, "reaction_1");
+ Reaction_setId(r2, "reaction_2");
Model_addReaction(M, r1);
Model_addReaction(M, r2);
@@ -1102,6 +1114,10 @@
Species_t *s2 = Species_createWithLevelVersionAndNamespaces(2, 4, NULL);
Species_t *s3 = Species_createWithLevelVersionAndNamespaces(2, 4, NULL);
+ Species_setId(s1, "s1");
+ Species_setId(s2, "s2");
+ Species_setId(s3, "s3");
+
Species_setBoundaryCondition(s1, 1);
Species_setBoundaryCondition(s2, 0);
Species_setBoundaryCondition(s3, 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 23:35:24
|
Revision: 9126
http://sbml.svn.sourceforge.net/sbml/?rev=9126&view=rev
Author: sarahkeating
Date: 2009-02-25 21:31:56 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
changed code so that an add function will fail if the object to be added duplicates the id of an existing object
NOTE: only similar object ids are checked - not objects within the entirety of the parent
Modified Paths:
--------------
branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
Modified: branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 21:28:08 UTC (rev 9125)
+++ branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 21:31:56 UTC (rev 9126)
@@ -358,10 +358,10 @@
Event_t *e = Event_createWithLevelVersionAndNamespaces(2, 2, 0);
EventAssignment_t *ea
= EventAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
- ea->setVariable("c");
+ EventAssignment_setVariable(ea, "c");
EventAssignment_t *ea1
= EventAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
- ea1->setVariable("c");
+ EventAssignment_setVariable(ea1, "c");
int i = Event_addEventAssignment(e, ea);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 23:35:18
|
Revision: 9130
http://sbml.svn.sourceforge.net/sbml/?rev=9130&view=rev
Author: sarahkeating
Date: 2009-02-25 21:56:52 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
caught places where Name should be Id
Modified Paths:
--------------
branches/libsbml-4/src/sbml/test/TestKineticLaw.c
branches/libsbml-4/src/sbml/test/TestModel.c
Modified: branches/libsbml-4/src/sbml/test/TestKineticLaw.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestKineticLaw.c 2009-02-25 21:53:25 UTC (rev 9129)
+++ branches/libsbml-4/src/sbml/test/TestKineticLaw.c 2009-02-25 21:56:52 UTC (rev 9130)
@@ -354,8 +354,8 @@
k1 = KineticLaw_getParameter(KL, 0);
k2 = KineticLaw_getParameter(KL, 1);
- fail_unless( !strcmp(Parameter_getName(k1), "k1") );
- fail_unless( !strcmp(Parameter_getName(k2), "k2") );
+ fail_unless( !strcmp(Parameter_getId(k1), "k1") );
+ fail_unless( !strcmp(Parameter_getId(k2), "k2") );
fail_unless( Parameter_getValue(k1) == 3.14 );
fail_unless( Parameter_getValue(k2) == 2.72 );
Modified: branches/libsbml-4/src/sbml/test/TestModel.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:53:25 UTC (rev 9129)
+++ branches/libsbml-4/src/sbml/test/TestModel.c 2009-02-25 21:56:52 UTC (rev 9130)
@@ -810,8 +810,8 @@
ud1 = Model_getUnitDefinition(M, 0);
ud2 = Model_getUnitDefinition(M, 1);
- fail_unless( !strcmp( UnitDefinition_getName(ud1), "mmls" ) );
- fail_unless( !strcmp( UnitDefinition_getName(ud2), "volume" ) );
+ fail_unless( !strcmp( UnitDefinition_getId(ud1), "mmls" ) );
+ fail_unless( !strcmp( UnitDefinition_getId(ud2), "volume" ) );
}
END_TEST
@@ -852,8 +852,8 @@
c1 = Model_getCompartment(M, 0);
c2 = Model_getCompartment(M, 1);
- fail_unless( !strcmp(Compartment_getName(c1), "A") );
- fail_unless( !strcmp(Compartment_getName(c2), "B") );
+ fail_unless( !strcmp(Compartment_getId(c1), "A") );
+ fail_unless( !strcmp(Compartment_getId(c2), "B") );
}
END_TEST
@@ -895,8 +895,8 @@
s1 = Model_getSpecies(M, 0);
s2 = Model_getSpecies(M, 1);
- fail_unless( !strcmp( Species_getName(s1), "Glucose" ) );
- fail_unless( !strcmp( Species_getName(s2), "Glucose_6_P" ) );
+ fail_unless( !strcmp( Species_getId(s1), "Glucose" ) );
+ fail_unless( !strcmp( Species_getId(s2), "Glucose_6_P" ) );
}
END_TEST
@@ -937,8 +937,8 @@
p1 = Model_getParameter(M, 0);
p2 = Model_getParameter(M, 1);
- fail_unless( !strcmp(Parameter_getName(p1), "Km1") );
- fail_unless( !strcmp(Parameter_getName(p2), "Km2") );
+ fail_unless( !strcmp(Parameter_getId(p1), "Km1") );
+ fail_unless( !strcmp(Parameter_getId(p2), "Km2") );
}
END_TEST
@@ -1016,8 +1016,8 @@
r1 = Model_getReaction(M, 0);
r2 = Model_getReaction(M, 1);
- fail_unless( !strcmp(Reaction_getName(r1), "reaction_1") );
- fail_unless( !strcmp(Reaction_getName(r2), "reaction_2") );
+ fail_unless( !strcmp(Reaction_getId(r1), "reaction_1") );
+ fail_unless( !strcmp(Reaction_getId(r2), "reaction_2") );
}
END_TEST
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 21:28:11
|
Revision: 9125
http://sbml.svn.sourceforge.net/sbml/?rev=9125&view=rev
Author: sarahkeating
Date: 2009-02-25 21:28:08 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
changed code so that an add function will fail if the object to be added duplicates the id of an existing object
NOTE: only similar object ids are checked - not objects within the entirety of the parent
Modified Paths:
--------------
branches/libsbml-4/src/sbml/KineticLaw.cpp
branches/libsbml-4/src/sbml/Model.cpp
branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
Modified: branches/libsbml-4/src/sbml/KineticLaw.cpp
===================================================================
--- branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-25 19:14:56 UTC (rev 9124)
+++ branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-25 21:28:08 UTC (rev 9125)
@@ -429,6 +429,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getParameter(p->getId()) != NULL)
+ {
+ // an parameter with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
Modified: branches/libsbml-4/src/sbml/Model.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Model.cpp 2009-02-25 19:14:56 UTC (rev 9124)
+++ branches/libsbml-4/src/sbml/Model.cpp 2009-02-25 21:28:08 UTC (rev 9125)
@@ -299,6 +299,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getFunctionDefinition(fd->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -333,6 +338,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getUnitDefinition(ud->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -367,6 +377,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getCompartmentType(ct->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -401,6 +416,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getSpeciesType(st->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -435,6 +455,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getCompartment(c->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -469,6 +494,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getSpecies(s->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -503,6 +533,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getParameter(p->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -537,6 +572,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getInitialAssignment(ia->getSymbol()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -571,6 +611,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getRule(r->getVariable()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -639,6 +684,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getReaction(r->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
@@ -673,6 +723,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (e->isSetId() && getEvent(e->getId()) != NULL)
+ {
+ // an object with this id already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
Modified: branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
+++ branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 21:28:08 UTC (rev 9125)
@@ -353,6 +353,33 @@
END_TEST
+START_TEST (test_Event_addEventAssignment4)
+{
+ Event_t *e = Event_createWithLevelVersionAndNamespaces(2, 2, 0);
+ EventAssignment_t *ea
+ = EventAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ ea->setVariable("c");
+ EventAssignment_t *ea1
+ = EventAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ ea1->setVariable("c");
+
+ int i = Event_addEventAssignment(e, ea);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Event_getNumEventAssignments(e) == 1);
+
+ i = Event_addEventAssignment(e, ea1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Event_getNumEventAssignments(e) == 1);
+
+ EventAssignment_free(ea);
+ EventAssignment_free(ea1);
+ Event_free(e);
+}
+END_TEST
+
+
START_TEST (test_Event_createEventAssignment)
{
Event_t *e = Event_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -398,6 +425,7 @@
tcase_add_test( tcase, test_Event_addEventAssignment1 );
tcase_add_test( tcase, test_Event_addEventAssignment2 );
tcase_add_test( tcase, test_Event_addEventAssignment3 );
+ tcase_add_test( tcase, test_Event_addEventAssignment4 );
tcase_add_test( tcase, test_Event_createEventAssignment );
suite_add_tcase(suite, tcase);
Modified: branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
+++ branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 21:28:08 UTC (rev 9125)
@@ -250,6 +250,34 @@
END_TEST
+START_TEST (test_Model_addFunctionDefinition4)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ FunctionDefinition_t *fd
+ = FunctionDefinition_createWithLevelVersionAndNamespaces(2, 2, 0);
+ FunctionDefinition_setId(fd, "fd");
+ FunctionDefinition_t *fd1
+ = FunctionDefinition_createWithLevelVersionAndNamespaces(2, 2, 0);
+ FunctionDefinition_setId(fd1, "fd");
+
+ int i = Model_addFunctionDefinition(m, fd);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumFunctionDefinitions(m) == 1);
+
+ i = Model_addFunctionDefinition(m, fd1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumFunctionDefinitions(m) == 1);
+
+ FunctionDefinition_free(fd);
+ FunctionDefinition_free(fd1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addCompartmentType1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -299,6 +327,34 @@
END_TEST
+START_TEST (test_Model_addCompartmentType4)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ CompartmentType_t *ct
+ = CompartmentType_createWithLevelVersionAndNamespaces(2, 2, 0);
+ CompartmentType_setId(ct, "ct");
+ CompartmentType_t *ct1
+ = CompartmentType_createWithLevelVersionAndNamespaces(2, 2, 0);
+ CompartmentType_setId(ct1, "ct");
+
+ int i = Model_addCompartmentType(m, ct);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumCompartmentTypes(m) == 1);
+
+ i = Model_addCompartmentType(m, ct1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumCompartmentTypes(m) == 1);
+
+ CompartmentType_free(ct);
+ CompartmentType_free(ct1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addSpeciesType1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -348,6 +404,34 @@
END_TEST
+START_TEST (test_Model_addSpeciesType4)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ SpeciesType_t *st
+ = SpeciesType_createWithLevelVersionAndNamespaces(2, 2, 0);
+ SpeciesType_setId(st, "st");
+ SpeciesType_t *st1
+ = SpeciesType_createWithLevelVersionAndNamespaces(2, 2, 0);
+ SpeciesType_setId(st1, "st");
+
+ int i = Model_addSpeciesType(m, st);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumSpeciesTypes(m) == 1);
+
+ i = Model_addSpeciesType(m, st1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumSpeciesTypes(m) == 1);
+
+ SpeciesType_free(st);
+ SpeciesType_free(st1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addInitialAssignment1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -397,6 +481,34 @@
END_TEST
+START_TEST (test_Model_addInitialAssignment4)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ InitialAssignment_t *ia
+ = InitialAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ InitialAssignment_setSymbol(ia, "ia");
+ InitialAssignment_t *ia1
+ = InitialAssignment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ InitialAssignment_setSymbol(ia1, "ia");
+
+ int i = Model_addInitialAssignment(m, ia);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumInitialAssignments(m) == 1);
+
+ i = Model_addInitialAssignment(m, ia1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumInitialAssignments(m) == 1);
+
+ InitialAssignment_free(ia);
+ InitialAssignment_free(ia1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addConstraint1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -495,6 +607,34 @@
END_TEST
+START_TEST (test_Model_addEvent4)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Event_t *e
+ = Event_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Event_setId(e, "e");
+ Event_t *e1
+ = Event_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Event_setId(e1, "e");
+
+ int i = Model_addEvent(m, e);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumEvents(m) == 1);
+
+ i = Model_addEvent(m, e1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumEvents(m) == 1);
+
+ Event_free(e);
+ Event_free(e1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addUnitDefinition1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -561,6 +701,34 @@
END_TEST
+START_TEST (test_Model_addUnitDefinition5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ UnitDefinition_t *ud
+ = UnitDefinition_createWithLevelVersionAndNamespaces(2, 2, 0);
+ UnitDefinition_setId(ud, "ud");
+ UnitDefinition_t *ud1
+ = UnitDefinition_createWithLevelVersionAndNamespaces(2, 2, 0);
+ UnitDefinition_setId(ud1, "ud");
+
+ int i = Model_addUnitDefinition(m, ud);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumUnitDefinitions(m) == 1);
+
+ i = Model_addUnitDefinition(m, ud1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumUnitDefinitions(m) == 1);
+
+ UnitDefinition_free(ud);
+ UnitDefinition_free(ud1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addCompartment1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -627,6 +795,34 @@
END_TEST
+START_TEST (test_Model_addCompartment5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Compartment_t *c
+ = Compartment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Compartment_setId(c, "c");
+ Compartment_t *c1
+ = Compartment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Compartment_setId(c1, "c");
+
+ int i = Model_addCompartment(m, c);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumCompartments(m) == 1);
+
+ i = Model_addCompartment(m, c1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumCompartments(m) == 1);
+
+ Compartment_free(c);
+ Compartment_free(c1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addSpecies1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -693,6 +889,34 @@
END_TEST
+START_TEST (test_Model_addSpecies5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Species_t *s
+ = Species_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Species_setId(s, "s");
+ Species_t *s1
+ = Species_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Species_setId(s1, "s");
+
+ int i = Model_addSpecies(m, s);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumSpeciess(m) == 1);
+
+ i = Model_addSpecies(m, s1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumSpeciess(m) == 1);
+
+ Species_free(s);
+ Species_free(s1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addParameter1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -759,6 +983,34 @@
END_TEST
+START_TEST (test_Model_addParameter5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Parameter_t *p
+ = Parameter_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Parameter_setId(p, "p");
+ Parameter_t *p1
+ = Parameter_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Parameter_setId(p1, "p");
+
+ int i = Model_addParameter(m, p);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumParameters(m) == 1);
+
+ i = Model_addParameter(m, p1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumParameters(m) == 1);
+
+ Parameter_free(p);
+ Parameter_free(p1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addRule1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -825,6 +1077,34 @@
END_TEST
+START_TEST (test_Model_addRule5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Rule_t *ar
+ = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 2, 0);
+ Rule_setVariable(ar, "ar");
+ Rule_t *ar1
+ = Rule_createAssignmentWithLevelVersionAndNamespaces(2, 2, 0);
+ Rule_setVariable(ar1, "ar");
+
+ int i = Model_addRule(m, ar);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumRules(m) == 1);
+
+ i = Model_addRule(m, ar1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumRules(m) == 1);
+
+ Rule_free(ar);
+ Rule_free(ar1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_addReaction1)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -891,6 +1171,34 @@
END_TEST
+START_TEST (test_Model_addReaction5)
+{
+ Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Reaction_t *r
+ = Reaction_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Reaction_setId(r, "r");
+ Reaction_t *r1
+ = Reaction_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Reaction_setId(r1, "r");
+
+ int i = Model_addReaction(m, r);
+
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
+ fail_unless( Model_getNumReactions(m) == 1);
+
+ i = Model_addReaction(m, r1);
+
+ fail_unless( i == LIBSBML_DUPLICATE_OBJECT_ID);
+ fail_unless( Model_getNumReactions(m) == 1);
+
+ Reaction_free(r);
+ Reaction_free(r1);
+
+ Model_free(m);
+}
+END_TEST
+
+
START_TEST (test_Model_createFunctionDefinition)
{
Model_t *m = Model_createWithLevelVersionAndNamespaces(2, 2, 0);
@@ -1208,45 +1516,56 @@
tcase_add_test( tcase, test_Model_addFunctionDefinition1 );
tcase_add_test( tcase, test_Model_addFunctionDefinition2 );
tcase_add_test( tcase, test_Model_addFunctionDefinition3 );
+ tcase_add_test( tcase, test_Model_addFunctionDefinition4 );
tcase_add_test( tcase, test_Model_addCompartmentType1 );
tcase_add_test( tcase, test_Model_addCompartmentType2 );
tcase_add_test( tcase, test_Model_addCompartmentType3 );
+ tcase_add_test( tcase, test_Model_addCompartmentType4 );
tcase_add_test( tcase, test_Model_addSpeciesType1 );
tcase_add_test( tcase, test_Model_addSpeciesType2 );
tcase_add_test( tcase, test_Model_addSpeciesType3 );
+ tcase_add_test( tcase, test_Model_addSpeciesType4 );
tcase_add_test( tcase, test_Model_addInitialAssignment1 );
tcase_add_test( tcase, test_Model_addInitialAssignment2 );
tcase_add_test( tcase, test_Model_addInitialAssignment3 );
+ tcase_add_test( tcase, test_Model_addInitialAssignment4 );
tcase_add_test( tcase, test_Model_addConstraint1 );
tcase_add_test( tcase, test_Model_addConstraint2 );
tcase_add_test( tcase, test_Model_addConstraint3 );
tcase_add_test( tcase, test_Model_addEvent1 );
tcase_add_test( tcase, test_Model_addEvent2 );
tcase_add_test( tcase, test_Model_addEvent3 );
+ tcase_add_test( tcase, test_Model_addEvent4 );
tcase_add_test( tcase, test_Model_addUnitDefinition1 );
tcase_add_test( tcase, test_Model_addUnitDefinition2 );
tcase_add_test( tcase, test_Model_addUnitDefinition3 );
tcase_add_test( tcase, test_Model_addUnitDefinition4 );
+ tcase_add_test( tcase, test_Model_addUnitDefinition5 );
tcase_add_test( tcase, test_Model_addCompartment1 );
tcase_add_test( tcase, test_Model_addCompartment2 );
tcase_add_test( tcase, test_Model_addCompartment3 );
tcase_add_test( tcase, test_Model_addCompartment4 );
+ tcase_add_test( tcase, test_Model_addCompartment5 );
tcase_add_test( tcase, test_Model_addSpecies1 );
tcase_add_test( tcase, test_Model_addSpecies2 );
tcase_add_test( tcase, test_Model_addSpecies3 );
tcase_add_test( tcase, test_Model_addSpecies4 );
+ tcase_add_test( tcase, test_Model_addSpecies5 );
tcase_add_test( tcase, test_Model_addParameter1 );
tcase_add_test( tcase, test_Model_addParameter2 );
tcase_add_test( tcase, test_Model_addParameter3 );
tcase_add_test( tcase, test_Model_addParameter4 );
+ tcase_add_test( tcase, test_Model_addParameter5 );
tcase_add_test( tcase, test_Model_addRule1 );
tcase_add_test( tcase, test_Model_addRule2 );
tcase_add_test( tcase, test_Model_addRule3 );
tcase_add_test( tcase, test_Model_addRule4 );
+ tcase_add_test( tcase, test_Model_addRule5 );
tcase_add_test( tcase, test_Model_addReaction1 );
tcase_add_test( tcase, test_Model_addReaction2 );
tcase_add_test( tcase, test_Model_addReaction3 );
tcase_add_test( tcase, test_Model_addReaction4 );
+ tcase_add_test( tcase, test_Model_addReaction5 );
tcase_add_test( tcase, test_Model_createFunctionDefinition );
tcase_add_test( tcase, test_Model_createUnitDefinition );
tcase_add_test( tcase, test_Model_createCompartmentType );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 19:15:02
|
Revision: 9124
http://sbml.svn.sourceforge.net/sbml/?rev=9124&view=rev
Author: sarahkeating
Date: 2009-02-25 19:14:56 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
changed all the operationReturnValues relating to an invalid object to use only one value LIBSBML_INVALID_OBJECT
Modified Paths:
--------------
branches/libsbml-4/src/annotation/ModelHistory.cpp
branches/libsbml-4/src/annotation/ModelHistory.h
branches/libsbml-4/src/annotation/test/TestCVTerms_newSetters.c
branches/libsbml-4/src/annotation/test/TestDate_newSetters.c
branches/libsbml-4/src/annotation/test/TestModelCreator_newSetters.c
branches/libsbml-4/src/annotation/test/TestModelHistory_newSetters.c
branches/libsbml-4/src/common/operationReturnValues.h
branches/libsbml-4/src/math/test/TestASTNode.c
branches/libsbml-4/src/math/test/TestValidASTNode.cpp
branches/libsbml-4/src/sbml/Constraint.cpp
branches/libsbml-4/src/sbml/Constraint.h
branches/libsbml-4/src/sbml/Delay.cpp
branches/libsbml-4/src/sbml/Delay.h
branches/libsbml-4/src/sbml/Event.cpp
branches/libsbml-4/src/sbml/EventAssignment.cpp
branches/libsbml-4/src/sbml/EventAssignment.h
branches/libsbml-4/src/sbml/FunctionDefinition.cpp
branches/libsbml-4/src/sbml/FunctionDefinition.h
branches/libsbml-4/src/sbml/InitialAssignment.cpp
branches/libsbml-4/src/sbml/InitialAssignment.h
branches/libsbml-4/src/sbml/KineticLaw.cpp
branches/libsbml-4/src/sbml/KineticLaw.h
branches/libsbml-4/src/sbml/Model.cpp
branches/libsbml-4/src/sbml/Model.h
branches/libsbml-4/src/sbml/Rule.cpp
branches/libsbml-4/src/sbml/Rule.h
branches/libsbml-4/src/sbml/SBase.cpp
branches/libsbml-4/src/sbml/SBase.h
branches/libsbml-4/src/sbml/StoichiometryMath.cpp
branches/libsbml-4/src/sbml/StoichiometryMath.h
branches/libsbml-4/src/sbml/Trigger.cpp
branches/libsbml-4/src/sbml/Trigger.h
branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c
branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c
branches/libsbml-4/src/sbml/test/TestConstraint_newSetters.c
branches/libsbml-4/src/sbml/test/TestDelay.c
branches/libsbml-4/src/sbml/test/TestEventAssignment_newSetters.c
branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
branches/libsbml-4/src/sbml/test/TestFunctionDefinition_newSetters.c
branches/libsbml-4/src/sbml/test/TestInitialAssignment_newSetters.c
branches/libsbml-4/src/sbml/test/TestKineticLaw_newSetters.c
branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
branches/libsbml-4/src/sbml/test/TestParameter_newSetters.c
branches/libsbml-4/src/sbml/test/TestReaction_newSetters.c
branches/libsbml-4/src/sbml/test/TestRule_newSetters.c
branches/libsbml-4/src/sbml/test/TestSBMLDocument.c
branches/libsbml-4/src/sbml/test/TestSBase_newSetters.cpp
branches/libsbml-4/src/sbml/test/TestSpeciesReference_newSetters.c
branches/libsbml-4/src/sbml/test/TestSpeciesType_newSetters.c
branches/libsbml-4/src/sbml/test/TestSpecies_newSetters.c
branches/libsbml-4/src/sbml/test/TestStoichiometryMath.c
branches/libsbml-4/src/sbml/test/TestTrigger.c
branches/libsbml-4/src/sbml/test/TestUnitDefinition_newSetters.c
branches/libsbml-4/src/sbml/test/TestUnit_newSetters.c
branches/libsbml-4/src/sbml/test/TestWriteSBML.cpp
branches/libsbml-4/src/xml/test/TestXMLAttributesC.c
branches/libsbml-4/src/xml/test/TestXMLError.cpp
branches/libsbml-4/src/xml/test/TestXMLInputStream.c
branches/libsbml-4/src/xml/test/TestXMLNamespaces.c
branches/libsbml-4/src/xml/test/TestXMLNode_newSetters.c
branches/libsbml-4/src/xml/test/TestXMLToken_newSetters.c
Modified: branches/libsbml-4/src/annotation/ModelHistory.cpp
===================================================================
--- branches/libsbml-4/src/annotation/ModelHistory.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/ModelHistory.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -1017,7 +1017,7 @@
}
else if (!creator->isValidModelCreator())
{
- return LIBSBML_INVALID_MODEL_CREATOR;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -1045,7 +1045,7 @@
}
else if (!date->isValidDate())
{
- return LIBSBML_INVALID_DATE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -1079,7 +1079,7 @@
}
else if (!date->isValidDate())
{
- return LIBSBML_INVALID_DATE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -2186,7 +2186,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_DATE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int ModelHistory_setCreatedDate(ModelHistory_t * mh,
@@ -2209,7 +2209,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_DATE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
@@ -2233,7 +2233,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_MODEL_CREATOR<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
Modified: branches/libsbml-4/src/annotation/ModelHistory.h
===================================================================
--- branches/libsbml-4/src/annotation/ModelHistory.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/ModelHistory.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -741,7 +741,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_DATE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setCreatedDate(Date* date);
@@ -757,7 +757,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_DATE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setModifiedDate(Date* date);
@@ -808,7 +808,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_MODEL_CREATOR<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*/
int addCreator(ModelCreator * mc);
Modified: branches/libsbml-4/src/annotation/test/TestCVTerms_newSetters.c
===================================================================
--- branches/libsbml-4/src/annotation/test/TestCVTerms_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/test/TestCVTerms_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -39,21 +39,21 @@
int i = CVTerm_setModelQualifierType(term, BQM_IS);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless(CVTerm_getQualifierType(term) == MODEL_QUALIFIER);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_IS);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_UNKNOWN);
i = CVTerm_setQualifierType(term, BIOLOGICAL_QUALIFIER);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless(CVTerm_getQualifierType(term) == BIOLOGICAL_QUALIFIER);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_UNKNOWN);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_UNKNOWN);
i = CVTerm_setModelQualifierType(term, BQM_IS);
- fail_unless ( i == -4);
+ fail_unless ( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
fail_unless(CVTerm_getQualifierType(term) == BIOLOGICAL_QUALIFIER);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_UNKNOWN);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_UNKNOWN);
@@ -74,21 +74,21 @@
int i = CVTerm_setBiologicalQualifierType(term, BQB_IS);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless(CVTerm_getQualifierType(term) == BIOLOGICAL_QUALIFIER);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_IS);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_UNKNOWN);
i = CVTerm_setQualifierType(term, MODEL_QUALIFIER);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless(CVTerm_getQualifierType(term) == MODEL_QUALIFIER);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_UNKNOWN);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_UNKNOWN);
i = CVTerm_setBiologicalQualifierType(term, BQB_IS);
- fail_unless ( i == -4);
+ fail_unless ( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
fail_unless(CVTerm_getQualifierType(term) == MODEL_QUALIFIER);
fail_unless(CVTerm_getModelQualifierType(term) == BQM_UNKNOWN);
fail_unless(CVTerm_getBiologicalQualifierType(term) == BQB_UNKNOWN);
@@ -109,7 +109,7 @@
int i = CVTerm_addResource(term, "");
- fail_unless ( i == -3);
+ fail_unless ( i == LIBSBML_OPERATION_FAILED);
xa = CVTerm_getResources(term);
@@ -117,7 +117,7 @@
i = CVTerm_addResource(term, resource);
- fail_unless ( i == 0);
+ fail_unless ( i == LIBSBML_OPERATION_SUCCESS);
xa = CVTerm_getResources(term);
@@ -146,7 +146,7 @@
int i = CVTerm_removeResource(term, "CCC");
- fail_unless ( i == -4);
+ fail_unless ( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
xa = CVTerm_getResources(term);
@@ -154,7 +154,7 @@
i = CVTerm_removeResource(term, resource);
- fail_unless ( i == 0);
+ fail_unless ( i == LIBSBML_OPERATION_SUCCESS);
xa = CVTerm_getResources(term);
Modified: branches/libsbml-4/src/annotation/test/TestDate_newSetters.c
===================================================================
--- branches/libsbml-4/src/annotation/test/TestDate_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/test/TestDate_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -37,17 +37,17 @@
int i = Date_setYear(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getYear(date) == 2000);
i = Date_setYear(date, 12121);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getYear(date) == 2000);
i = Date_setYear(date, 2008);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getYear(date) == 2008);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -65,17 +65,17 @@
int i = Date_setMonth(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMonth(date) == 1);
i = Date_setMonth(date, 12121);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMonth(date) == 1);
i = Date_setMonth(date, 11);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getMonth(date) == 11);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -93,17 +93,17 @@
int i = Date_setDay(date, 29);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getDay(date) == 1);
i = Date_setDay(date, 31);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getDay(date) == 1);
i = Date_setDay(date, 15);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getDay(date) == 15);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -121,17 +121,17 @@
int i = Date_setHour(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getHour(date) == 0);
i = Date_setHour(date, 12121);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getHour(date) == 0);
i = Date_setHour(date, 9);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getHour(date) == 9);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -149,17 +149,17 @@
int i = Date_setMinute(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMinute(date) == 0);
i = Date_setMinute(date, 12121);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMinute(date) == 0);
i = Date_setMinute(date, 32);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getMinute(date) == 32);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -177,17 +177,17 @@
int i = Date_setSecond(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getSecond(date) == 0);
i = Date_setSecond(date, 12121);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getSecond(date) == 0);
i = Date_setSecond(date, 32);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getSecond(date) == 32);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -205,17 +205,17 @@
int i = Date_setSignOffset(date, 2);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getSignOffset(date) == 0);
i = Date_setSignOffset(date, -4);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getSignOffset(date) == 0);
i = Date_setSignOffset(date, 0);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getSignOffset(date) == 0);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -233,17 +233,17 @@
int i = Date_setHoursOffset(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getHoursOffset(date) == 0);
i = Date_setHoursOffset(date, -3);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getHoursOffset(date) == 0);
i = Date_setHoursOffset(date, 11);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getHoursOffset(date) == 11);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -261,17 +261,17 @@
int i = Date_setMinutesOffset(date, 434);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMinutesOffset(date) == 0);
i = Date_setMinutesOffset(date, 60);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Date_getMinutesOffset(date) == 0);
i = Date_setMinutesOffset(date, 45);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getMinutesOffset(date) == 45);
fail_unless(!strcmp(Date_getDateAsString(date),
@@ -289,25 +289,25 @@
int i = Date_setDateAsString(date, "20081-12-30T12:15:45+02:00");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless(!strcmp(Date_getDateAsString(date),
"2007-10-23T14:15:16+03:00"));
i = Date_setDateAsString(date, "200-12-30T12:15:45+02:00");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless(!strcmp(Date_getDateAsString(date),
"2007-10-23T14:15:16+03:00"));
i = Date_setDateAsString(date, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(!strcmp(Date_getDateAsString(date),
"2000-01-01T00:00:00Z"));
i = Date_setDateAsString(date, "2008-12-30T12:15:45+02:00");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Date_getYear(date) == 2008);
fail_unless( Date_getMonth(date) == 12);
fail_unless( Date_getDay(date) == 30);
Modified: branches/libsbml-4/src/annotation/test/TestModelCreator_newSetters.c
===================================================================
--- branches/libsbml-4/src/annotation/test/TestModelCreator_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/test/TestModelCreator_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -36,13 +36,13 @@
int i = ModelCreator_setFamilyName(mc, "Keating");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetFamilyName(mc) == 1);
fail_unless(!strcmp(ModelCreator_getFamilyName(mc), "Keating"));
i = ModelCreator_setFamilyName(mc, "");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetFamilyName(mc) == 0);
i = ModelCreator_setFamilyName(mc, "Keating");
@@ -51,7 +51,7 @@
i = ModelCreator_unsetFamilyName(mc);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetFamilyName(mc) == 0);
ModelCreator_free(mc);
@@ -66,13 +66,13 @@
int i = ModelCreator_setGivenName(mc, "Sarah");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetGivenName(mc) == 1);
fail_unless(!strcmp(ModelCreator_getGivenName(mc), "Sarah"));
i = ModelCreator_setGivenName(mc, "");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetGivenName(mc) == 0);
i = ModelCreator_setGivenName(mc, "Sarah");
@@ -81,7 +81,7 @@
i = ModelCreator_unsetGivenName(mc);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetGivenName(mc) == 0);
ModelCreator_free(mc);
@@ -96,13 +96,13 @@
int i = ModelCreator_setEmail(mc, "Keating");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetEmail(mc) == 1);
fail_unless(!strcmp(ModelCreator_getEmail(mc), "Keating"));
i = ModelCreator_setEmail(mc, "");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetEmail(mc) == 0);
i = ModelCreator_setEmail(mc, "Keating");
@@ -111,7 +111,7 @@
i = ModelCreator_unsetEmail(mc);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetEmail(mc) == 0);
ModelCreator_free(mc);
@@ -126,13 +126,13 @@
int i = ModelCreator_setOrganization(mc, "Caltech");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetOrganization(mc) == 1);
fail_unless(!strcmp(ModelCreator_getOrganization(mc), "Caltech"));
i = ModelCreator_setOrganization(mc, "");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetOrganization(mc) == 0);
i = ModelCreator_setOrganization(mc, "Caltech");
@@ -141,7 +141,7 @@
i = ModelCreator_unsetOrganization(mc);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelCreator_isSetOrganization(mc) == 0);
ModelCreator_free(mc);
Modified: branches/libsbml-4/src/annotation/test/TestModelHistory_newSetters.c
===================================================================
--- branches/libsbml-4/src/annotation/test/TestModelHistory_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/annotation/test/TestModelHistory_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -38,7 +38,7 @@
int i = ModelHistory_setCreatedDate(mh, date);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelHistory_isSetCreatedDate(mh) == 1);
fail_unless(date != ModelHistory_getCreatedDate(mh));
@@ -49,7 +49,7 @@
i = ModelHistory_setCreatedDate(mh, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelHistory_isSetCreatedDate(mh) == 0);
Date_free(date);
@@ -67,7 +67,7 @@
int i = ModelHistory_setCreatedDate(mh, date);
- fail_unless( i == -10 );
+ fail_unless( i == LIBSBML_INVALID_OBJECT );
fail_unless(ModelHistory_isSetCreatedDate(mh) == 0);
Date_free(date);
@@ -85,7 +85,7 @@
int i = ModelHistory_setModifiedDate(mh, date);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelHistory_isSetModifiedDate(mh) == 1);
fail_unless(date != ModelHistory_getModifiedDate(mh));
@@ -96,7 +96,7 @@
i = ModelHistory_setModifiedDate(mh, NULL);
- fail_unless( i == -3 );
+ fail_unless( i == LIBSBML_OPERATION_FAILED );
fail_unless(ModelHistory_isSetModifiedDate(mh) == 1);
Date_free(date);
@@ -114,7 +114,7 @@
int i = ModelHistory_setModifiedDate(mh, date);
- fail_unless( i == -10 );
+ fail_unless( i == LIBSBML_INVALID_OBJECT );
fail_unless(ModelHistory_isSetModifiedDate(mh) == 0);
Date_free(date);
@@ -132,7 +132,7 @@
int i = ModelHistory_addCreator(mh, mc);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless(ModelHistory_getNumCreators(mh) == 1);
ModelCreator_free(mc);
@@ -149,7 +149,7 @@
int i = ModelHistory_addCreator(mh, mc);
- fail_unless( i == -11 );
+ fail_unless( i == LIBSBML_INVALID_OBJECT );
fail_unless(ModelHistory_getNumCreators(mh) == 0);
ModelCreator_free(mc);
@@ -165,7 +165,7 @@
int i = ModelHistory_addCreator(mh, mc);
- fail_unless( i == -3 );
+ fail_unless( i == LIBSBML_OPERATION_FAILED );
fail_unless(ModelHistory_getNumCreators(mh) == 0);
ModelHistory_free(mh);
Modified: branches/libsbml-4/src/common/operationReturnValues.h
===================================================================
--- branches/libsbml-4/src/common/operationReturnValues.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/common/operationReturnValues.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -32,15 +32,11 @@
, LIBSBML_UNEXPECTED_ATTRIBUTE = -2
, LIBSBML_OPERATION_FAILED = -3
, LIBSBML_INVALID_ATTRIBUTE_VALUE = -4
- , LIBSBML_INVALID_XHTML = -5
- , LIBSBML_INVALID_AST_NODE = -6
+ , LIBSBML_INVALID_OBJECT = -5
+ , LIBSBML_DUPLICATE_OBJECT_ID = -6
, LIBSBML_LEVEL_MISMATCH = -7
, LIBSBML_VERSION_MISMATCH = -8
- , LIBSBML_INVALID_MODEL_HISTORY = -9
- , LIBSBML_INVALID_DATE = -10
- , LIBSBML_INVALID_MODEL_CREATOR = -11
- , LIBSBML_INVALID_XML_OPERATION = -12
- , LIBSBML_INVALID_CV_TERM = -13
+ , LIBSBML_INVALID_XML_OPERATION = -9
} OperationReturnValues_t;
Modified: branches/libsbml-4/src/math/test/TestASTNode.c
===================================================================
--- branches/libsbml-4/src/math/test/TestASTNode.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/math/test/TestASTNode.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -1811,17 +1811,17 @@
i = ASTNode_removeChild(node, 0);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 1);
i = ASTNode_removeChild(node, 1);
- fail_unless( i == -1);
+ fail_unless( i == LIBSBML_INDEX_EXCEEDS_SIZE);
fail_unless( ASTNode_getNumChildren(node) == 1);
i = ASTNode_removeChild(node, 0);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 0);
ASTNode_free(node);
@@ -1853,19 +1853,19 @@
i = ASTNode_replaceChild(node, 0, newc);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 3);
fail_unless( !strcmp(SBML_formulaToString(node), "and(d, b, c)"));
i = ASTNode_replaceChild(node, 3, newc);
- fail_unless( i == -1);
+ fail_unless( i == LIBSBML_INDEX_EXCEEDS_SIZE);
fail_unless( ASTNode_getNumChildren(node) == 3);
fail_unless( !strcmp(SBML_formulaToString(node), "and(d, b, c)"));
i = ASTNode_replaceChild(node, 1, c1);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 3);
fail_unless( !strcmp(SBML_formulaToString(node), "and(d, a, c)"));
@@ -1900,19 +1900,19 @@
i = ASTNode_insertChild(node, 1, newc);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 4);
fail_unless( !strcmp(SBML_formulaToString(node), "and(a, d, b, c)"));
i = ASTNode_insertChild(node, 5, newc);
- fail_unless( i == -1);
+ fail_unless( i == LIBSBML_INDEX_EXCEEDS_SIZE);
fail_unless( ASTNode_getNumChildren(node) == 4);
fail_unless( !strcmp(SBML_formulaToString(node), "and(a, d, b, c)"));
i = ASTNode_insertChild(node, 2, newc1);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 5);
fail_unless( !strcmp(SBML_formulaToString(node), "and(a, d, e, b, c)"));
@@ -1951,7 +1951,7 @@
i = ASTNode_swapChildren(node, node_1);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 2);
fail_unless( !strcmp(SBML_formulaToString(node), "and(d, f)"));
fail_unless( ASTNode_getNumChildren(node_1) == 2);
@@ -1984,7 +1984,7 @@
i = ASTNode_addChild(node, c1_1);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 3);
fail_unless( !strcmp(SBML_formulaToString(node), "and(a, b, d)"));
fail_unless( !strcmp(ASTNode_getName(ASTNode_getChild(node, 0)), "a") );
@@ -2017,7 +2017,7 @@
i = ASTNode_prependChild(node, c1_1);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumChildren(node) == 3);
fail_unless( !strcmp(SBML_formulaToString(node), "and(d, a, b)"));
fail_unless( !strcmp(ASTNode_getName(ASTNode_getChild(node, 0)), "d") );
@@ -2036,25 +2036,25 @@
i = ASTNode_setName(node, "a");
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( !strcmp(SBML_formulaToString(node), "a"));
fail_unless( !strcmp(ASTNode_getName(node), "a") );
i = ASTNode_freeName(node);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getName(node) == NULL );
i = ASTNode_freeName(node);
- fail_unless(i == -2);
+ fail_unless(i == LIBSBML_UNEXPECTED_ATTRIBUTE);
fail_unless( ASTNode_getName(node) == NULL );
ASTNode_setType(node, AST_UNKNOWN);
i = ASTNode_freeName(node);
- fail_unless(i == -2);
+ fail_unless(i == LIBSBML_UNEXPECTED_ATTRIBUTE);
fail_unless( ASTNode_getName(node) == NULL );
ASTNode_free(node);
@@ -2070,12 +2070,12 @@
i = ASTNode_addSemanticsAnnotation(node, ann);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( ASTNode_getNumSemanticsAnnotations(node) == 1);
i = ASTNode_addSemanticsAnnotation(node, NULL);
- fail_unless(i == -3);
+ fail_unless(i == LIBSBML_OPERATION_FAILED);
fail_unless( ASTNode_getNumSemanticsAnnotations(node) == 1);
ASTNode_free(node);
Modified: branches/libsbml-4/src/math/test/TestValidASTNode.cpp
===================================================================
--- branches/libsbml-4/src/math/test/TestValidASTNode.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/math/test/TestValidASTNode.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -200,12 +200,12 @@
int i = N->setType(AST_REAL);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( N->getType() == AST_REAL);
i = N->setType(AST_PLUS);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( N->getType() == AST_PLUS);
char c = N->getCharacter();
char s[2];
@@ -214,12 +214,12 @@
i = N->setType(AST_FUNCTION_ARCCOSH);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( N->getType() == AST_FUNCTION_ARCCOSH);
i = N->setType(AST_UNKNOWN);
- fail_unless( i == -4);
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE);
fail_unless( N->getType() == AST_UNKNOWN);
delete N;
Modified: branches/libsbml-4/src/sbml/Constraint.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Constraint.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Constraint.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -201,7 +201,7 @@
}
else if (!SBase::hasCorrectXHTMLSyntax(xhtml))
{
- return LIBSBML_INVALID_XHTML;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -231,7 +231,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -759,7 +759,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
@@ -783,7 +783,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/Constraint.h
===================================================================
--- branches/libsbml-4/src/sbml/Constraint.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Constraint.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -305,7 +305,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMessage (const XMLNode* xhtml);
@@ -325,7 +325,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/Delay.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Delay.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Delay.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -161,7 +161,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -590,7 +590,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/Delay.h
===================================================================
--- branches/libsbml-4/src/sbml/Delay.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Delay.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -242,7 +242,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/Event.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Event.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Event.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -441,6 +441,11 @@
{
return LIBSBML_VERSION_MISMATCH;
}
+ else if (getEventAssignment(ea->getVariable()) != NULL)
+ {
+ // an eventAssignment for this variable already exists
+ return LIBSBML_DUPLICATE_OBJECT_ID;
+ }
else
{
/* if the ListOf is empty it doesnt know its parent */
Modified: branches/libsbml-4/src/sbml/EventAssignment.cpp
===================================================================
--- branches/libsbml-4/src/sbml/EventAssignment.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/EventAssignment.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -193,7 +193,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -801,7 +801,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/EventAssignment.h
===================================================================
--- branches/libsbml-4/src/sbml/EventAssignment.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/EventAssignment.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -329,7 +329,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/FunctionDefinition.cpp
===================================================================
--- branches/libsbml-4/src/sbml/FunctionDefinition.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/FunctionDefinition.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -163,7 +163,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -865,7 +865,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/FunctionDefinition.h
===================================================================
--- branches/libsbml-4/src/sbml/FunctionDefinition.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/FunctionDefinition.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -258,7 +258,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/InitialAssignment.cpp
===================================================================
--- branches/libsbml-4/src/sbml/InitialAssignment.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/InitialAssignment.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -193,7 +193,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -788,7 +788,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/InitialAssignment.h
===================================================================
--- branches/libsbml-4/src/sbml/InitialAssignment.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/InitialAssignment.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -369,7 +369,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/KineticLaw.cpp
===================================================================
--- branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/KineticLaw.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -263,7 +263,7 @@
}
else if (math == NULL || !(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -298,7 +298,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -1244,7 +1244,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @note SBML Level 1 uses a text-string format for mathematical formulas.
* SBML Level 2 uses MathML, an XML format for representing mathematical
@@ -1282,7 +1282,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/KineticLaw.h
===================================================================
--- branches/libsbml-4/src/sbml/KineticLaw.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/KineticLaw.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -360,7 +360,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @note SBML Level 1 uses a text-string format for mathematical
* formulas. SBML Level 2 uses MathML, an XML format for representing
@@ -393,7 +393,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/Model.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Model.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Model.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -253,7 +253,7 @@
}
else if (!(history->isValidModelHistory()))
{
- return LIBSBML_INVALID_MODEL_HISTORY;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -3852,7 +3852,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_MODEL_HISTORY<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/Model.h
===================================================================
--- branches/libsbml-4/src/sbml/Model.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Model.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -325,7 +325,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_MODEL_HISTORY<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setModelHistory(ModelHistory * history);
Modified: branches/libsbml-4/src/sbml/Rule.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Rule.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Rule.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -271,7 +271,7 @@
}
else if (math == NULL || !(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -306,7 +306,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -1665,7 +1665,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @note SBML Level 1 uses a text-string format for mathematical formulas.
* SBML Level 2 uses MathML, an XML format for representing mathematical
@@ -1694,7 +1694,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/Rule.h
===================================================================
--- branches/libsbml-4/src/sbml/Rule.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Rule.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -592,7 +592,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setFormula (const std::string& formula);
@@ -609,7 +609,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/SBase.cpp
===================================================================
--- branches/libsbml-4/src/sbml/SBase.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/SBase.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -687,7 +687,7 @@
}
//else if (!(math->isValidASTNode()))
//{
- // return LIBSBML_INVALID_AST_NODE;
+ // return LIBSBML_INVALID_OBJECT;
//}
else if (mAnnotation != annotation)
{
@@ -912,7 +912,7 @@
{
delete mNotes;
mNotes = 0;
- return LIBSBML_INVALID_XHTML;
+ return LIBSBML_INVALID_OBJECT;
}
}
@@ -988,12 +988,12 @@
}
if (!SBase::hasCorrectXHTMLSyntax(&(tempNotes)))
{
- return LIBSBML_INVALID_XHTML;
+ return LIBSBML_INVALID_OBJECT;
}
}
else if (!SBase::hasCorrectXHTMLSyntax(notes))
{
- return LIBSBML_INVALID_XHTML;
+ return LIBSBML_INVALID_OBJECT;
}
}
@@ -1501,7 +1501,7 @@
}
else if (!term->isValidCVTerm())
{
- return LIBSBML_INVALID_CV_TERM;
+ return LIBSBML_INVALID_OBJECT;
}
/* clone the term to be added so that I can adjust
@@ -4694,7 +4694,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_OPERATION_FAILED<br>
* LIBSBML_UNEXPECTED_ATTRIBUTE<br>
- * LIBSBML_INVALID_CV_TERM<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @note The annotation constructed from a CVTerm uses the metaid
* of the object to identify it. Adding a CVTerm to an object
@@ -5324,7 +5324,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
@@ -5346,7 +5346,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -5376,7 +5376,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
@@ -5399,7 +5399,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*/
LIBSBML_EXTERN
Modified: branches/libsbml-4/src/sbml/SBase.h
===================================================================
--- branches/libsbml-4/src/sbml/SBase.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/SBase.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -896,7 +896,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @see appendNotes()
*/
@@ -920,7 +920,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @see appendNotes()
@@ -943,7 +943,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @see setNotes()
@@ -966,7 +966,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_XHTML<br>
+ * LIBSBML_INVALID_OBJECT<br>
* LIBSBML_OPERATION_FAILED<br>
*
* @see setNotes()
@@ -1145,7 +1145,7 @@
* LIBSBML_OPERATION_SUCCESS<br>
* LIBSBML_OPERATION_FAILED<br>
* LIBSBML_UNEXPECTED_ATTRIBUTE<br>
- * LIBSBML_INVALID_CV_TERM<br>
+ * LIBSBML_INVALID_OBJECT<br>
*
* @note Since the CV Term uses the metaid of the object as a
* reference, if the object has no metaid set the CVTerm will
Modified: branches/libsbml-4/src/sbml/StoichiometryMath.cpp
===================================================================
--- branches/libsbml-4/src/sbml/StoichiometryMath.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/StoichiometryMath.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -161,7 +161,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -568,7 +568,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/StoichiometryMath.h
===================================================================
--- branches/libsbml-4/src/sbml/StoichiometryMath.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/StoichiometryMath.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -250,7 +250,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/Trigger.cpp
===================================================================
--- branches/libsbml-4/src/sbml/Trigger.cpp 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Trigger.cpp 2009-02-25 19:14:56 UTC (rev 9124)
@@ -161,7 +161,7 @@
}
else if (!(math->isValidASTNode()))
{
- return LIBSBML_INVALID_AST_NODE;
+ return LIBSBML_INVALID_OBJECT;
}
else
{
@@ -514,7 +514,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
LIBSBML_EXTERN
int
Modified: branches/libsbml-4/src/sbml/Trigger.h
===================================================================
--- branches/libsbml-4/src/sbml/Trigger.h 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/Trigger.h 2009-02-25 19:14:56 UTC (rev 9124)
@@ -178,7 +178,7 @@
* returned by this function are:
*
* LIBSBML_OPERATION_SUCCESS<br>
- * LIBSBML_INVALID_AST_NODE<br>
+ * LIBSBML_INVALID_OBJECT<br>
*/
int setMath (const ASTNode* math);
Modified: branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -58,7 +58,7 @@
{
int i = CompartmentType_setId(C, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !CompartmentType_isSetId(C) );
}
END_TEST
@@ -68,7 +68,7 @@
{
int i = CompartmentType_setId(C, "cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( CompartmentType_isSetId(C) );
fail_unless( !strcmp(CompartmentType_getId(C), "cell" ));
}
@@ -79,7 +79,7 @@
{
int i = CompartmentType_setId(C, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !CompartmentType_isSetId(C) );
}
END_TEST
@@ -89,12 +89,12 @@
{
int i = CompartmentType_setName(C, "cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( CompartmentType_isSetName(C) );
i = CompartmentType_unsetName(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !CompartmentType_isSetName(C) );
}
END_TEST
@@ -104,12 +104,12 @@
{
int i = CompartmentType_setName(C, "1cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( CompartmentType_isSetName(C) );
i = CompartmentType_unsetName(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !CompartmentType_isSetName(C) );
}
END_TEST
@@ -119,7 +119,7 @@
{
int i = CompartmentType_setName(C, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !CompartmentType_isSetName(C) );
}
END_TEST
Modified: branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -58,12 +58,12 @@
{
int i = Compartment_setCompartmentType(C, "cell");
- fail_unless( i == -2 );
+ fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
fail_unless( !Compartment_isSetCompartmentType(C) );
i = Compartment_unsetCompartmentType(C);
- fail_unless( i == -2 );
+ fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
fail_unless( !Compartment_isSetCompartmentType(C) );
}
END_TEST
@@ -76,12 +76,12 @@
int i = Compartment_setCompartmentType(c, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !Compartment_isSetCompartmentType(c) );
i = Compartment_unsetCompartmentType(c);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetCompartmentType(c) );
Compartment_free(c);
@@ -96,13 +96,13 @@
int i = Compartment_setCompartmentType(c, "cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_isSetCompartmentType(c) );
fail_unless( !strcmp(Compartment_getCompartmentType(c), "cell" ));
i = Compartment_unsetCompartmentType(c);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetCompartmentType(c) );
Compartment_free(c);
@@ -117,7 +117,7 @@
int i = Compartment_setCompartmentType(c, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetCompartmentType(c) );
Compartment_free(c);
@@ -132,7 +132,7 @@
{
int i = Compartment_setId(C, "cell");
- fail_unless( i == -2 );
+ fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
fail_unless( !Compartment_isSetId(C) );
}
END_TEST
@@ -145,7 +145,7 @@
int i = Compartment_setId(c, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !Compartment_isSetId(c) );
Compartment_free(c);
@@ -160,7 +160,7 @@
int i = Compartment_setId(c, "cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_isSetId(c) );
fail_unless( !strcmp(Compartment_getId(c), "cell" ));
@@ -176,7 +176,7 @@
int i = Compartment_setId(c, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetId(c) );
Compartment_free(c);
@@ -188,12 +188,12 @@
{
int i = Compartment_setName(C, "cell");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_isSetName(C) );
i = Compartment_unsetName(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetName(C) );
}
END_TEST
@@ -206,12 +206,12 @@
int i = Compartment_setName(c, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !Compartment_isSetName(c) );
i = Compartment_unsetName(c);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetName(c) );
Compartment_free(c);
@@ -223,7 +223,7 @@
{
int i = Compartment_setName(C, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetName(C) );
}
END_TEST
@@ -233,7 +233,7 @@
{
int i = Compartment_setSpatialDimensions(C, 2);
- fail_unless( i == -2 );
+ fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
fail_unless( Compartment_getSpatialDimensions(C) == 3 );
}
@@ -247,7 +247,7 @@
int i = Compartment_setSpatialDimensions(c, 4);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( Compartment_getSpatialDimensions(c) == 3 );
Compartment_free(c);
@@ -262,7 +262,7 @@
int i = Compartment_setSpatialDimensions(c, 2);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getSpatialDimensions(c) == 2 );
Compartment_free(c);
@@ -274,12 +274,12 @@
{
int i = Compartment_setSize(C, 2.0);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getSize(C) == 2.0 );
i = Compartment_unsetSize(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
}
END_TEST
@@ -291,13 +291,13 @@
int i = Compartment_setSize(c, 4);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getSize(c) == 4 );
fail_unless( Compartment_isSetSize(c));
i = Compartment_unsetSize(c);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetSize(c));
Compartment_free(c);
@@ -309,13 +309,13 @@
{
int i = Compartment_setVolume(C, 2.0);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getVolume(C) == 2.0 );
fail_unless( Compartment_isSetVolume(C));
i = Compartment_unsetVolume(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getVolume(C) == 1.0 );
fail_unless( Compartment_isSetVolume(C));
@@ -330,13 +330,13 @@
int i = Compartment_setVolume(c, 4);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getVolume(c) == 4.0 );
fail_unless( Compartment_isSetVolume(c));
i = Compartment_unsetVolume(c);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetVolume(c));
Compartment_free(c);
@@ -348,12 +348,12 @@
{
int i = Compartment_setUnits(C, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !Compartment_isSetUnits(C) );
i = Compartment_unsetUnits(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetUnits(C) );
}
END_TEST
@@ -363,12 +363,12 @@
{
int i = Compartment_setUnits(C, "litre");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_isSetUnits(C) );
i = Compartment_unsetUnits(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetUnits(C) );
}
END_TEST
@@ -378,7 +378,7 @@
{
int i = Compartment_setUnits(C, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetUnits(C) );
}
END_TEST
@@ -388,12 +388,12 @@
{
int i = Compartment_setOutside(C, "1cell");
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !Compartment_isSetOutside(C) );
i = Compartment_unsetOutside(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetOutside(C) );
}
END_TEST
@@ -403,12 +403,12 @@
{
int i = Compartment_setOutside(C, "litre");
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_isSetOutside(C) );
i = Compartment_unsetOutside(C);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetOutside(C) );
}
END_TEST
@@ -418,7 +418,7 @@
{
int i = Compartment_setOutside(C, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !Compartment_isSetOutside(C) );
}
END_TEST
@@ -428,7 +428,7 @@
{
int i = Compartment_setConstant(C, 0);
- fail_unless( i == -2 );
+ fail_unless( i == LIBSBML_UNEXPECTED_ATTRIBUTE );
fail_unless( Compartment_getConstant(C) == 0 );
}
END_TEST
@@ -441,7 +441,7 @@
int i = Compartment_setConstant(c, 0);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( Compartment_getConstant(c) == 0 );
Compartment_free(c);
Modified: branches/libsbml-4/src/sbml/test/TestConstraint_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestConstraint_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/test/TestConstraint_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -64,13 +64,13 @@
int i = Constraint_setMath(C, math);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( Constraint_getMath(C) != math );
fail_unless( Constraint_isSetMath(C) );
i = Constraint_setMath(C, NULL);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( Constraint_getMath(C) == NULL );
fail_unless( !Constraint_isSetMath(C) );
@@ -85,7 +85,7 @@
int i = Constraint_setMath(C, math);
- fail_unless( i == -6);
+ fail_unless( i == LIBSBML_INVALID_OBJECT);
fail_unless( !Constraint_isSetMath(C) );
ASTNode_free(math);
@@ -99,12 +99,12 @@
int i = Constraint_setMessage(C, node);
- fail_unless(i == -5);
+ fail_unless(i == LIBSBML_INVALID_OBJECT);
fail_unless( Constraint_isSetMessage(C) == 0);
i = Constraint_unsetMessage(C);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( !Constraint_isSetMessage(C) );
if (Constraint_getMessage(C) != NULL)
@@ -141,7 +141,7 @@
int i = Constraint_setMessage(C, node);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( Constraint_isSetMessage(C) == 1);
/* FIX ME
printf("Expected: %s\n", expected);
@@ -151,7 +151,7 @@
*/
i = Constraint_unsetMessage(C);
- fail_unless(i == 0);
+ fail_unless(i == LIBSBML_OPERATION_SUCCESS);
fail_unless( !Constraint_isSetMessage(C) );
if (Constraint_getMessage(C) != NULL)
Modified: branches/libsbml-4/src/sbml/test/TestDelay.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestDelay.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/test/TestDelay.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -175,13 +175,13 @@
int i = Delay_setMath(D, math);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( Delay_getMath(D) != math );
fail_unless( Delay_isSetMath(D) );
i = Delay_setMath(D, NULL);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( Delay_getMath(D) == NULL );
fail_unless( !Delay_isSetMath(D) );
@@ -196,7 +196,7 @@
int i = Delay_setMath(D, math);
- fail_unless( i == -6);
+ fail_unless( i == LIBSBML_INVALID_OBJECT);
fail_unless( !Delay_isSetMath(D) );
ASTNode_free(math);
Modified: branches/libsbml-4/src/sbml/test/TestEventAssignment_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestEventAssignment_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
+++ branches/libsbml-4/src/sbml/test/TestEventAssignment_newSetters.c 2009-02-25 19:14:56 UTC (rev 9124)
@@ -61,7 +61,7 @@
char *id = "1e1";
int i = EventAssignment_setVariable(E, id);
- fail_unless( i == -4 );
+ fail_unless( i == LIBSBML_INVALID_ATTRIBUTE_VALUE );
fail_unless( !EventAssignment_isSetVariable(E) );
}
END_TEST
@@ -72,13 +72,13 @@
char *id = "e1";
int i = EventAssignment_setVariable(E, id);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !strcmp(EventAssignment_getVariable(E), id) );
fail_unless( EventAssignment_isSetVariable(E) );
i = EventAssignment_setVariable(E, NULL);
- fail_unless( i == 0 );
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS );
fail_unless( !EventAssignment_isSetVariable(E) );
}
END_TEST
@@ -90,13 +90,13 @@
int i = EventAssignment_setMath(E, math);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( EventAssignment_getMath(E) != math );
fail_unless( EventAssignment_isSetMath(E) );
i = EventAssignment_setMath(E, NULL);
- fail_unless( i == 0);
+ fail_unless( i == LIBSBML_OPERATION_SUCCESS);
fail_unless( EventAssignment_getMath(E) == NULL );
fail_unless( !EventAssignment_isSetMath(E) );
@@ -111,7 +111,7 @@
int i = EventAssignment_setMath(E, math);
- fail_unless( i...
[truncated message content] |
|
From: <sar...@us...> - 2009-02-25 18:10:31
|
Revision: 9123
http://sbml.svn.sourceforge.net/sbml/?rev=9123&view=rev
Author: sarahkeating
Date: 2009-02-25 18:10:27 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
The allowable syntax for the name attribute depends on the SBML Level; in L2 it is a string whereas in L1 it is of type SId.
My original code did not make this distinction.
Modified Paths:
--------------
branches/libsbml-4/src/sbml/SBase.cpp
branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c
branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c
branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
branches/libsbml-4/src/sbml/test/TestFunctionDefinition_newSetters.c
branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
branches/libsbml-4/src/sbml/test/TestParameter_newSetters.c
branches/libsbml-4/src/sbml/test/TestReaction_newSetters.c
branches/libsbml-4/src/sbml/test/TestSpeciesType_newSetters.c
branches/libsbml-4/src/sbml/test/TestSpecies_newSetters.c
branches/libsbml-4/src/sbml/test/TestUnitDefinition_newSetters.c
Modified: branches/libsbml-4/src/sbml/SBase.cpp
===================================================================
--- branches/libsbml-4/src/sbml/SBase.cpp 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/SBase.cpp 2009-02-25 18:10:27 UTC (rev 9123)
@@ -652,14 +652,24 @@
int
SBase::setName (const std::string& name)
{
- if (!(SBase::hasCorrectIdSyntax(name)))
+ /* if this is setting an L2 name the type is string
+ * whereas if it is setting an L1 name its type is SId
+ */
+ if (getLevel() == 1)
{
- return LIBSBML_INVALID_ATTRIBUTE_VALUE;
+ if (!(SBase::hasCorrectIdSyntax(name)))
+ {
+ return LIBSBML_INVALID_ATTRIBUTE_VALUE;
+ }
+ else
+ {
+ mId = name;
+ return LIBSBML_OPERATION_SUCCESS;
+ }
}
else
{
- if (getLevel() == 1) mId = name;
- else mName = name;
+ mName = name;
return LIBSBML_OPERATION_SUCCESS;
}
}
Modified: branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestCompartmentType_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -104,8 +104,8 @@
{
int i = CompartmentType_setName(C, "1cell");
- fail_unless( i == -4 );
- fail_unless( !CompartmentType_isSetName(C) );
+ fail_unless( i == 0 );
+ fail_unless( CompartmentType_isSetName(C) );
i = CompartmentType_unsetName(C);
@@ -140,7 +140,7 @@
tcase_add_test( tcase, test_CompartmentType_setId3 );
tcase_add_test( tcase, test_CompartmentType_setId4 );
tcase_add_test( tcase, test_CompartmentType_setName1 );
- tcase_add_test( tcase, test_CompartmentType_setName2 );
+ //tcase_add_test( tcase, test_CompartmentType_setName2 );
tcase_add_test( tcase, test_CompartmentType_setName3 );
Modified: branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestCompartment_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -202,7 +202,7 @@
START_TEST (test_Compartment_setName2)
{
Compartment_t *c =
- Compartment_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Compartment_createWithLevelVersionAndNamespaces(1, 2, 0);
int i = Compartment_setName(c, "1cell");
Modified: branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestEvent_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -103,15 +103,15 @@
int i = Event_setName(E, name);
- fail_unless( i == -4 );
- fail_unless( !Event_isSetName(E) );
+ fail_unless( i == 0 );
+ fail_unless( Event_isSetName(E) );
}
END_TEST
START_TEST (test_Event_setName2)
{
- char *name = "Set_k2";
+ char *name = "Set k2";
int i = Event_setName(E, name);
Modified: branches/libsbml-4/src/sbml/test/TestFunctionDefinition_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestFunctionDefinition_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestFunctionDefinition_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -90,15 +90,15 @@
int i = FunctionDefinition_setName(E, name);
- fail_unless( i == -4 );
- fail_unless( !FunctionDefinition_isSetName(E) );
+ fail_unless( i == 0 );
+ fail_unless( FunctionDefinition_isSetName(E) );
}
END_TEST
START_TEST (test_FunctionDefinition_setName2)
{
- char *name = "Set_k2";
+ char *name = "Set k2";
int i = FunctionDefinition_setName(E, name);
Modified: branches/libsbml-4/src/sbml/test/TestModel_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestModel_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -121,15 +121,15 @@
int i = Model_setName(M, name);
- fail_unless( i == -4 );
- fail_unless( !Model_isSetName(M) );
+ fail_unless( i == 0 );
+ fail_unless( Model_isSetName(M) );
}
END_TEST
START_TEST (test_Model_setName2)
{
- char *name = "Set_k2";
+ char *name = "Set k2";
int i = Model_setName(M, name);
@@ -156,6 +156,17 @@
END_TEST
+START_TEST (test_Model_setName4)
+{
+ Model_t * m = Model_createWithLevelVersionAndNamespaces(1, 2, NULL);
+ int i = Model_setName(m, "11dd");
+
+ fail_unless( i == -4 );
+ fail_unless( !Model_isSetName(m) );
+}
+END_TEST
+
+
START_TEST (test_Model_setModelHistory1)
{
ModelHistory_t *mh = ModelHistory_create();
@@ -1191,6 +1202,7 @@
tcase_add_test( tcase, test_Model_setName1 );
tcase_add_test( tcase, test_Model_setName2 );
tcase_add_test( tcase, test_Model_setName3 );
+ tcase_add_test( tcase, test_Model_setName4 );
tcase_add_test( tcase, test_Model_setModelHistory1 );
tcase_add_test( tcase, test_Model_setModelHistory2 );
tcase_add_test( tcase, test_Model_addFunctionDefinition1 );
Modified: branches/libsbml-4/src/sbml/test/TestParameter_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestParameter_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestParameter_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -102,8 +102,8 @@
int i = Parameter_setName(p, "1cell");
- fail_unless( i == -4 );
- fail_unless( !Parameter_isSetName(p) );
+ fail_unless( i == 0 );
+ fail_unless( Parameter_isSetName(p) );
i = Parameter_unsetName(p);
@@ -118,10 +118,15 @@
START_TEST (test_Parameter_setName3)
{
Parameter_t *p =
- Parameter_createWithLevelVersionAndNamespaces(2, 2, 0);
+ Parameter_createWithLevelVersionAndNamespaces(1, 2, 0);
- int i = Parameter_setName(p, NULL);
+ int i = Parameter_setName(p, "11pp");
+ fail_unless( i == -4 );
+ fail_unless( !Parameter_isSetName(p) );
+
+ i = Parameter_setName(p, NULL);
+
fail_unless( i == 0 );
fail_unless( !Parameter_isSetName(p) );
Modified: branches/libsbml-4/src/sbml/test/TestReaction_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestReaction_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestReaction_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -104,8 +104,8 @@
int i = Reaction_setName(p, "1cell");
- fail_unless( i == -4 );
- fail_unless( !Reaction_isSetName(p) );
+ fail_unless( i == 0 );
+ fail_unless( Reaction_isSetName(p) );
i = Reaction_unsetName(p);
Modified: branches/libsbml-4/src/sbml/test/TestSpeciesType_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestSpeciesType_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestSpeciesType_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -110,8 +110,8 @@
{
int i = SpeciesType_setName(ST, "1cell");
- fail_unless( i == -4 );
- fail_unless( !SpeciesType_isSetName(ST) );
+ fail_unless( i == 0 );
+ fail_unless( SpeciesType_isSetName(ST) );
i = SpeciesType_unsetName(ST);
Modified: branches/libsbml-4/src/sbml/test/TestSpecies_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestSpecies_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestSpecies_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -218,8 +218,8 @@
int i = Species_setName(c, "1cell");
- fail_unless( i == -4 );
- fail_unless( !Species_isSetName(c) );
+ fail_unless( i == 0 );
+ fail_unless( Species_isSetName(c) );
i = Species_unsetName(c);
Modified: branches/libsbml-4/src/sbml/test/TestUnitDefinition_newSetters.c
===================================================================
--- branches/libsbml-4/src/sbml/test/TestUnitDefinition_newSetters.c 2009-02-25 03:27:15 UTC (rev 9122)
+++ branches/libsbml-4/src/sbml/test/TestUnitDefinition_newSetters.c 2009-02-25 18:10:27 UTC (rev 9123)
@@ -92,8 +92,8 @@
i = UnitDefinition_setName(UD, "123");
- fail_unless( i == -4);
- fail_unless( !UnitDefinition_isSetName(UD) );
+ fail_unless( i == 0);
+ fail_unless( UnitDefinition_isSetName(UD) );
}
END_TEST
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sar...@us...> - 2009-02-25 03:27:19
|
Revision: 9122
http://sbml.svn.sourceforge.net/sbml/?rev=9122&view=rev
Author: sarahkeating
Date: 2009-02-25 03:27:15 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
updated the functions that detect whether an L2V4 model being converted has strict unit/sbo consistency
they now ignores fails that would be warnings in other level/versions
Modified Paths:
--------------
trunk/libsbml/src/sbml/SBMLDocument.cpp
Modified: trunk/libsbml/src/sbml/SBMLDocument.cpp
===================================================================
--- trunk/libsbml/src/sbml/SBMLDocument.cpp 2009-02-24 23:10:15 UTC (rev 9121)
+++ trunk/libsbml/src/sbml/SBMLDocument.cpp 2009-02-25 03:27:15 UTC (rev 9122)
@@ -125,20 +125,69 @@
bool
SBMLDocument::hasStrictUnits()
{
+ unsigned int errors = 0;
+
UnitConsistencyValidator unit_validator;
unit_validator.init();
- return (unit_validator.validate(*this) == 0);
-
+ errors = unit_validator.validate(*this);
+
+ /* only want to return true if there are errors
+ * not warnings
+ * but in a L2V4 model they will only be warnings
+ * so need to go by ErrorId
+ * EventAssignParameterMismatch is the largest errorId that
+ * would be considered an error in other level/versions
+ */
+ if (errors > 0)
+ {
+ std::list<SBMLError> fails = unit_validator.getFailures();
+ std::list<SBMLError>::iterator iter;
+
+ for (iter = fails.begin(); iter != fails.end(); iter++)
+ {
+ if ( iter->getErrorId() > EventAssignParameterMismatch)
+ {
+ errors--;
+ }
+ }
+ }
+
+ return (errors == 0);
}
bool
SBMLDocument::hasStrictSBO()
{
+ unsigned int errors = 0;
+
SBOConsistencyValidator sbo_validator;
sbo_validator.init();
- return (sbo_validator.validate(*this) == 0);
-
+ errors = sbo_validator.validate(*this);
+
+ /* only want to return true if there are errors
+ * not warnings
+ * but in a L2V4 model they will only be warnings
+ * so need to go by ErrorId
+ * InvalidDelaySBOTerm is the largest errorId that
+ * would be considered an error in other level/versions
+ */
+ if (errors > 0)
+ {
+ std::list<SBMLError> fails = sbo_validator.getFailures();
+ std::list<SBMLError>::iterator iter;
+
+ for (iter = fails.begin(); iter != fails.end(); iter++)
+ {
+ if ( iter->getErrorId() > InvalidDelaySBOTerm)
+ {
+ errors--;
+ }
+ }
+ }
+
+ return (errors == 0);
+
}
/** @endcond doxygen-libsbml-internal */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|