001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 011public class Association extends SBase { 012 private long swigCPtr; 013 014 protected Association(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.Association_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(Association obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (Association obj) 026 { 027 long ptr = 0; 028 029 if (obj != null) 030 { 031 ptr = obj.swigCPtr; 032 obj.swigCMemOwn = false; 033 } 034 035 return ptr; 036 } 037 038 protected void finalize() { 039 delete(); 040 } 041 042 public synchronized void delete() { 043 if (swigCPtr != 0) { 044 if (swigCMemOwn) { 045 swigCMemOwn = false; 046 libsbmlJNI.delete_Association(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public Association(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 054 this(libsbmlJNI.new_Association__SWIG_0(level, version, pkgVersion), true); 055 } 056 057 public Association(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 058 this(libsbmlJNI.new_Association__SWIG_1(level, version), true); 059 } 060 061 public Association(long level) throws org.sbml.libsbml.SBMLConstructorException { 062 this(libsbmlJNI.new_Association__SWIG_2(level), true); 063 } 064 065 public Association() throws org.sbml.libsbml.SBMLConstructorException { 066 this(libsbmlJNI.new_Association__SWIG_3(), true); 067 } 068 069 public Association(XMLNode node, FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 070 this(libsbmlJNI.new_Association__SWIG_4(XMLNode.getCPtr(node), node, FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 071 } 072 073 public Association(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_Association__SWIG_5(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true); 075 } 076 077 public Association(Association source) throws org.sbml.libsbml.SBMLConstructorException { 078 this(libsbmlJNI.new_Association__SWIG_6(Association.getCPtr(source), source), true); 079 } 080 081 public int getType() { 082 return libsbmlJNI.Association_getType(swigCPtr, this); 083 } 084 085 public boolean isSetType() { 086 return libsbmlJNI.Association_isSetType(swigCPtr, this); 087 } 088 089 public int setType(int type) { 090 return libsbmlJNI.Association_setType(swigCPtr, this, type); 091 } 092 093 public int unsetType() { 094 return libsbmlJNI.Association_unsetType(swigCPtr, this); 095 } 096 097 public String getReference() { 098 return libsbmlJNI.Association_getReference(swigCPtr, this); 099 } 100 101 public boolean isSetReference() { 102 return libsbmlJNI.Association_isSetReference(swigCPtr, this); 103 } 104 105 public int setReference(String reference) { 106 return libsbmlJNI.Association_setReference(swigCPtr, this, reference); 107 } 108 109 public int unsetReference() { 110 return libsbmlJNI.Association_unsetReference(swigCPtr, this); 111 } 112 113 public int addGene(String id) { 114 return libsbmlJNI.Association_addGene(swigCPtr, this, id); 115 } 116 117 public long getNumAssociations() { 118 return libsbmlJNI.Association_getNumAssociations(swigCPtr, this); 119 } 120 121 public int addAssociation(Association association) { 122 return libsbmlJNI.Association_addAssociation(swigCPtr, this, Association.getCPtr(association), association); 123 } 124 125 public int removeAssociation(int index) { 126 return libsbmlJNI.Association_removeAssociation(swigCPtr, this, index); 127 } 128 129 public int clearAssociations() { 130 return libsbmlJNI.Association_clearAssociations(swigCPtr, this); 131 } 132 133 public Association createAnd() { 134 long cPtr = libsbmlJNI.Association_createAnd(swigCPtr, this); 135 return (cPtr == 0) ? null : new Association(cPtr, false); 136 } 137 138 public Association createOr() { 139 long cPtr = libsbmlJNI.Association_createOr(swigCPtr, this); 140 return (cPtr == 0) ? null : new Association(cPtr, false); 141 } 142 143 public Association createGene(String reference) { 144 long cPtr = libsbmlJNI.Association_createGene__SWIG_0(swigCPtr, this, reference); 145 return (cPtr == 0) ? null : new Association(cPtr, false); 146 } 147 148 public Association createGene() { 149 long cPtr = libsbmlJNI.Association_createGene__SWIG_1(swigCPtr, this); 150 return (cPtr == 0) ? null : new Association(cPtr, false); 151 } 152 153 public XMLNode toXML() { 154 return new XMLNode(libsbmlJNI.Association_toXML(swigCPtr, this), true); 155 } 156 157 158/** 159 * Returns the XML element name of this object. 160 * <p> 161 * This is overridden by subclasses to return a string appropriate to the 162 * SBML component. For example, {@link Model} defines it as returning 163 * <code>'model'</code>, {@link CompartmentType} defines it as returning <code>'compartmentType'</code>, 164 * and so on. 165 */ public 166 String getElementName() { 167 return libsbmlJNI.Association_getElementName(swigCPtr, this); 168 } 169 170 171/** 172 * Creates and returns a deep copy of this {@link SBase} object. 173 * <p> 174 * @return a (deep) copy of this {@link SBase} object. 175 */ public 176 Association cloneObject() { 177 long cPtr = libsbmlJNI.Association_cloneObject(swigCPtr, this); 178 return (cPtr == 0) ? null : new Association(cPtr, true); 179 } 180 181 182/** 183 * Returns the libSBML type code for this object. 184 * <p> 185 * This method may return the type code of this SBML object, or it may 186 * return {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. This 187 * is because subclasses of {@link SBase} are not required to implement this 188 * method to return a type code. This method is meant primarily for the 189 * LibSBML C interface, in which class and subclass information is not 190 * readily available. 191 * <p> 192 * @return the SBML object type code 193 * of this SBML object or 194 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (the default). 195 * <p> 196 * @see #getElementName() 197 * @see #getPackageName() 198 */ public 199 int getTypeCode() { 200 return libsbmlJNI.Association_getTypeCode(swigCPtr, this); 201 } 202 203 public static Association parseInfixAssociation(String association) { 204 long cPtr = libsbmlJNI.Association_parseInfixAssociation(association); 205 return (cPtr == 0) ? null : new Association(cPtr, false); 206 } 207 208 public String toInfix() { 209 return libsbmlJNI.Association_toInfix(swigCPtr, this); 210 } 211 212}