001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.10 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * MIRIAM-compliant data about a model's history. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. This class is not prescribed by 017the SBML specifications, although it is used to implement features 018defined in SBML. 019</p> 020 021 <p> 022 * The SBML specification beginning with Level 2 Version 2 defines 023 * a standard approach to recording optional model history and model creator 024 * information in a form that complies with MIRIAM (<a target='_blank' 025 * href='http://www.nature.com/nbt/journal/v23/n12/abs/nbt1156.html'>'Minimum 026 * Information Requested in the Annotation of biochemical Models'</a>, 027 * <i>Nature Biotechnology</i>, vol. 23, no. 12, Dec. 2005). LibSBML 028 * provides the {@link ModelHistory} class as a convenient high-level interface for 029 * working with model history data. 030 <p> 031 * {@link Model} histories in SBML consist of one or more <em>model creators</em>, 032 * a single date of <em>creation</em>, and one or more <em>modification</em> dates. 033 * The overall XML form of this data takes the following form: 034 <p> 035 <pre class='fragment'> 036 <dc:creator> 037 <rdf:Bag> 038 <rdf:li rdf:parseType='Resource'> 039 <span style='background-color: #d0eed0'>+++</span> 040 <vCard:N rdf:parseType='Resource'> 041 <vCard:Family><span style='background-color: #bbb'>family name</span></vCard:Family> 042 <vCard:Given><span style='background-color: #bbb'>given name</span></vCard:Given> 043 </vCard:N> 044 <span style='background-color: #d0eed0'>+++</span> 045 <span style='border-bottom: 2px dotted #888'><vCard:EMAIL><span style='background-color: #bbb'>email address</span></vCard:EMAIL></span> 046 <span style='background-color: #d0eed0'>+++</span> 047 <span style='border-bottom: 2px dotted #888'><vCard:ORG rdf:parseType='Resource'></span> 048 <span style='border-bottom: 2px dotted #888'><vCard:Orgname><span style='background-color: #bbb'>organization name</span></vCard:Orgname></span> 049 <span style='border-bottom: 2px dotted #888'></vCard:ORG></span> 050 <span style='background-color: #d0eed0'>+++</span> 051 </rdf:li> 052 <span style='background-color: #edd'>...</span> 053 </rdf:Bag> 054 </dc:creator> 055 <dcterms:created rdf:parseType='Resource'> 056 <dcterms:W3CDTF><span style='background-color: #bbb'>creation date</span></dcterms:W3CDTF> 057 </dcterms:created> 058 <dcterms:modified rdf:parseType='Resource'> 059 <dcterms:W3CDTF><span style='background-color: #bbb'>modification date</span></dcterms:W3CDTF> 060 </dcterms:modified> 061 <span style='background-color: #edd'>...</span> 062 </pre> 063 <p> 064 * In the template above, the <span style='border-bottom: 2px dotted #888'>underlined</span> 065 * portions are optional, the symbol 066 * <span class='code' style='background-color: #d0eed0'>+++</span> is a placeholder 067 * for either no content or valid XML content that is not defined by 068 * the annotation scheme, and the ellipses 069 * <span class='code' style='background-color: #edd'>...</span> 070 * are placeholders for zero or more elements of the same form as the 071 * immediately preceding element. The various placeholders for content, namely 072 * <span class='code' style='background-color: #bbb'>family name</span>, 073 * <span class='code' style='background-color: #bbb'>given name</span>, 074 * <span class='code' style='background-color: #bbb'>email address</span>, 075 * <span class='code' style='background-color: #bbb'>organization</span>, 076 * <span class='code' style='background-color: #bbb'>creation date</span>, and 077 * <span class='code' style='background-color: #bbb'>modification date</span> 078 * are data that can be filled in using the various methods on 079 * the {@link ModelHistory} class described below. 080 <p> 081 * @see ModelCreator 082 * @see Date 083 */ 084 085public class ModelHistory { 086 private long swigCPtr; 087 protected boolean swigCMemOwn; 088 089 protected ModelHistory(long cPtr, boolean cMemoryOwn) 090 { 091 swigCMemOwn = cMemoryOwn; 092 swigCPtr = cPtr; 093 } 094 095 protected static long getCPtr(ModelHistory obj) 096 { 097 return (obj == null) ? 0 : obj.swigCPtr; 098 } 099 100 protected static long getCPtrAndDisown (ModelHistory obj) 101 { 102 long ptr = 0; 103 104 if (obj != null) 105 { 106 ptr = obj.swigCPtr; 107 obj.swigCMemOwn = false; 108 } 109 110 return ptr; 111 } 112 113 protected void finalize() { 114 delete(); 115 } 116 117 public synchronized void delete() { 118 if (swigCPtr != 0) { 119 if (swigCMemOwn) { 120 swigCMemOwn = false; 121 libsbmlJNI.delete_ModelHistory(swigCPtr); 122 } 123 swigCPtr = 0; 124 } 125 } 126 127 /** 128 * Equality comparison method for ModelHistory. 129 * <p> 130 * Because the Java methods for libSBML are actually wrappers around code 131 * implemented in C++ and C, certain operations will not behave as 132 * expected. Equality comparison is one such case. An instance of a 133 * libSBML object class is actually a <em>proxy object</em> 134 * wrapping the real underlying C/C++ object. The normal <code>==</code> 135 * equality operator in Java will <em>only compare the Java proxy objects</em>, 136 * not the underlying native object. The result is almost never what you 137 * want in practical situations. Unfortunately, Java does not provide a 138 * way to override <code>==</code>. 139 * <p> 140 * The alternative that must be followed is to use the 141 * <code>equals()</code> method. The <code>equals</code> method on this 142 * class overrides the default java.lang.Object one, and performs an 143 * intelligent comparison of instances of objects of this class. The 144 * result is an assessment of whether two libSBML Java objects are truly 145 * the same underlying native-code objects. 146 * <p> 147 * The use of this method in practice is the same as the use of any other 148 * Java <code>equals</code> method. For example, 149 * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns 150 * <code>true</code> if <em>a</em> and <em>b</em> are references to the 151 * same underlying object. 152 * 153 * @param sb a reference to an object to which the current object 154 * instance will be compared 155 * 156 * @return <code>true</code> if <code>sb</code> refers to the same underlying 157 * native object as this one, <code>false</code> otherwise 158 */ 159 public boolean equals(Object sb) 160 { 161 if ( this == sb ) 162 { 163 return true; 164 } 165 return swigCPtr == getCPtr((ModelHistory)(sb)); 166 } 167 168 /** 169 * Returns a hashcode for this ModelHistory object. 170 * 171 * @return a hash code usable by Java methods that need them. 172 */ 173 public int hashCode() 174 { 175 return (int)(swigCPtr^(swigCPtr>>>32)); 176 } 177 178 179/** 180 * Creates a new {@link ModelHistory} object. 181 */ public 182 ModelHistory() { 183 this(libsbmlJNI.new_ModelHistory__SWIG_0(), true); 184 } 185 186 187/** 188 * Copy constructor; creates a copy of this {@link ModelHistory} object. 189 <p> 190 * @param orig the object to copy. 191 */ public 192 ModelHistory(ModelHistory orig) { 193 this(libsbmlJNI.new_ModelHistory__SWIG_1(ModelHistory.getCPtr(orig), orig), true); 194 } 195 196 197/** 198 * Creates and returns a deep copy of this {@link ModelHistory} object. 199 <p> 200 * @return the (deep) copy of this {@link ModelHistory} object. 201 */ public 202 ModelHistory cloneObject() { 203 long cPtr = libsbmlJNI.ModelHistory_cloneObject(swigCPtr, this); 204 return (cPtr == 0) ? null : new ModelHistory(cPtr, true); 205 } 206 207 208/** 209 * Returns the 'creation date' portion of this {@link ModelHistory} object. 210 <p> 211 * @return a {@link Date} object representing the creation date stored in 212 * this {@link ModelHistory} object. 213 */ public 214 Date getCreatedDate() { 215 long cPtr = libsbmlJNI.ModelHistory_getCreatedDate(swigCPtr, this); 216 return (cPtr == 0) ? null : new Date(cPtr, false); 217 } 218 219 220/** 221 * Returns the 'modified date' portion of this {@link ModelHistory} object. 222 <p> 223 * Note that in the MIRIAM format for annotations, there can be multiple 224 * modification dates. The libSBML {@link ModelHistory} class supports this by 225 * storing a list of 'modified date' values. If this {@link ModelHistory} object 226 * contains more than one 'modified date' value in the list, this method 227 * will return the first one in the list. 228 <p> 229 * @return a {@link Date} object representing the date of modification 230 * stored in this {@link ModelHistory} object. 231 */ public 232 Date getModifiedDate() { 233 long cPtr = libsbmlJNI.ModelHistory_getModifiedDate__SWIG_0(swigCPtr, this); 234 return (cPtr == 0) ? null : new Date(cPtr, false); 235 } 236 237 238/** 239 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 240 * {@link ModelHistory}'s 'creation date' is set. 241 <p> 242 * @return <code>true</code> if the creation date value of this {@link ModelHistory} is 243 * set, <code>false</code> otherwise. 244 */ public 245 boolean isSetCreatedDate() { 246 return libsbmlJNI.ModelHistory_isSetCreatedDate(swigCPtr, this); 247 } 248 249 250/** 251 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 252 * {@link ModelHistory}'s 'modified date' is set. 253 <p> 254 * @return <code>true</code> if the modification date value of this {@link ModelHistory} 255 * object is set, <code>false</code> otherwise. 256 */ public 257 boolean isSetModifiedDate() { 258 return libsbmlJNI.ModelHistory_isSetModifiedDate(swigCPtr, this); 259 } 260 261 262/** 263 * Sets the creation date of this {@link ModelHistory} object. 264 <p> 265 * @param date a {@link Date} object representing the date to which the 'created 266 * date' portion of this {@link ModelHistory} should be set. 267 <p> 268 * <p> 269 * @return integer value indicating success/failure of the 270 * function. The possible values 271 * returned by this function are: 272 * <ul> 273 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 274 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 275 * </ul> 276 */ public 277 int setCreatedDate(Date date) { 278 return libsbmlJNI.ModelHistory_setCreatedDate(swigCPtr, this, Date.getCPtr(date), date); 279 } 280 281 282/** 283 * Sets the modification date of this {@link ModelHistory} object. 284 <p> 285 * @param date a {@link Date} object representing the date to which the 'modified 286 * date' portion of this {@link ModelHistory} should be set. 287 <p> 288 * <p> 289 * @return integer value indicating success/failure of the 290 * function. The possible values 291 * returned by this function are: 292 * <ul> 293 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 294 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 295 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 296 * </ul> 297 */ public 298 int setModifiedDate(Date date) { 299 return libsbmlJNI.ModelHistory_setModifiedDate(swigCPtr, this, Date.getCPtr(date), date); 300 } 301 302 303/** 304 * Adds a copy of a {@link Date} object to the list of 'modified date' values 305 * stored in this {@link ModelHistory} object. 306 <p> 307 * In the MIRIAM format for annotations, there can be multiple 308 * modification dates. The libSBML {@link ModelHistory} class supports this by 309 * storing a list of 'modified date' values. 310 <p> 311 * @param date a {@link Date} object representing the 'modified date' that should 312 * be added to this {@link ModelHistory} object. 313 <p> 314 * <p> 315 * @return integer value indicating success/failure of the 316 * function. The possible values 317 * returned by this function are: 318 * <ul> 319 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 320 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 321 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 322 * </ul> 323 */ public 324 int addModifiedDate(Date date) { 325 return libsbmlJNI.ModelHistory_addModifiedDate(swigCPtr, this, Date.getCPtr(date), date); 326 } 327 328 329/** 330 * Returns the list of 'modified date' values (as {@link Date} objects) stored in 331 * this {@link ModelHistory} object. 332 <p> 333 * In the MIRIAM format for annotations, there can be multiple 334 * modification dates. The libSBML {@link ModelHistory} class supports this by 335 * storing a list of 'modified date' values. 336 <p> 337 * @return the list of modification dates for this {@link ModelHistory} object. 338 */ public 339 DateList getListModifiedDates() { 340 long cPtr = libsbmlJNI.ModelHistory_getListModifiedDates(swigCPtr, this); 341 return (cPtr == 0) ? null : new DateList(cPtr, true); 342} 343 344 345/** 346 * Get the nth {@link Date} object in the list of 'modified date' values stored 347 * in this {@link ModelHistory} object. 348 <p> 349 * In the MIRIAM format for annotations, there can be multiple 350 * modification dates. The libSBML {@link ModelHistory} class supports this by 351 * storing a list of 'modified date' values. 352 <p> 353 * @return the nth {@link Date} in the list of ModifiedDates of this 354 * {@link ModelHistory}. 355 */ public 356 Date getModifiedDate(long n) { 357 long cPtr = libsbmlJNI.ModelHistory_getModifiedDate__SWIG_1(swigCPtr, this, n); 358 return (cPtr == 0) ? null : new Date(cPtr, false); 359 } 360 361 362/** 363 * Get the number of {@link Date} objects in this {@link ModelHistory} object's list of 364 * 'modified dates'. 365 <p> 366 * In the MIRIAM format for annotations, there can be multiple 367 * modification dates. The libSBML {@link ModelHistory} class supports this by 368 * storing a list of 'modified date' values. 369 <p> 370 * @return the number of ModifiedDates in this {@link ModelHistory}. 371 */ public 372 long getNumModifiedDates() { 373 return libsbmlJNI.ModelHistory_getNumModifiedDates(swigCPtr, this); 374 } 375 376 377/** 378 * Adds a copy of a {@link ModelCreator} object to the list of 'model creator' 379 * values stored in this {@link ModelHistory} object. 380 <p> 381 * In the MIRIAM format for annotations, there can be multiple model 382 * creators. The libSBML {@link ModelHistory} class supports this by storing a 383 * list of 'model creator' values. 384 <p> 385 * @param mc the {@link ModelCreator} to add. 386 <p> 387 * <p> 388 * @return integer value indicating success/failure of the 389 * function. The possible values 390 * returned by this function are: 391 * <ul> 392 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 393 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 394 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 395 * </ul> 396 */ public 397 int addCreator(ModelCreator mc) { 398 return libsbmlJNI.ModelHistory_addCreator(swigCPtr, this, ModelCreator.getCPtr(mc), mc); 399 } 400 401 402/** 403 * Returns the list of {@link ModelCreator} objects stored in this {@link ModelHistory} 404 * object. 405 <p> 406 * In the MIRIAM format for annotations, there can be multiple model 407 * creators. The libSBML {@link ModelHistory} class supports this by storing a 408 * list of 'model creator' values. 409 <p> 410 * @return the list of {@link ModelCreator} objects. 411 */ public 412 ModelCreatorList getListCreators() { 413 long cPtr = libsbmlJNI.ModelHistory_getListCreators(swigCPtr, this); 414 return (cPtr == 0) ? null : new ModelCreatorList(cPtr, true); 415} 416 417 418/** 419 * Get the nth {@link ModelCreator} object stored in this {@link ModelHistory} object. 420 <p> 421 * In the MIRIAM format for annotations, there can be multiple model 422 * creators. The libSBML {@link ModelHistory} class supports this by storing a 423 * list of 'model creator' values. 424 <p> 425 * @return the nth {@link ModelCreator} object. 426 */ public 427 ModelCreator getCreator(long n) { 428 long cPtr = libsbmlJNI.ModelHistory_getCreator(swigCPtr, this, n); 429 return (cPtr == 0) ? null : new ModelCreator(cPtr, false); 430 } 431 432 433/** 434 * Get the number of {@link ModelCreator} objects stored in this {@link ModelHistory} 435 * object. 436 <p> 437 * In the MIRIAM format for annotations, there can be multiple model 438 * creators. The libSBML {@link ModelHistory} class supports this by storing a 439 * list of 'model creator' values. 440 <p> 441 * @return the number of ModelCreators objects. 442 */ public 443 long getNumCreators() { 444 return libsbmlJNI.ModelHistory_getNumCreators(swigCPtr, this); 445 } 446 447 448/** 449 * Predicate returning <code>true</code> if all the required elements for this 450 * {@link ModelHistory} object have been set. 451 <p> 452 * The required elements for a {@link ModelHistory} object are 'created 453 * name', 'modified date', and at least one 'model creator'. 454 <p> 455 * @return a boolean value indicating whether all the required 456 * elements for this object have been defined. 457 */ public 458 boolean hasRequiredAttributes() { 459 return libsbmlJNI.ModelHistory_hasRequiredAttributes(swigCPtr, this); 460 } 461 462 463/** * @internal */ public 464 boolean hasBeenModified() { 465 return libsbmlJNI.ModelHistory_hasBeenModified(swigCPtr, this); 466 } 467 468 469/** * @internal */ public 470 void resetModifiedFlags() { 471 libsbmlJNI.ModelHistory_resetModifiedFlags(swigCPtr, this); 472 } 473 474}