1 /**
2  * @file SedFitExperiment.cpp
3  * @brief Implementation of the SedFitExperiment class.
4  * @author DEVISER
5  *
6  * <!--------------------------------------------------------------------------
7  * This file is part of libSEDML. Please visit http://sed-ml.org for more
8  * information about SED-ML. The latest version of libSEDML can be found on
9  * github: https://github.com/fbergmann/libSEDML/
10  *
11 
12  * Copyright (c) 2013-2019, Frank T. Bergmann
13  * All rights reserved.
14  *
15 
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions are met:
18  *
19 
20  * 1. Redistributions of source code must retain the above copyright notice,
21  * this
22  * list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright notice,
24  * this list of conditions and the following disclaimer in the documentation
25  * and/or other materials provided with the distribution.
26  *
27  * This library is free software; you can redistribute it and/or modify it
28  * under the terms of the GNU Lesser General Public License as published by the
29  * Free Software Foundation. A copy of the license agreement is provided in the
30  * file named "LICENSE.txt" included with this software distribution and also
31  * available online as http://sbml.org/software/libsbml/license.html
32  * ------------------------------------------------------------------------ -->
33  */
34 #include <sedml/SedFitExperiment.h>
35 #include <sedml/SedListOfFitExperiments.h>
36 #include <sbml/xml/XMLInputStream.h>
37 
38 
39 using namespace std;
40 
41 
42 
43 LIBSEDML_CPP_NAMESPACE_BEGIN
44 
45 
46 
47 
48 #ifdef __cplusplus
49 
50 
51 /*
52  * Creates a new SedFitExperiment using the given SED-ML Level and @ p version
53  * values.
54  */
SedFitExperiment(unsigned int level,unsigned int version)55 SedFitExperiment::SedFitExperiment(unsigned int level, unsigned int version)
56   : SedBase(level, version)
57   , mType (SEDML_EXPERIMENTTYPE_INVALID)
58   , mAlgorithm (NULL)
59   , mFitMappings (level, version)
60 {
61   setSedNamespacesAndOwn(new SedNamespaces(level, version));
62   connectToChild();
63 }
64 
65 
66 /*
67  * Creates a new SedFitExperiment using the given SedNamespaces object @p
68  * sedmlns.
69  */
SedFitExperiment(SedNamespaces * sedmlns)70 SedFitExperiment::SedFitExperiment(SedNamespaces *sedmlns)
71   : SedBase(sedmlns)
72   , mType (SEDML_EXPERIMENTTYPE_INVALID)
73   , mAlgorithm (NULL)
74   , mFitMappings (sedmlns)
75 {
76   setElementNamespace(sedmlns->getURI());
77   connectToChild();
78 }
79 
80 
81 /*
82  * Copy constructor for SedFitExperiment.
83  */
SedFitExperiment(const SedFitExperiment & orig)84 SedFitExperiment::SedFitExperiment(const SedFitExperiment& orig)
85   : SedBase( orig )
86   , mType ( orig.mType )
87   , mAlgorithm ( NULL )
88   , mFitMappings ( orig.mFitMappings )
89 {
90   if (orig.mAlgorithm != NULL)
91   {
92     mAlgorithm = orig.mAlgorithm->clone();
93   }
94 
95   connectToChild();
96 }
97 
98 
99 /*
100  * Assignment operator for SedFitExperiment.
101  */
102 SedFitExperiment&
operator =(const SedFitExperiment & rhs)103 SedFitExperiment::operator=(const SedFitExperiment& rhs)
104 {
105   if (&rhs != this)
106   {
107     SedBase::operator=(rhs);
108     mType = rhs.mType;
109     mFitMappings = rhs.mFitMappings;
110     delete mAlgorithm;
111     if (rhs.mAlgorithm != NULL)
112     {
113       mAlgorithm = rhs.mAlgorithm->clone();
114     }
115     else
116     {
117       mAlgorithm = NULL;
118     }
119 
120     connectToChild();
121   }
122 
123   return *this;
124 }
125 
126 
127 /*
128  * Creates and returns a deep copy of this SedFitExperiment object.
129  */
130 SedFitExperiment*
clone() const131 SedFitExperiment::clone() const
132 {
133   return new SedFitExperiment(*this);
134 }
135 
136 
137 /*
138  * Destructor for SedFitExperiment.
139  */
~SedFitExperiment()140 SedFitExperiment::~SedFitExperiment()
141 {
142   delete mAlgorithm;
143   mAlgorithm = NULL;
144 }
145 
146 
147 /*
148  * Returns the value of the "type" attribute of this SedFitExperiment.
149  */
150 ExperimentType_t
getType() const151 SedFitExperiment::getType() const
152 {
153   return mType;
154 }
155 
156 
157 /*
158  * Returns the value of the "type" attribute of this SedFitExperiment.
159  */
160 std::string
getTypeAsString() const161 SedFitExperiment::getTypeAsString() const
162 {
163   std::string code_str = ExperimentType_toString(mType);
164   return code_str;
165 }
166 
167 
168 /*
169  * Predicate returning @c true if this SedFitExperiment's "type" attribute is
170  * set.
171  */
172 bool
isSetType() const173 SedFitExperiment::isSetType() const
174 {
175   return (mType != SEDML_EXPERIMENTTYPE_INVALID);
176 }
177 
178 
179 /*
180  * Sets the value of the "type" attribute of this SedFitExperiment.
181  */
182 int
setType(const ExperimentType_t type)183 SedFitExperiment::setType(const ExperimentType_t type)
184 {
185   if (ExperimentType_isValid(type) == 0)
186   {
187     mType = SEDML_EXPERIMENTTYPE_INVALID;
188     return LIBSEDML_INVALID_ATTRIBUTE_VALUE;
189   }
190   else
191   {
192     mType = type;
193     return LIBSEDML_OPERATION_SUCCESS;
194   }
195 }
196 
197 
198 /*
199  * Sets the value of the "type" attribute of this SedFitExperiment.
200  */
201 int
setType(const std::string & type)202 SedFitExperiment::setType(const std::string& type)
203 {
204   mType = ExperimentType_fromString(type.c_str());
205 
206   if (mType == SEDML_EXPERIMENTTYPE_INVALID)
207   {
208     return LIBSEDML_INVALID_ATTRIBUTE_VALUE;
209   }
210 
211   return LIBSEDML_OPERATION_SUCCESS;
212 }
213 
214 
215 /*
216  * Unsets the value of the "type" attribute of this SedFitExperiment.
217  */
218 int
unsetType()219 SedFitExperiment::unsetType()
220 {
221   mType = SEDML_EXPERIMENTTYPE_INVALID;
222   return LIBSEDML_OPERATION_SUCCESS;
223 }
224 
225 
226 /*
227  * Returns the value of the "algorithm" element of this SedFitExperiment.
228  */
229 const SedAlgorithm*
getAlgorithm() const230 SedFitExperiment::getAlgorithm() const
231 {
232   return mAlgorithm;
233 }
234 
235 
236 /*
237  * Returns the value of the "algorithm" element of this SedFitExperiment.
238  */
239 SedAlgorithm*
getAlgorithm()240 SedFitExperiment::getAlgorithm()
241 {
242   return mAlgorithm;
243 }
244 
245 
246 /*
247  * Predicate returning @c true if this SedFitExperiment's "algorithm" element
248  * is set.
249  */
250 bool
isSetAlgorithm() const251 SedFitExperiment::isSetAlgorithm() const
252 {
253   return (mAlgorithm != NULL);
254 }
255 
256 
257 /*
258  * Sets the value of the "algorithm" element of this SedFitExperiment.
259  */
260 int
setAlgorithm(const SedAlgorithm * algorithm)261 SedFitExperiment::setAlgorithm(const SedAlgorithm* algorithm)
262 {
263   if (mAlgorithm == algorithm)
264   {
265     return LIBSEDML_OPERATION_SUCCESS;
266   }
267   else if (algorithm == NULL)
268   {
269     delete mAlgorithm;
270     mAlgorithm = NULL;
271     return LIBSEDML_OPERATION_SUCCESS;
272   }
273   else
274   {
275     delete mAlgorithm;
276     mAlgorithm = (algorithm != NULL) ? algorithm->clone() : NULL;
277     if (mAlgorithm != NULL)
278     {
279       mAlgorithm->connectToParent(this);
280     }
281 
282     return LIBSEDML_OPERATION_SUCCESS;
283   }
284 }
285 
286 
287 /*
288  * Creates a new SedAlgorithm object, adds it to this SedFitExperiment object
289  * and returns the SedAlgorithm object created.
290  */
291 SedAlgorithm*
createAlgorithm()292 SedFitExperiment::createAlgorithm()
293 {
294   if (mAlgorithm != NULL)
295   {
296     delete mAlgorithm;
297   }
298 
299   mAlgorithm = new SedAlgorithm(getSedNamespaces());
300 
301   connectToChild();
302 
303   return mAlgorithm;
304 }
305 
306 
307 /*
308  * Unsets the value of the "algorithm" element of this SedFitExperiment.
309  */
310 int
unsetAlgorithm()311 SedFitExperiment::unsetAlgorithm()
312 {
313   delete mAlgorithm;
314   mAlgorithm = NULL;
315   return LIBSEDML_OPERATION_SUCCESS;
316 }
317 
318 
319 /*
320  * Returns the SedListOfFitMappings from this SedFitExperiment.
321  */
322 const SedListOfFitMappings*
getListOfFitMappings() const323 SedFitExperiment::getListOfFitMappings() const
324 {
325   return &mFitMappings;
326 }
327 
328 
329 /*
330  * Returns the SedListOfFitMappings from this SedFitExperiment.
331  */
332 SedListOfFitMappings*
getListOfFitMappings()333 SedFitExperiment::getListOfFitMappings()
334 {
335   return &mFitMappings;
336 }
337 
338 
339 /*
340  * Get a SedFitMapping from the SedFitExperiment.
341  */
342 SedFitMapping*
getFitMapping(unsigned int n)343 SedFitExperiment::getFitMapping(unsigned int n)
344 {
345   return mFitMappings.get(n);
346 }
347 
348 
349 /*
350  * Get a SedFitMapping from the SedFitExperiment.
351  */
352 const SedFitMapping*
getFitMapping(unsigned int n) const353 SedFitExperiment::getFitMapping(unsigned int n) const
354 {
355   return mFitMappings.get(n);
356 }
357 
358 
359 /*
360  * Get a SedFitMapping from the SedFitExperiment based on the DataSource to
361  * which it refers.
362  */
363 const SedFitMapping*
getFitMappingByDataSource(const std::string & sid) const364 SedFitExperiment::getFitMappingByDataSource(const std::string& sid) const
365 {
366   return mFitMappings.getByDataSource(sid);
367 }
368 
369 
370 /*
371  * Get a SedFitMapping from the SedFitExperiment based on the DataSource to
372  * which it refers.
373  */
374 SedFitMapping*
getFitMappingByDataSource(const std::string & sid)375 SedFitExperiment::getFitMappingByDataSource(const std::string& sid)
376 {
377   return mFitMappings.getByDataSource(sid);
378 }
379 
380 
381 /*
382  * Get a SedFitMapping from the SedFitExperiment based on the Target to which
383  * it refers.
384  */
385 const SedFitMapping*
getFitMappingByTarget(const std::string & sid) const386 SedFitExperiment::getFitMappingByTarget(const std::string& sid) const
387 {
388   return mFitMappings.getByTarget(sid);
389 }
390 
391 
392 /*
393  * Get a SedFitMapping from the SedFitExperiment based on the Target to which
394  * it refers.
395  */
396 SedFitMapping*
getFitMappingByTarget(const std::string & sid)397 SedFitExperiment::getFitMappingByTarget(const std::string& sid)
398 {
399   return mFitMappings.getByTarget(sid);
400 }
401 
402 
403 /*
404  * Get a SedFitMapping from the SedFitExperiment based on the PointWeight to
405  * which it refers.
406  */
407 const SedFitMapping*
getFitMappingByPointWeight(const std::string & sid) const408 SedFitExperiment::getFitMappingByPointWeight(const std::string& sid) const
409 {
410   return mFitMappings.getByPointWeight(sid);
411 }
412 
413 
414 /*
415  * Get a SedFitMapping from the SedFitExperiment based on the PointWeight to
416  * which it refers.
417  */
418 SedFitMapping*
getFitMappingByPointWeight(const std::string & sid)419 SedFitExperiment::getFitMappingByPointWeight(const std::string& sid)
420 {
421   return mFitMappings.getByPointWeight(sid);
422 }
423 
424 
425 /*
426  * Adds a copy of the given SedFitMapping to this SedFitExperiment.
427  */
428 int
addFitMapping(const SedFitMapping * sfm)429 SedFitExperiment::addFitMapping(const SedFitMapping* sfm)
430 {
431   if (sfm == NULL)
432   {
433     return LIBSEDML_OPERATION_FAILED;
434   }
435   else if (sfm->hasRequiredAttributes() == false)
436   {
437     return LIBSEDML_INVALID_OBJECT;
438   }
439   else if (getLevel() != sfm->getLevel())
440   {
441     return LIBSEDML_LEVEL_MISMATCH;
442   }
443   else if (getVersion() != sfm->getVersion())
444   {
445     return LIBSEDML_VERSION_MISMATCH;
446   }
447   else if (matchesRequiredSedNamespacesForAddition(static_cast<const
448     SedBase*>(sfm)) == false)
449   {
450     return LIBSEDML_NAMESPACES_MISMATCH;
451   }
452   else
453   {
454     return mFitMappings.append(sfm);
455   }
456 }
457 
458 
459 /*
460  * Get the number of SedFitMapping objects in this SedFitExperiment.
461  */
462 unsigned int
getNumFitMappings() const463 SedFitExperiment::getNumFitMappings() const
464 {
465   return mFitMappings.size();
466 }
467 
468 
469 /*
470  * Creates a new SedFitMapping object, adds it to this SedFitExperiment object
471  * and returns the SedFitMapping object created.
472  */
473 SedFitMapping*
createFitMapping()474 SedFitExperiment::createFitMapping()
475 {
476   SedFitMapping* sfm = NULL;
477 
478   try
479   {
480     sfm = new SedFitMapping(getSedNamespaces());
481   }
482   catch (...)
483   {
484   }
485 
486   if (sfm != NULL)
487   {
488     mFitMappings.appendAndOwn(sfm);
489   }
490 
491   return sfm;
492 }
493 
494 
495 /*
496  * Removes the nth SedFitMapping from this SedFitExperiment and returns a
497  * pointer to it.
498  */
499 SedFitMapping*
removeFitMapping(unsigned int n)500 SedFitExperiment::removeFitMapping(unsigned int n)
501 {
502   return mFitMappings.remove(n);
503 }
504 
505 
506 /*
507  * Returns the XML element name of this SedFitExperiment object.
508  */
509 const std::string&
getElementName() const510 SedFitExperiment::getElementName() const
511 {
512   static const string name = "fitExperiment";
513   return name;
514 }
515 
516 
517 /*
518  * Returns the libSEDML type code for this SedFitExperiment object.
519  */
520 int
getTypeCode() const521 SedFitExperiment::getTypeCode() const
522 {
523   return SEDML_FIT_EXPERIMENT;
524 }
525 
526 
527 /*
528  * Predicate returning @c true if all the required attributes for this
529  * SedFitExperiment object have been set.
530  */
531 bool
hasRequiredAttributes() const532 SedFitExperiment::hasRequiredAttributes() const
533 {
534   bool allPresent = true;
535 
536   return allPresent;
537 }
538 
539 
540 
541 /** @cond doxygenLibSEDMLInternal */
542 
543 /*
544  * Write any contained elements
545  */
546 void
writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream & stream) const547 SedFitExperiment::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER
548   XMLOutputStream& stream) const
549 {
550   SedBase::writeElements(stream);
551 
552   if (isSetAlgorithm() == true)
553   {
554     mAlgorithm->write(stream);
555   }
556 
557   if (getNumFitMappings() > 0)
558   {
559     mFitMappings.write(stream);
560   }
561 }
562 
563 /** @endcond */
564 
565 
566 
567 /** @cond doxygenLibSEDMLInternal */
568 
569 /*
570  * Accepts the given SedVisitor
571  */
572 bool
accept(SedVisitor & v) const573 SedFitExperiment::accept(SedVisitor& v) const
574 {
575   return false;
576 }
577 
578 /** @endcond */
579 
580 
581 
582 /** @cond doxygenLibSEDMLInternal */
583 
584 /*
585  * Sets the parent SedDocument
586  */
587 void
setSedDocument(SedDocument * d)588 SedFitExperiment::setSedDocument(SedDocument* d)
589 {
590   SedBase::setSedDocument(d);
591 
592   if (mAlgorithm != NULL)
593   {
594     mAlgorithm->setSedDocument(d);
595   }
596 
597   mFitMappings.setSedDocument(d);
598 }
599 
600 /** @endcond */
601 
602 
603 
604 /** @cond doxygenLibSEDMLInternal */
605 
606 /*
607  * Connects to child elements
608  */
609 void
connectToChild()610 SedFitExperiment::connectToChild()
611 {
612   SedBase::connectToChild();
613 
614   if (mAlgorithm != NULL)
615   {
616     mAlgorithm->connectToParent(this);
617   }
618 
619   mFitMappings.connectToParent(this);
620 }
621 
622 /** @endcond */
623 
624 
625 
626 /** @cond doxygenLibSEDMLInternal */
627 
628 /*
629  * Gets the value of the "attributeName" attribute of this SedFitExperiment.
630  */
631 int
getAttribute(const std::string & attributeName,bool & value) const632 SedFitExperiment::getAttribute(const std::string& attributeName,
633                                bool& value) const
634 {
635   int return_value = SedBase::getAttribute(attributeName, value);
636 
637   return return_value;
638 }
639 
640 /** @endcond */
641 
642 
643 
644 /** @cond doxygenLibSEDMLInternal */
645 
646 /*
647  * Gets the value of the "attributeName" attribute of this SedFitExperiment.
648  */
649 int
getAttribute(const std::string & attributeName,int & value) const650 SedFitExperiment::getAttribute(const std::string& attributeName,
651                                int& value) const
652 {
653   int return_value = SedBase::getAttribute(attributeName, value);
654 
655   return return_value;
656 }
657 
658 /** @endcond */
659 
660 
661 
662 /** @cond doxygenLibSEDMLInternal */
663 
664 /*
665  * Gets the value of the "attributeName" attribute of this SedFitExperiment.
666  */
667 int
getAttribute(const std::string & attributeName,double & value) const668 SedFitExperiment::getAttribute(const std::string& attributeName,
669                                double& value) const
670 {
671   int return_value = SedBase::getAttribute(attributeName, value);
672 
673   return return_value;
674 }
675 
676 /** @endcond */
677 
678 
679 
680 /** @cond doxygenLibSEDMLInternal */
681 
682 /*
683  * Gets the value of the "attributeName" attribute of this SedFitExperiment.
684  */
685 int
getAttribute(const std::string & attributeName,unsigned int & value) const686 SedFitExperiment::getAttribute(const std::string& attributeName,
687                                unsigned int& value) const
688 {
689   int return_value = SedBase::getAttribute(attributeName, value);
690 
691   return return_value;
692 }
693 
694 /** @endcond */
695 
696 
697 
698 /** @cond doxygenLibSEDMLInternal */
699 
700 /*
701  * Gets the value of the "attributeName" attribute of this SedFitExperiment.
702  */
703 int
getAttribute(const std::string & attributeName,std::string & value) const704 SedFitExperiment::getAttribute(const std::string& attributeName,
705                                std::string& value) const
706 {
707   int return_value = SedBase::getAttribute(attributeName, value);
708 
709   if (return_value == LIBSEDML_OPERATION_SUCCESS)
710   {
711     return return_value;
712   }
713 
714   if (attributeName == "id")
715   {
716     value = getId();
717     return_value = LIBSEDML_OPERATION_SUCCESS;
718   }
719   else if (attributeName == "type")
720   {
721     value = getTypeAsString();
722     return_value = LIBSEDML_OPERATION_SUCCESS;
723   }
724 
725   return return_value;
726 }
727 
728 /** @endcond */
729 
730 
731 
732 /** @cond doxygenLibSEDMLInternal */
733 
734 /*
735  * Predicate returning @c true if this SedFitExperiment's attribute
736  * "attributeName" is set.
737  */
738 bool
isSetAttribute(const std::string & attributeName) const739 SedFitExperiment::isSetAttribute(const std::string& attributeName) const
740 {
741   bool value = SedBase::isSetAttribute(attributeName);
742 
743   if (attributeName == "id")
744   {
745     value = isSetId();
746   }
747   else if (attributeName == "type")
748   {
749     value = isSetType();
750   }
751 
752   return value;
753 }
754 
755 /** @endcond */
756 
757 
758 
759 /** @cond doxygenLibSEDMLInternal */
760 
761 /*
762  * Sets the value of the "attributeName" attribute of this SedFitExperiment.
763  */
764 int
setAttribute(const std::string & attributeName,bool value)765 SedFitExperiment::setAttribute(const std::string& attributeName, bool value)
766 {
767   int return_value = SedBase::setAttribute(attributeName, value);
768 
769   return return_value;
770 }
771 
772 /** @endcond */
773 
774 
775 
776 /** @cond doxygenLibSEDMLInternal */
777 
778 /*
779  * Sets the value of the "attributeName" attribute of this SedFitExperiment.
780  */
781 int
setAttribute(const std::string & attributeName,int value)782 SedFitExperiment::setAttribute(const std::string& attributeName, int value)
783 {
784   int return_value = SedBase::setAttribute(attributeName, value);
785 
786   return return_value;
787 }
788 
789 /** @endcond */
790 
791 
792 
793 /** @cond doxygenLibSEDMLInternal */
794 
795 /*
796  * Sets the value of the "attributeName" attribute of this SedFitExperiment.
797  */
798 int
setAttribute(const std::string & attributeName,double value)799 SedFitExperiment::setAttribute(const std::string& attributeName, double value)
800 {
801   int return_value = SedBase::setAttribute(attributeName, value);
802 
803   return return_value;
804 }
805 
806 /** @endcond */
807 
808 
809 
810 /** @cond doxygenLibSEDMLInternal */
811 
812 /*
813  * Sets the value of the "attributeName" attribute of this SedFitExperiment.
814  */
815 int
setAttribute(const std::string & attributeName,unsigned int value)816 SedFitExperiment::setAttribute(const std::string& attributeName,
817                                unsigned int value)
818 {
819   int return_value = SedBase::setAttribute(attributeName, value);
820 
821   return return_value;
822 }
823 
824 /** @endcond */
825 
826 
827 
828 /** @cond doxygenLibSEDMLInternal */
829 
830 /*
831  * Sets the value of the "attributeName" attribute of this SedFitExperiment.
832  */
833 int
setAttribute(const std::string & attributeName,const std::string & value)834 SedFitExperiment::setAttribute(const std::string& attributeName,
835                                const std::string& value)
836 {
837   int return_value = SedBase::setAttribute(attributeName, value);
838 
839   if (attributeName == "id")
840   {
841     return_value = setId(value);
842   }
843   else if (attributeName == "type")
844   {
845     return_value = setType(value);
846   }
847 
848   return return_value;
849 }
850 
851 /** @endcond */
852 
853 
854 
855 /** @cond doxygenLibSEDMLInternal */
856 
857 /*
858  * Unsets the value of the "attributeName" attribute of this SedFitExperiment.
859  */
860 int
unsetAttribute(const std::string & attributeName)861 SedFitExperiment::unsetAttribute(const std::string& attributeName)
862 {
863   int value = SedBase::unsetAttribute(attributeName);
864 
865   if (attributeName == "id")
866   {
867     value = unsetId();
868   }
869   else if (attributeName == "type")
870   {
871     value = unsetType();
872   }
873 
874   return value;
875 }
876 
877 /** @endcond */
878 
879 
880 
881 /** @cond doxygenLibSEDMLInternal */
882 
883 /*
884  * Creates and returns an new "elementName" object in this SedFitExperiment.
885  */
886 SedBase*
createChildObject(const std::string & elementName)887 SedFitExperiment::createChildObject(const std::string& elementName)
888 {
889   SedBase* obj = NULL;
890 
891   if (elementName == "algorithm")
892   {
893     return createAlgorithm();
894   }
895   else if (elementName == "fitMapping")
896   {
897     return createFitMapping();
898   }
899 
900   return obj;
901 }
902 
903 /** @endcond */
904 
905 
906 
907 /** @cond doxygenLibSEDMLInternal */
908 
909 /*
910  * Adds a new "elementName" object to this SedFitExperiment.
911  */
912 int
addChildObject(const std::string & elementName,const SedBase * element)913 SedFitExperiment::addChildObject(const std::string& elementName,
914                                  const SedBase* element)
915 {
916   if (elementName == "algorithm" && element->getTypeCode() ==
917     SEDML_SIMULATION_ALGORITHM)
918   {
919     return setAlgorithm((const SedAlgorithm*)(element));
920   }
921   else if (elementName == "fitMapping" && element->getTypeCode() ==
922     SEDML_FITMAPPING)
923   {
924     return addFitMapping((const SedFitMapping*)(element));
925   }
926 
927   return LIBSBML_OPERATION_FAILED;
928 }
929 
930 /** @endcond */
931 
932 
933 
934 /** @cond doxygenLibSEDMLInternal */
935 
936 /*
937  * Removes and returns the new "elementName" object with the given id in this
938  * SedFitExperiment.
939  */
940 SedBase*
removeChildObject(const std::string & elementName,const std::string & id)941 SedFitExperiment::removeChildObject(const std::string& elementName,
942                                     const std::string& id)
943 {
944   if (elementName == "algorithm")
945   {
946     SedAlgorithm * obj = mAlgorithm;
947     mAlgorithm = NULL; return obj;
948   }
949   else if (elementName == "fitMapping")
950   {
951     for (unsigned int i = 0; i < getNumFitMappings(); i++)
952     {
953       if (getFitMapping(i)->getId() == id)
954       {
955         return removeFitMapping(i);
956       }
957     }
958   }
959 
960   return NULL;
961 }
962 
963 /** @endcond */
964 
965 
966 
967 /** @cond doxygenLibSEDMLInternal */
968 
969 /*
970  * Returns the number of "elementName" in this SedFitExperiment.
971  */
972 unsigned int
getNumObjects(const std::string & elementName)973 SedFitExperiment::getNumObjects(const std::string& elementName)
974 {
975   unsigned int n = 0;
976 
977   if (elementName == "algorithm")
978   {
979     if (isSetAlgorithm())
980     {
981       return 1;
982     }
983   }
984   else if (elementName == "fitMapping")
985   {
986     return getNumFitMappings();
987   }
988 
989   return n;
990 }
991 
992 /** @endcond */
993 
994 
995 
996 /** @cond doxygenLibSEDMLInternal */
997 
998 /*
999  * Returns the nth object of "objectName" in this SedFitExperiment.
1000  */
1001 SedBase*
getObject(const std::string & elementName,unsigned int index)1002 SedFitExperiment::getObject(const std::string& elementName,
1003                             unsigned int index)
1004 {
1005   SedBase* obj = NULL;
1006 
1007   if (elementName == "algorithm")
1008   {
1009     return getAlgorithm();
1010   }
1011   else if (elementName == "fitMapping")
1012   {
1013     return getFitMapping(index);
1014   }
1015 
1016   return obj;
1017 }
1018 
1019 /** @endcond */
1020 
1021 
1022 /*
1023  * Returns the first child element that has the given @p id in the model-wide
1024  * SId namespace, or @c NULL if no such object is found.
1025  */
1026 SedBase*
getElementBySId(const std::string & id)1027 SedFitExperiment::getElementBySId(const std::string& id)
1028 {
1029   if (id.empty())
1030   {
1031     return NULL;
1032   }
1033 
1034   SedBase* obj = NULL;
1035 
1036   if (mAlgorithm != NULL)
1037   {
1038     if (mAlgorithm->getId() == id)
1039     {
1040       return mAlgorithm;
1041     }
1042 
1043     obj = mAlgorithm->getElementBySId(id);
1044     if (obj != NULL)
1045     {
1046       return obj;
1047     }
1048   }
1049 
1050   obj = mFitMappings.getElementBySId(id);
1051 
1052   if (obj != NULL)
1053   {
1054     return obj;
1055   }
1056 
1057   return obj;
1058 }
1059 
1060 
1061 /*
1062  * Returns a List of all child SedBase objects, including those nested to an
1063  * arbitrary depth.
1064  */
1065 List*
getAllElements(SedElementFilter * filter)1066 SedFitExperiment::getAllElements(SedElementFilter* filter)
1067 {
1068   List* ret = new List();
1069   List* sublist = NULL;
1070   SED_ADD_FILTERED_POINTER(ret, sublist, mAlgorithm, filter);
1071 
1072   SED_ADD_FILTERED_LIST(ret, sublist, mFitMappings, filter);
1073 
1074   return ret;
1075 }
1076 
1077 
1078 
1079 /** @cond doxygenLibSEDMLInternal */
1080 
1081 /*
1082  * Creates a new object from the next XMLToken on the XMLInputStream
1083  */
1084 SedBase*
createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream & stream)1085 SedFitExperiment::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream&
1086   stream)
1087 {
1088   SedBase* obj = NULL;
1089 
1090   const std::string& name = stream.peek().getName();
1091 
1092   if (name == "algorithm")
1093   {
1094     if (getErrorLog() && isSetAlgorithm())
1095     {
1096       getErrorLog()->logError(SedmlFitExperimentAllowedElements, getLevel(),
1097         getVersion(), "", getLine(), getColumn());
1098     }
1099 
1100     delete mAlgorithm;
1101     mAlgorithm = new SedAlgorithm(getSedNamespaces());
1102     obj = mAlgorithm;
1103   }
1104   else if (name == "listOfFitMappings")
1105   {
1106     if (getErrorLog() && mFitMappings.size() != 0)
1107     {
1108       getErrorLog()->logError(SedmlFitExperimentAllowedElements, getLevel(),
1109         getVersion(), "", getLine(), getColumn());
1110     }
1111 
1112     obj = &mFitMappings;
1113   }
1114 
1115   connectToChild();
1116 
1117   return obj;
1118 }
1119 
1120 /** @endcond */
1121 
1122 
1123 
1124 /** @cond doxygenLibSEDMLInternal */
1125 
1126 /*
1127  * Adds the expected attributes for this element
1128  */
1129 void
addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes & attributes)1130 SedFitExperiment::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER
1131   ExpectedAttributes& attributes)
1132 {
1133   SedBase::addExpectedAttributes(attributes);
1134 
1135   attributes.add("id");
1136 
1137   attributes.add("type");
1138 }
1139 
1140 /** @endcond */
1141 
1142 
1143 
1144 /** @cond doxygenLibSEDMLInternal */
1145 
1146 /*
1147  * Reads the expected attributes into the member data variables
1148  */
1149 void
readAttributes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes & attributes,const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes & expectedAttributes)1150 SedFitExperiment::readAttributes(
1151                                  const LIBSBML_CPP_NAMESPACE_QUALIFIER
1152                                    XMLAttributes& attributes,
1153                                  const LIBSBML_CPP_NAMESPACE_QUALIFIER
1154                                    ExpectedAttributes& expectedAttributes)
1155 {
1156   unsigned int level = getLevel();
1157   unsigned int version = getVersion();
1158   unsigned int numErrs;
1159   bool assigned = false;
1160   SedErrorLog* log = getErrorLog();
1161 
1162   if (log && getParentSedObject() &&
1163     static_cast<SedListOfFitExperiments*>(getParentSedObject())->size() < 2)
1164   {
1165     numErrs = log->getNumErrors();
1166     for (int n = numErrs-1; n >= 0; n--)
1167     {
1168       if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
1169       {
1170         const std::string details = log->getError(n)->getMessage();
1171         log->remove(SedUnknownCoreAttribute);
1172         log->logError(SedmlParameterEstimationTaskLOFitExperimentsAllowedCoreAttributes,
1173           level, version, details, getLine(), getColumn());
1174       }
1175     }
1176   }
1177 
1178   SedBase::readAttributes(attributes, expectedAttributes);
1179 
1180   if (log)
1181   {
1182     numErrs = log->getNumErrors();
1183 
1184     for (int n = numErrs-1; n >= 0; n--)
1185     {
1186       if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
1187       {
1188         const std::string details = log->getError(n)->getMessage();
1189         log->remove(SedUnknownCoreAttribute);
1190         log->logError(SedmlFitExperimentAllowedAttributes, level, version,
1191           details, getLine(), getColumn());
1192       }
1193     }
1194   }
1195 
1196   //
1197   // type enum (use = "optional" )
1198   //
1199 
1200   std::string type;
1201   assigned = attributes.readInto("type", type);
1202 
1203   if (assigned == true)
1204   {
1205     if (type.empty() == true)
1206     {
1207       logEmptyString(type, level, version, "<SedFitExperiment>");
1208     }
1209     else
1210     {
1211       mType = ExperimentType_fromString(type.c_str());
1212 
1213       if (log && ExperimentType_isValid(mType) == 0)
1214       {
1215         std::string msg = "The type on the <SedFitExperiment> ";
1216 
1217         if (isSetId())
1218         {
1219           msg += "with id '" + getId() + "'";
1220         }
1221 
1222         msg += "is '" + type + "', which is not a valid option.";
1223 
1224         log->logError(SedmlFitExperimentTypeMustBeExperimentTypeEnum, level,
1225           version, msg, getLine(), getColumn());
1226       }
1227     }
1228   }
1229 }
1230 
1231 /** @endcond */
1232 
1233 
1234 
1235 /** @cond doxygenLibSEDMLInternal */
1236 
1237 /*
1238  * Writes the attributes to the stream
1239  */
1240 void
writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream & stream) const1241 SedFitExperiment::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER
1242   XMLOutputStream& stream) const
1243 {
1244   SedBase::writeAttributes(stream);
1245 
1246   if (isSetType() == true)
1247   {
1248     stream.writeAttribute("type", getPrefix(), ExperimentType_toString(mType));
1249   }
1250 }
1251 
1252 /** @endcond */
1253 
1254 
1255 
1256 
1257 #endif /* __cplusplus */
1258 
1259 
1260 /*
1261  * Creates a new SedFitExperiment_t using the given SED-ML Level and @ p version
1262  * values.
1263  */
1264 LIBSEDML_EXTERN
1265 SedFitExperiment_t *
SedFitExperiment_create(unsigned int level,unsigned int version)1266 SedFitExperiment_create(unsigned int level, unsigned int version)
1267 {
1268   return new SedFitExperiment(level, version);
1269 }
1270 
1271 
1272 /*
1273  * Creates and returns a deep copy of this SedFitExperiment_t object.
1274  */
1275 LIBSEDML_EXTERN
1276 SedFitExperiment_t*
SedFitExperiment_clone(const SedFitExperiment_t * sfe)1277 SedFitExperiment_clone(const SedFitExperiment_t* sfe)
1278 {
1279   if (sfe != NULL)
1280   {
1281     return static_cast<SedFitExperiment_t*>(sfe->clone());
1282   }
1283   else
1284   {
1285     return NULL;
1286   }
1287 }
1288 
1289 
1290 /*
1291  * Frees this SedFitExperiment_t object.
1292  */
1293 LIBSEDML_EXTERN
1294 void
SedFitExperiment_free(SedFitExperiment_t * sfe)1295 SedFitExperiment_free(SedFitExperiment_t* sfe)
1296 {
1297   if (sfe != NULL)
1298   {
1299     delete sfe;
1300   }
1301 }
1302 
1303 
1304 /*
1305  * Returns the value of the "id" attribute of this SedFitExperiment_t.
1306  */
1307 LIBSEDML_EXTERN
1308 char *
SedFitExperiment_getId(const SedFitExperiment_t * sfe)1309 SedFitExperiment_getId(const SedFitExperiment_t * sfe)
1310 {
1311   if (sfe == NULL)
1312   {
1313     return NULL;
1314   }
1315 
1316   return sfe->getId().empty() ? NULL : safe_strdup(sfe->getId().c_str());
1317 }
1318 
1319 
1320 /*
1321  * Returns the value of the "type" attribute of this SedFitExperiment_t.
1322  */
1323 LIBSEDML_EXTERN
1324 ExperimentType_t
SedFitExperiment_getType(const SedFitExperiment_t * sfe)1325 SedFitExperiment_getType(const SedFitExperiment_t * sfe)
1326 {
1327   if (sfe == NULL)
1328   {
1329     return SEDML_EXPERIMENTTYPE_INVALID;
1330   }
1331 
1332   return sfe->getType();
1333 }
1334 
1335 
1336 /*
1337  * Returns the value of the "type" attribute of this SedFitExperiment_t.
1338  */
1339 LIBSEDML_EXTERN
1340 char *
SedFitExperiment_getTypeAsString(const SedFitExperiment_t * sfe)1341 SedFitExperiment_getTypeAsString(const SedFitExperiment_t * sfe)
1342 {
1343   return (char*)(ExperimentType_toString(sfe->getType()));
1344 }
1345 
1346 
1347 /*
1348  * Predicate returning @c 1 (true) if this SedFitExperiment_t's "id" attribute
1349  * is set.
1350  */
1351 LIBSEDML_EXTERN
1352 int
SedFitExperiment_isSetId(const SedFitExperiment_t * sfe)1353 SedFitExperiment_isSetId(const SedFitExperiment_t * sfe)
1354 {
1355   return (sfe != NULL) ? static_cast<int>(sfe->isSetId()) : 0;
1356 }
1357 
1358 
1359 /*
1360  * Predicate returning @c 1 (true) if this SedFitExperiment_t's "type"
1361  * attribute is set.
1362  */
1363 LIBSEDML_EXTERN
1364 int
SedFitExperiment_isSetType(const SedFitExperiment_t * sfe)1365 SedFitExperiment_isSetType(const SedFitExperiment_t * sfe)
1366 {
1367   return (sfe != NULL) ? static_cast<int>(sfe->isSetType()) : 0;
1368 }
1369 
1370 
1371 /*
1372  * Sets the value of the "id" attribute of this SedFitExperiment_t.
1373  */
1374 LIBSEDML_EXTERN
1375 int
SedFitExperiment_setId(SedFitExperiment_t * sfe,const char * id)1376 SedFitExperiment_setId(SedFitExperiment_t * sfe, const char * id)
1377 {
1378   return (sfe != NULL) ? sfe->setId(id) : LIBSEDML_INVALID_OBJECT;
1379 }
1380 
1381 
1382 /*
1383  * Sets the value of the "type" attribute of this SedFitExperiment_t.
1384  */
1385 LIBSEDML_EXTERN
1386 int
SedFitExperiment_setType(SedFitExperiment_t * sfe,ExperimentType_t type)1387 SedFitExperiment_setType(SedFitExperiment_t * sfe, ExperimentType_t type)
1388 {
1389   return (sfe != NULL) ? sfe->setType(type) : LIBSEDML_INVALID_OBJECT;
1390 }
1391 
1392 
1393 /*
1394  * Sets the value of the "type" attribute of this SedFitExperiment_t.
1395  */
1396 LIBSEDML_EXTERN
1397 int
SedFitExperiment_setTypeAsString(SedFitExperiment_t * sfe,const char * type)1398 SedFitExperiment_setTypeAsString(SedFitExperiment_t * sfe, const char * type)
1399 {
1400   return (sfe != NULL) ? sfe->setType(type): LIBSEDML_INVALID_OBJECT;
1401 }
1402 
1403 
1404 /*
1405  * Unsets the value of the "id" attribute of this SedFitExperiment_t.
1406  */
1407 LIBSEDML_EXTERN
1408 int
SedFitExperiment_unsetId(SedFitExperiment_t * sfe)1409 SedFitExperiment_unsetId(SedFitExperiment_t * sfe)
1410 {
1411   return (sfe != NULL) ? sfe->unsetId() : LIBSEDML_INVALID_OBJECT;
1412 }
1413 
1414 
1415 /*
1416  * Unsets the value of the "type" attribute of this SedFitExperiment_t.
1417  */
1418 LIBSEDML_EXTERN
1419 int
SedFitExperiment_unsetType(SedFitExperiment_t * sfe)1420 SedFitExperiment_unsetType(SedFitExperiment_t * sfe)
1421 {
1422   return (sfe != NULL) ? sfe->unsetType() : LIBSEDML_INVALID_OBJECT;
1423 }
1424 
1425 
1426 /*
1427  * Returns the value of the "algorithm" element of this SedFitExperiment_t.
1428  */
1429 LIBSEDML_EXTERN
1430 const SedAlgorithm_t*
SedFitExperiment_getAlgorithm(const SedFitExperiment_t * sfe)1431 SedFitExperiment_getAlgorithm(const SedFitExperiment_t * sfe)
1432 {
1433   if (sfe == NULL)
1434   {
1435     return NULL;
1436   }
1437 
1438   return (SedAlgorithm_t*)(sfe->getAlgorithm());
1439 }
1440 
1441 
1442 /*
1443  * Predicate returning @c 1 (true) if this SedFitExperiment_t's "algorithm"
1444  * element is set.
1445  */
1446 LIBSEDML_EXTERN
1447 int
SedFitExperiment_isSetAlgorithm(const SedFitExperiment_t * sfe)1448 SedFitExperiment_isSetAlgorithm(const SedFitExperiment_t * sfe)
1449 {
1450   return (sfe != NULL) ? static_cast<int>(sfe->isSetAlgorithm()) : 0;
1451 }
1452 
1453 
1454 /*
1455  * Sets the value of the "algorithm" element of this SedFitExperiment_t.
1456  */
1457 LIBSEDML_EXTERN
1458 int
SedFitExperiment_setAlgorithm(SedFitExperiment_t * sfe,const SedAlgorithm_t * algorithm)1459 SedFitExperiment_setAlgorithm(SedFitExperiment_t * sfe,
1460                               const SedAlgorithm_t* algorithm)
1461 {
1462   return (sfe != NULL) ? sfe->setAlgorithm(algorithm) :
1463     LIBSEDML_INVALID_OBJECT;
1464 }
1465 
1466 
1467 /*
1468  * Creates a new SedAlgorithm_t object, adds it to this SedFitExperiment_t
1469  * object and returns the SedAlgorithm_t object created.
1470  */
1471 LIBSEDML_EXTERN
1472 SedAlgorithm_t*
SedFitExperiment_createAlgorithm(SedFitExperiment_t * sfe)1473 SedFitExperiment_createAlgorithm(SedFitExperiment_t* sfe)
1474 {
1475   if (sfe == NULL)
1476   {
1477     return NULL;
1478   }
1479 
1480   return (SedAlgorithm_t*)(sfe->createAlgorithm());
1481 }
1482 
1483 
1484 /*
1485  * Unsets the value of the "algorithm" element of this SedFitExperiment_t.
1486  */
1487 LIBSEDML_EXTERN
1488 int
SedFitExperiment_unsetAlgorithm(SedFitExperiment_t * sfe)1489 SedFitExperiment_unsetAlgorithm(SedFitExperiment_t * sfe)
1490 {
1491   return (sfe != NULL) ? sfe->unsetAlgorithm() : LIBSEDML_INVALID_OBJECT;
1492 }
1493 
1494 
1495 /*
1496  * Returns a ListOf_t * containing SedFitMapping_t objects from this
1497  * SedFitExperiment_t.
1498  */
1499 LIBSEDML_EXTERN
1500 SedListOf_t*
SedFitExperiment_getListOfFitMappings(SedFitExperiment_t * sfe)1501 SedFitExperiment_getListOfFitMappings(SedFitExperiment_t* sfe)
1502 {
1503   return (sfe != NULL) ? sfe->getListOfFitMappings() : NULL;
1504 }
1505 
1506 
1507 /*
1508  * Get a SedFitMapping_t from the SedFitExperiment_t.
1509  */
1510 LIBSEDML_EXTERN
1511 SedFitMapping_t*
SedFitExperiment_getFitMapping(SedFitExperiment_t * sfe,unsigned int n)1512 SedFitExperiment_getFitMapping(SedFitExperiment_t* sfe, unsigned int n)
1513 {
1514   return (sfe != NULL) ? sfe->getFitMapping(n) : NULL;
1515 }
1516 
1517 
1518 /*
1519  * Get a SedFitMapping_t from the SedFitExperiment_t based on the DataSource to
1520  * which it refers.
1521  */
1522 LIBSEDML_EXTERN
1523 SedFitMapping_t*
SedFitExperiment_getFitMappingByDataSource(SedFitExperiment_t * sfe,const char * sid)1524 SedFitExperiment_getFitMappingByDataSource(SedFitExperiment_t* sfe,
1525                                            const char *sid)
1526 {
1527   return (sfe != NULL && sid != NULL) ? sfe->getFitMappingByDataSource(sid) :
1528     NULL;
1529 }
1530 
1531 
1532 /*
1533  * Get a SedFitMapping_t from the SedFitExperiment_t based on the Target to
1534  * which it refers.
1535  */
1536 LIBSEDML_EXTERN
1537 SedFitMapping_t*
SedFitExperiment_getFitMappingByTarget(SedFitExperiment_t * sfe,const char * sid)1538 SedFitExperiment_getFitMappingByTarget(SedFitExperiment_t* sfe,
1539                                        const char *sid)
1540 {
1541   return (sfe != NULL && sid != NULL) ? sfe->getFitMappingByTarget(sid) : NULL;
1542 }
1543 
1544 
1545 /*
1546  * Get a SedFitMapping_t from the SedFitExperiment_t based on the PointWeight
1547  * to which it refers.
1548  */
1549 LIBSEDML_EXTERN
1550 SedFitMapping_t*
SedFitExperiment_getFitMappingByPointWeight(SedFitExperiment_t * sfe,const char * sid)1551 SedFitExperiment_getFitMappingByPointWeight(SedFitExperiment_t* sfe,
1552                                             const char *sid)
1553 {
1554   return (sfe != NULL && sid != NULL) ? sfe->getFitMappingByPointWeight(sid) :
1555     NULL;
1556 }
1557 
1558 
1559 /*
1560  * Adds a copy of the given SedFitMapping_t to this SedFitExperiment_t.
1561  */
1562 LIBSEDML_EXTERN
1563 int
SedFitExperiment_addFitMapping(SedFitExperiment_t * sfe,const SedFitMapping_t * sfm)1564 SedFitExperiment_addFitMapping(SedFitExperiment_t* sfe,
1565                                const SedFitMapping_t* sfm)
1566 {
1567   return (sfe != NULL) ? sfe->addFitMapping(sfm) : LIBSEDML_INVALID_OBJECT;
1568 }
1569 
1570 
1571 /*
1572  * Get the number of SedFitMapping_t objects in this SedFitExperiment_t.
1573  */
1574 LIBSEDML_EXTERN
1575 unsigned int
SedFitExperiment_getNumFitMappings(SedFitExperiment_t * sfe)1576 SedFitExperiment_getNumFitMappings(SedFitExperiment_t* sfe)
1577 {
1578   return (sfe != NULL) ? sfe->getNumFitMappings() : SEDML_INT_MAX;
1579 }
1580 
1581 
1582 /*
1583  * Creates a new SedFitMapping_t object, adds it to this SedFitExperiment_t
1584  * object and returns the SedFitMapping_t object created.
1585  */
1586 LIBSEDML_EXTERN
1587 SedFitMapping_t*
SedFitExperiment_createFitMapping(SedFitExperiment_t * sfe)1588 SedFitExperiment_createFitMapping(SedFitExperiment_t* sfe)
1589 {
1590   return (sfe != NULL) ? sfe->createFitMapping() : NULL;
1591 }
1592 
1593 
1594 /*
1595  * Removes the nth SedFitMapping_t from this SedFitExperiment_t and returns a
1596  * pointer to it.
1597  */
1598 LIBSEDML_EXTERN
1599 SedFitMapping_t*
SedFitExperiment_removeFitMapping(SedFitExperiment_t * sfe,unsigned int n)1600 SedFitExperiment_removeFitMapping(SedFitExperiment_t* sfe, unsigned int n)
1601 {
1602   return (sfe != NULL) ? sfe->removeFitMapping(n) : NULL;
1603 }
1604 
1605 
1606 /*
1607  * Predicate returning @c 1 (true) if all the required attributes for this
1608  * SedFitExperiment_t object have been set.
1609  */
1610 LIBSEDML_EXTERN
1611 int
SedFitExperiment_hasRequiredAttributes(const SedFitExperiment_t * sfe)1612 SedFitExperiment_hasRequiredAttributes(const SedFitExperiment_t * sfe)
1613 {
1614   return (sfe != NULL) ? static_cast<int>(sfe->hasRequiredAttributes()) : 0;
1615 }
1616 
1617 
1618 
1619 
1620 LIBSEDML_CPP_NAMESPACE_END
1621 
1622 
1623