home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1998 September / maximum-cd-1998-09.iso / Hotmetal / hm4ev.exe / applets.z / NetBignum.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-19  |  3.2 KB  |  142 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5. import symjava.lang.Bignum;
  6. import symjava.sql.SQLException;
  7.  
  8. class NetBignum extends NumberField {
  9.    Bignum _bigVal;
  10.  
  11.    int getType() {
  12.       return 83;
  13.    }
  14.  
  15.    void readData(ServerObject var1) throws SQLException, IOException, ErrorException {
  16.       String var2 = ((NetString)var1).getString();
  17.       this._bigVal = new Bignum(var2);
  18.    }
  19.  
  20.    void writeData(DataOutputStream var1) throws IOException {
  21.       try {
  22.          NetString var2 = new NetString(this.getString());
  23.          var2.write(var1);
  24.       } catch (SQLException var3) {
  25.          throw new IOException(((Throwable)var3).getMessage());
  26.       }
  27.    }
  28.  
  29.    public String getString() throws SQLException {
  30.       return ((Field)this).isNull() ? null : this._bigVal.toString();
  31.    }
  32.  
  33.    public boolean getBoolean() throws SQLException {
  34.       if (((Field)this).isNull()) {
  35.          return false;
  36.       } else {
  37.          int var1 = this._bigVal.intValue();
  38.          return var1 != 0;
  39.       }
  40.    }
  41.  
  42.    public byte getByte() throws SQLException {
  43.       if (((Field)this).isNull()) {
  44.          return 0;
  45.       } else {
  46.          int var1 = this._bigVal.intValue();
  47.          return (byte)var1;
  48.       }
  49.    }
  50.  
  51.    public short getShort() throws SQLException {
  52.       if (((Field)this).isNull()) {
  53.          return 0;
  54.       } else {
  55.          int var1 = this._bigVal.intValue();
  56.          return (short)var1;
  57.       }
  58.    }
  59.  
  60.    public int getInt() throws SQLException {
  61.       return ((Field)this).isNull() ? 0 : this._bigVal.intValue();
  62.    }
  63.  
  64.    public long getLong() throws SQLException {
  65.       return ((Field)this).isNull() ? 0L : this._bigVal.longValue();
  66.    }
  67.  
  68.    public float getFloat() throws SQLException {
  69.       return ((Field)this).isNull() ? 0.0F : this._bigVal.floatValue();
  70.    }
  71.  
  72.    public double getDouble() throws SQLException {
  73.       return ((Field)this).isNull() ? (double)0.0F : this._bigVal.doubleValue();
  74.    }
  75.  
  76.    public Bignum getBignum(int var1) throws SQLException {
  77.       return ((Field)this).isNull() ? null : new Bignum(this._bigVal, var1);
  78.    }
  79.  
  80.    public void setBoolean(boolean var1) throws SQLException {
  81.       if (var1) {
  82.          this._bigVal = new Bignum(1);
  83.       } else {
  84.          this._bigVal = new Bignum(0);
  85.       }
  86.  
  87.       super._null = false;
  88.    }
  89.  
  90.    public void setByte(byte var1) throws SQLException {
  91.       this._bigVal = new Bignum(var1);
  92.       super._null = false;
  93.    }
  94.  
  95.    public void setShort(short var1) throws SQLException {
  96.       this._bigVal = new Bignum(var1);
  97.       super._null = false;
  98.    }
  99.  
  100.    public void setInt(int var1) throws SQLException {
  101.       this._bigVal = new Bignum(var1);
  102.       super._null = false;
  103.    }
  104.  
  105.    public void setLong(long var1) throws SQLException {
  106.       this._bigVal = new Bignum(var1);
  107.       super._null = false;
  108.    }
  109.  
  110.    public void setFloat(float var1) throws SQLException {
  111.       this._bigVal = new Bignum((double)var1, 0);
  112.       super._null = false;
  113.    }
  114.  
  115.    public void setDouble(double var1) throws SQLException {
  116.       this._bigVal = new Bignum(var1, 0);
  117.       super._null = false;
  118.    }
  119.  
  120.    public void setBignum(Bignum var1) throws SQLException {
  121.       this._bigVal = var1;
  122.       super._null = false;
  123.    }
  124.  
  125.    public void setString(String var1) throws SQLException {
  126.       this._bigVal = new Bignum(var1);
  127.       super._null = false;
  128.    }
  129.  
  130.    public int getSQLType() {
  131.       return 2;
  132.    }
  133.  
  134.    public Object getObject() throws SQLException {
  135.       return new Bignum(this._bigVal);
  136.    }
  137.  
  138.    public void setObject(Object var1) throws SQLException {
  139.       this.setBignum((Bignum)var1);
  140.    }
  141. }
  142.