001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 * This class represents a pair of numerical values where one value represents an absolute
013 * value and the other value is a relative value in percent.
014 <p>
015 * For many elements in the render extension, it is necessary to specify coordinates not in terms
016 * of absolute values, but rather in terms of relative values or even a combination of absolute
017 * and relative values.
018 * Such a pair of values where one represents an absolute value and the other represents a relative
019 * value can be expressed by a {@link RelAbsVector}.
020 <p>
021 * The relative and absolute values to initialize a {@link RelAbsVector} object can either be given as
022 * numerical datatypes (double) or as a valid value string.
023 * A value string is a combination of an absolute value and a relative value and the absolute
024 * value if given has to come first. So valid value strings would be: '5.0e3+20%', or '100%' or '4'.
025 */
026
027public class RelAbsVector {
028   private long swigCPtr;
029   protected boolean swigCMemOwn;
030
031   protected RelAbsVector(long cPtr, boolean cMemoryOwn)
032   {
033     swigCMemOwn = cMemoryOwn;
034     swigCPtr    = cPtr;
035   }
036
037   protected static long getCPtr(RelAbsVector obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (RelAbsVector obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_RelAbsVector(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067  }
068
069  
070/**
071   * Constructor with two values.
072   * First value sets the absolute value, second sets the relative value (%). 
073   <p>
074   * @param a absolute value
075   * @param a relative value in % (50 -> 50%)
076   */ public
077 RelAbsVector(double a, double r) {
078    this(libsbmlJNI.new_RelAbsVector__SWIG_0(a, r), true);
079  }
080
081  
082/**
083   * Constructor with two values.
084   * First value sets the absolute value, second sets the relative value (%). 
085   <p>
086   * @param a absolute value
087   * @param a relative value in % (50 -> 50%)
088   */ public
089 RelAbsVector(double a) {
090    this(libsbmlJNI.new_RelAbsVector__SWIG_1(a), true);
091  }
092
093  
094/**
095   * Constructor with two values.
096   * First value sets the absolute value, second sets the relative value (%). 
097   <p>
098   * @param a absolute value
099   * @param a relative value in % (50 -> 50%)
100   */ public
101 RelAbsVector() {
102    this(libsbmlJNI.new_RelAbsVector__SWIG_2(), true);
103  }
104
105  
106/**
107   * Constructor with a value string.
108   * If the string does not represent a valid value, the relative and the
109   * absolute component of the {@link RelAbsVector} are set to NaN.
110   */ public
111 RelAbsVector(String coordString) {
112    this(libsbmlJNI.new_RelAbsVector__SWIG_3(coordString), true);
113  }
114
115  
116/**
117   * Sets the relative and absolute value.
118   <p>
119   * @param abs absolute value
120   * @param rel relative value. If the relative value is omitted, it is set to 0.
121   */ public
122 void setCoordinate(double abs, double rel) {
123    libsbmlJNI.RelAbsVector_setCoordinate__SWIG_0(swigCPtr, this, abs, rel);
124  }
125
126  
127/**
128   * Sets the relative and absolute value.
129   <p>
130   * @param abs absolute value
131   * @param rel relative value. If the relative value is omitted, it is set to 0.
132   */ public
133 void setCoordinate(double abs) {
134    libsbmlJNI.RelAbsVector_setCoordinate__SWIG_1(swigCPtr, this, abs);
135  }
136
137  
138/**
139   * Sets the coordinatees from the given string.
140   * If the string does not represent a valid value, the relative and the
141   * absolute component of the {@link RelAbsVector} are set to NaN.
142   <p>
143   * @param coordString value string
144   */ public
145 void setCoordinate(String coordString) {
146    libsbmlJNI.RelAbsVector_setCoordinate__SWIG_2(swigCPtr, this, coordString);
147  }
148
149  
150/**
151   * Sets the absolute coordinate value.
152   <p>
153   * @param abs absolute value to be set
154   */ public
155 void setAbsoluteValue(double abs) {
156    libsbmlJNI.RelAbsVector_setAbsoluteValue(swigCPtr, this, abs);
157  }
158
159  
160/**
161   * Sets the relative coordinate value.
162   <p>
163   * @param rel relative value to be set
164   */ public
165 void setRelativeValue(double rel) {
166    libsbmlJNI.RelAbsVector_setRelativeValue(swigCPtr, this, rel);
167  }
168
169  
170/**
171   * Returns the absolute coordinate value.
172   <p>
173   * @return absolute value
174   */ public
175 double getAbsoluteValue() {
176    return libsbmlJNI.RelAbsVector_getAbsoluteValue(swigCPtr, this);
177  }
178
179  
180/**
181   * Returns the relative coordinate value.
182   <p>
183   * @return absolute value
184   */ public
185 double getRelativeValue() {
186    return libsbmlJNI.RelAbsVector_getRelativeValue(swigCPtr, this);
187  }
188
189}