KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > types > SQLReal


1 /*
2
3    Derby - Class org.apache.derby.iapi.types.SQLReal
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.types;
23
24 import org.apache.derby.iapi.reference.SQLState;
25
26 import org.apache.derby.iapi.services.io.ArrayInputStream;
27
28 import org.apache.derby.iapi.types.BooleanDataValue;
29 import org.apache.derby.iapi.types.DataValueDescriptor;
30 import org.apache.derby.iapi.types.NumberDataValue;
31 import org.apache.derby.iapi.types.StringDataValue;
32 import org.apache.derby.iapi.types.TypeId;
33
34 import org.apache.derby.iapi.services.io.Storable;
35 import org.apache.derby.iapi.services.io.StoredFormatIds;
36
37 import org.apache.derby.iapi.error.StandardException;
38
39 import org.apache.derby.iapi.services.sanity.SanityManager;
40 import org.apache.derby.iapi.types.NumberDataType;
41 import org.apache.derby.iapi.types.SQLBoolean;
42
43 import org.apache.derby.iapi.services.cache.ClassSize;
44
45 import java.io.ObjectOutput JavaDoc;
46 import java.io.ObjectInput JavaDoc;
47 import java.io.IOException JavaDoc;
48
49 import java.sql.ResultSet JavaDoc;
50 import java.sql.PreparedStatement JavaDoc;
51 import java.sql.SQLException JavaDoc;
52
53 /**
54  * SQLReal satisfies the DataValueDescriptor
55  * interfaces (i.e., OrderableDataType). It implements a real column,
56  * e.g. for storing a column value; it can be specified
57  * when constructed to not allow nulls. Nullability cannot be changed
58  * after construction, as it affects the storage size and mechanism.
59  * <p>
60  * Because OrderableDataType is a subtype of ValueColumn,
61  * SQLReal can play a role in either a ValueColumn/Row
62  * or a OrderableDataType/Row, interchangeably.
63  * <p>
64  * We assume the store has a flag for nullness of the value,
65  * and simply return a 0-length array for the stored form
66  * when the value is null.
67  * <p>
68  * PERFORMANCE: There are likely alot of performance improvements
69  * possible for this implementation -- it new's Float
70  * more than it probably wants to.
71  * <p>
72  * This is called SQLReal even though it maps to the Java float type,
73  * to avoid confusion with whether it maps to the SQL float type or not.
74  * It doesn't, it maps to the SQL real type.
75  * <p>
76  * This is modeled after SQLSmallint.
77  * @see SQLSmallint
78  *
79  * @author ames
80  */

81 public final class SQLReal
82     extends NumberDataType
83 {
84
85     /*
86      * DataValueDescriptor interface
87      * (mostly implemented in DataType)
88      */

89
90
91     // JDBC is lax in what it permits and what it
92
// returns, so we are similarly lax
93

94     /**
95      * @see DataValueDescriptor#getInt
96      * @exception StandardException thrown on failure to convert
97      */

98     public int getInt() throws StandardException
99     {
100         if ((value > (((double) Integer.MAX_VALUE + 1.0d))) || (value < (((double) Integer.MIN_VALUE) - 1.0d)))
101             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "INTEGER");
102         return (int) value;
103     }
104
105     /**
106      * @see DataValueDescriptor#getByte
107      * @exception StandardException thrown on failure to convert
108      */

109     public byte getByte() throws StandardException
110     {
111         if ((value > (((double) Byte.MAX_VALUE + 1.0d))) || (value < (((double) Byte.MIN_VALUE) - 1.0d)))
112             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "TINYINT");
113         return (byte) value;
114     }
115
116     /**
117      * @exception StandardException thrown on failure to convert
118      * @see DataValueDescriptor#getShort
119      */

120     public short getShort() throws StandardException
121     {
122         if ((value > (((double) Short.MAX_VALUE + 1.0d))) || (value < (((double) Short.MIN_VALUE) - 1.0d)))
123             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "SMALLINT");
124         return (short) value;
125     }
126
127     /**
128      * @see DataValueDescriptor#getLong
129      * @exception StandardException thrown on failure to convert
130      */

131     public long getLong() throws StandardException
132     {
133         if ((value > (((double) Long.MAX_VALUE + 1.0d))) || (value < (((double) Long.MIN_VALUE) - 1.0d)))
134             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "BIGINT");
135         return (long) value;
136     }
137
138     /**
139      * @see DataValueDescriptor#getFloat
140      */

141     public float getFloat()
142     {
143         return value;
144     }
145
146     /**
147      * @see DataValueDescriptor#getDouble
148      */

149     public double getDouble()
150     {
151         return (double) value;
152     }
153
154     /**
155      * DOUBLE implementation. Convert to a BigDecimal using getString.
156      */

157     public int typeToBigDecimal()
158     {
159         return java.sql.Types.CHAR;
160     }
161     // for lack of a specification: 0 or null is false,
162
// all else is true
163
/**
164      * @see DataValueDescriptor#getBoolean
165      */

166     public boolean getBoolean()
167     {
168         return (value != 0);
169     }
170
171     /**
172      * @see DataValueDescriptor#getString
173      */

174     public String JavaDoc getString()
175     {
176         if (isNull())
177             return null;
178         else
179             return Float.toString(value);
180     }
181
182     /**
183      * @see DataValueDescriptor#getLength
184      */

185     public int getLength()
186     {
187         return REAL_LENGTH;
188     }
189
190     /**
191      * @see DataValueDescriptor#getObject
192      */

193     public Object JavaDoc getObject()
194     {
195         if (isNull())
196             return null;
197         else
198             return new Float JavaDoc(value);
199     }
200
201     // this is for DataType's error generator
202
public String JavaDoc getTypeName()
203     {
204         return TypeId.REAL_NAME;
205     }
206
207     /*
208      * Storable interface, implies Externalizable, TypedFormat
209      */

210
211
212     /**
213         Return my format identifier.
214
215         @see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId
216     */

217     public int getTypeFormatId() {
218         return StoredFormatIds.SQL_REAL_ID;
219     }
220
221     /*
222      * see if the real value is null.
223      */

224     /** @see Storable#isNull */
225     public boolean isNull()
226     {
227         return isnull;
228     }
229
230     public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
231
232         // never called when value is null
233
if (SanityManager.DEBUG)
234             SanityManager.ASSERT(! isNull());
235
236         out.writeFloat(value);
237     }
238
239     /** @see java.io.Externalizable#readExternal */
240     public void readExternal(ObjectInput JavaDoc in) throws IOException JavaDoc {
241         // setValue(in.readFloat()); // can throw StandardException which we can't pass on
242
// assume we wrote the value, so we can read it without problem, for now.
243
value = in.readFloat();
244         isnull = false;
245     }
246     public void readExternalFromArray(ArrayInputStream in) throws IOException JavaDoc {
247         // setValue(in.readFloat()); // can throw StandardException which we can't pass on
248
// assume we wrote the value, so we can read it without problem, for now.
249
value = in.readFloat();
250         isnull = false;
251     }
252
253     /**
254      * @see Storable#restoreToNull
255      *
256      */

257     public void restoreToNull()
258     {
259         value = 0;
260         isnull = true;
261     }
262
263
264     /** @exception StandardException Thrown on error */
265     protected int typeCompare(DataValueDescriptor arg) throws StandardException
266     {
267         /* neither are null, get the value */
268
269         // jsk: should use double? depends on DB2
270
float thisValue = this.getFloat();
271         float otherValue = NumberDataType.normalizeREAL(arg.getFloat()); // could gotten from "any type", may not be a float
272

273         if (thisValue == otherValue)
274             return 0;
275         else if (thisValue > otherValue)
276             return 1;
277         else
278             return -1;
279     }
280
281     /*
282      * DataValueDescriptor interface
283      */

284
285     /** @see DataValueDescriptor#getClone */
286     public DataValueDescriptor getClone()
287     {
288         SQLReal ret = new SQLReal();
289         ret.value = this.value;
290         ret.isnull = this.isnull;
291         return ret;
292     }
293
294     /**
295      * @see DataValueDescriptor#getNewNull
296      */

297     public DataValueDescriptor getNewNull()
298     {
299         return new SQLReal();
300     }
301
302     /**
303      * @see DataValueDescriptor#setValueFromResultSet
304      *
305      * @exception StandardException Thrown on error
306      * @exception SQLException Thrown on error
307      */

308     public void setValueFromResultSet(ResultSet JavaDoc resultSet, int colNumber,
309                                       boolean isNullable)
310         throws StandardException, SQLException JavaDoc
311     {
312             float fv = resultSet.getFloat(colNumber);
313             if (isNullable && resultSet.wasNull())
314                 restoreToNull();
315             else
316                 setValue(fv);
317     }
318     /**
319         Set the value into a PreparedStatement.
320
321         @exception SQLException Error setting value in PreparedStatement
322     */

323     public final void setInto(PreparedStatement JavaDoc ps, int position) throws SQLException JavaDoc {
324
325         if (isNull()) {
326             ps.setNull(position, java.sql.Types.REAL);
327             return;
328         }
329
330         ps.setFloat(position, value);
331     }
332     /**
333         Set this value into a ResultSet for a subsequent ResultSet.insertRow
334         or ResultSet.updateRow. This method will only be called for non-null values.
335
336         @exception SQLException thrown by the ResultSet object
337         @exception StandardException thrown by me accessing my value.
338     */

339     public final void setInto(ResultSet JavaDoc rs, int position) throws SQLException JavaDoc, StandardException {
340         rs.updateFloat(position, value);
341     }
342
343     /*
344      * class interface
345      */

346
347     /*
348      * constructors
349      */

350
351     /** no-arg constructor, required by Formattable. */
352     // This constructor also gets used when we are
353
// allocating space for a float.
354
public SQLReal()
355     {
356         isnull = true;
357     }
358
359     public SQLReal(float val)
360         throws StandardException
361     {
362         value = NumberDataType.normalizeREAL(val);
363     }
364     public SQLReal(Float JavaDoc obj) throws StandardException {
365         if (isnull = (obj == null))
366             ;
367         else {
368             value = NumberDataType.normalizeREAL(obj.floatValue());
369         }
370     }
371
372     /**
373         @exception StandardException thrown if string not accepted
374      */

375     public void setValue(String JavaDoc theValue)
376         throws StandardException
377     {
378         if (theValue == null)
379         {
380             value = 0;
381             isnull = true;
382         }
383         else
384         {
385             // what if String is rouned to zero?
386
//System.out.println("SQLReal.setValue(String) - rounding issue?"+theValue);
387
try {
388                 setValue(Double.valueOf(theValue.trim()).doubleValue());
389             } catch (NumberFormatException JavaDoc nfe) {
390                 throw invalidFormat();
391             }
392         }
393     }
394
395     public void setValue(Number JavaDoc theValue) throws StandardException
396     {
397         if (objectNull(theValue))
398             return;
399
400         if (SanityManager.ASSERT)
401         {
402             if (!(theValue instanceof java.lang.Float JavaDoc))
403                 SanityManager.THROWASSERT("SQLReal.setValue(Number) passed a " + theValue.getClass());
404         }
405
406         setValue(theValue.floatValue());
407     }
408     /**
409         Called for an application setting this value using a BigDecimal
410     */

411     public void setBigDecimal(Number JavaDoc bigDecimal) throws StandardException
412     {
413         if (objectNull(bigDecimal))
414             return;
415
416         // Note BigDecimal.floatValue() handles the case where
417
// its value is outside the range of a float. It returns
418
// infinity values which should throw an exception in setValue(double).
419
setValue(bigDecimal.floatValue());
420         
421     }
422
423     public void setValue(float theValue)
424         throws StandardException
425     {
426         value = NumberDataType.normalizeREAL(theValue);
427         isnull = false;
428     }
429
430     public void setValue(int theValue)
431     {
432         value = theValue;
433         isnull = false;
434
435     }
436
437     public void setValue(long theValue)
438     {
439         value = theValue;
440         isnull = false;
441
442     }
443
444     /**
445         @exception StandardException if outsideRangeForReal
446      */

447     public void setValue(double theValue) throws StandardException
448     {
449         // jsk: where does this theValue come from? if some caller is rounding parsing from string
450
// we might have rounding error (different than DB2 behaviour)
451
float fv = (float) theValue;
452         // detect rounding taking place at cast time
453
if (fv == 0.0f && theValue != 0.0d) {
454             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
455         }
456         setValue(fv);
457     }
458
459     /**
460      * @see NumberDataValue#setValue
461      *
462      */

463     public void setValue(boolean theValue)
464     {
465         value = theValue?1:0;
466         isnull = false;
467     }
468
469     /**
470      * Set the value from a correctly typed Float object.
471      * @throws StandardException
472      */

473     void setObject(Object JavaDoc theValue) throws StandardException
474     {
475         setValue(((Float JavaDoc) theValue).floatValue());
476     }
477
478     protected void setFrom(DataValueDescriptor theValue) throws StandardException {
479
480             // rounding issue to solve!!!/jsk
481
//DOUBLE.getFloat() would make rounding problem if it got called here!!!
482
// need to check where it is called from!
483
if (theValue instanceof StringDataValue) {
484                 //System.out.println("\tcalling setValue(string)");
485
setValue(theValue.getString());
486             } else if (theValue instanceof SQLDouble) {
487                 //System.out.println("\tcalling setValue(double)");
488
setValue(theValue.getDouble());
489             } else {
490                 setValue(theValue.getFloat());
491             }
492     }
493
494
495     /*
496      * DataValueDescriptor interface
497      */

498
499     /** @see DataValueDescriptor#typePrecedence */
500     public int typePrecedence()
501     {
502         return TypeId.REAL_PRECEDENCE;
503     }
504
505
506     /*
507     ** SQL Operators
508     */

509
510     /**
511      * The = operator as called from the language module, as opposed to
512      * the storage module.
513      *
514      * @param left The value on the left side of the =
515      * @param right The value on the right side of the =
516      *
517      * @return A SQL boolean value telling whether the two parameters are equal
518      *
519      * @exception StandardException Thrown on error
520      */

521
522     public BooleanDataValue equals(DataValueDescriptor left,
523                             DataValueDescriptor right)
524             throws StandardException
525     {
526         return SQLBoolean.truthValue(left,
527                                      right,
528                                      left.getFloat() == right.getFloat());
529     }
530
531     /**
532      * The <> operator as called from the language module, as opposed to
533      * the storage module.
534      *
535      * @param left The value on the left side of the <>
536      * @param right The value on the right side of the <>
537      *
538      * @return A SQL boolean value telling whether the two parameters
539      * are not equal
540      *
541      * @exception StandardException Thrown on error
542      */

543
544     public BooleanDataValue notEquals(DataValueDescriptor left,
545                             DataValueDescriptor right)
546             throws StandardException
547     {
548         return SQLBoolean.truthValue(left,
549                                      right,
550                                      left.getFloat() != right.getFloat());
551     }
552
553     /**
554      * The < operator as called from the language module, as opposed to
555      * the storage module.
556      *
557      * @param left The value on the left side of the <
558      * @param right The value on the right side of the <
559      *
560      * @return A SQL boolean value telling whether the first operand is less
561      * than the second operand
562      *
563      * @exception StandardException Thrown on error
564      */

565
566     public BooleanDataValue lessThan(DataValueDescriptor left,
567                             DataValueDescriptor right)
568             throws StandardException
569     {
570         return SQLBoolean.truthValue(left,
571                                      right,
572                                      left.getFloat() < right.getFloat());
573     }
574
575     /**
576      * The > operator as called from the language module, as opposed to
577      * the storage module.
578      *
579      * @param left The value on the left side of the >
580      * @param right The value on the right side of the >
581      *
582      * @return A SQL boolean value telling whether the first operand is greater
583      * than the second operand
584      *
585      * @exception StandardException Thrown on error
586      */

587
588     public BooleanDataValue greaterThan(DataValueDescriptor left,
589                             DataValueDescriptor right)
590             throws StandardException
591     {
592         return SQLBoolean.truthValue(left,
593                                      right,
594                                      left.getFloat() > right.getFloat());
595     }
596
597     /**
598      * The <= operator as called from the language module, as opposed to
599      * the storage module.
600      *
601      * @param left The value on the left side of the <=
602      * @param right The value on the right side of the <=
603      *
604      * @return A SQL boolean value telling whether the first operand is less
605      * than or equal to the second operand
606      *
607      * @exception StandardException Thrown on error
608      */

609
610     public BooleanDataValue lessOrEquals(DataValueDescriptor left,
611                             DataValueDescriptor right)
612             throws StandardException
613     {
614         return SQLBoolean.truthValue(left,
615                                      right,
616                                      left.getFloat() <= right.getFloat());
617     }
618
619     /**
620      * The >= operator as called from the language module, as opposed to
621      * the storage module.
622      *
623      * @param left The value on the left side of the >=
624      * @param right The value on the right side of the >=
625      *
626      * @return A SQL boolean value telling whether the first operand is greater
627      * than or equal to the second operand
628      *
629      * @exception StandardException Thrown on error
630      */

631
632     public BooleanDataValue greaterOrEquals(DataValueDescriptor left,
633                             DataValueDescriptor right)
634             throws StandardException
635     {
636         return SQLBoolean.truthValue(left,
637                                      right,
638                                      left.getFloat() >= right.getFloat());
639     }
640
641
642     /**
643      * This method implements the + operator for "real + real".
644      * The operator uses DOUBLE aritmetic as DB2 does.
645      *
646      * @param addend1 One of the addends
647      * @param addend2 The other addend
648      * @param result The result of a previous call to this method, null
649      * if not called yet
650      *
651      * @return A SQLReal containing the result of the addition
652      *
653      * @exception StandardException Thrown on error
654      */

655
656     public NumberDataValue plus(NumberDataValue addend1,
657                             NumberDataValue addend2,
658                             NumberDataValue result)
659                 throws StandardException
660     {
661         if (result == null)
662         {
663             result = new SQLReal();
664         }
665
666         if (addend1.isNull() || addend2.isNull())
667         {
668             result.setToNull();
669             return result;
670         }
671
672         double dsum = addend1.getDouble() + addend2.getDouble();
673         // No need to check underflow (result rounded to 0.0),
674
// since the difference between two non-equal valid DB2 DOUBLE values is always non-zero in java.lang.Double precision.
675
result.setValue(dsum);
676
677         return result;
678     }
679
680     /**
681      * This method implements the - operator for "real - real".
682      * The operator uses DOUBLE aritmetic as DB2 does.
683      *
684      * @param left The value to be subtracted from
685      * @param right The value to be subtracted
686      * @param result The result of a previous call to this method, null
687      * if not called yet
688      *
689      * @return A SQLReal containing the result of the subtraction
690      *
691      * @exception StandardException Thrown on error
692      */

693
694     public NumberDataValue minus(NumberDataValue left,
695                             NumberDataValue right,
696                             NumberDataValue result)
697                 throws StandardException
698     {
699         if (result == null)
700         {
701             result = new SQLReal();
702         }
703
704         if (left.isNull() || right.isNull())
705         {
706             result.setToNull();
707             return result;
708         }
709
710         double ddifference = left.getDouble() - right.getDouble();
711         // No need to check underflow (result rounded to 0.0),
712
// since no difference between two valid DB2 DOUBLE values can be rounded off to 0.0 in java.lang.Double
713
result.setValue(ddifference);
714         return result;
715     }
716
717     /**
718      * This method implements the * operator for "real * real".
719      * The operator uses DOUBLE aritmetic as DB2 does.
720      *
721      * @param left The first value to be multiplied
722      * @param right The second value to be multiplied
723      * @param result The result of a previous call to this method, null
724      * if not called yet
725      *
726      * @return A SQLReal containing the result of the multiplication
727      *
728      * @exception StandardException Thrown on error
729      */

730
731     public NumberDataValue times(NumberDataValue left,
732                             NumberDataValue right,
733                             NumberDataValue result)
734                 throws StandardException
735     {
736         if (result == null)
737         {
738             result = new SQLReal();
739         }
740
741         if (left.isNull() || right.isNull())
742         {
743             result.setToNull();
744             return result;
745         }
746
747         double leftValue = left.getDouble();
748         double rightValue = right.getDouble();
749         double tempResult = leftValue * rightValue;
750         // check underflow (result rounded to 0.0)
751
if ( (tempResult == 0.0) && ( (leftValue != 0.0) && (rightValue != 0.0) ) ) {
752             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
753         }
754
755         result.setValue(tempResult);
756         return result;
757     }
758
759     /**
760      * This method implements the / operator for "real / real".
761      * The operator uses DOUBLE aritmetic as DB2 does.
762      *
763      * @param dividend The numerator
764      * @param divisor The denominator
765      * @param result The result of a previous call to this method, null
766      * if not called yet
767      *
768      * @return A SQLReal containing the result of the division
769      *
770      * @exception StandardException Thrown on error
771      */

772
773     public NumberDataValue divide(NumberDataValue dividend,
774                              NumberDataValue divisor,
775                              NumberDataValue result)
776                 throws StandardException
777     {
778         if (result == null)
779         {
780             result = new SQLReal();
781         }
782
783         if (dividend.isNull() || divisor.isNull())
784         {
785             result.setToNull();
786             return result;
787         }
788
789         double divisorValue = divisor.getDouble();
790         if (divisorValue == 0.0e0f)
791         {
792             throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO);
793         }
794
795         double dividendValue = dividend.getDouble();
796         double resultValue = dividendValue / divisorValue;
797         if (Double.isNaN(resultValue))
798         {
799             throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO);
800         }
801
802         // check underflow (result rounded to 0.0)
803
if ((resultValue == 0.0e0d) && (dividendValue != 0.0e0d)) {
804             throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.REAL_NAME);
805         }
806
807         result.setValue(resultValue);
808         return result;
809     }
810
811     /**
812      * This method implements the unary minus operator for real.
813      *
814      * @param result The result of a previous call to this method, null
815      * if not called yet
816      *
817      * @return A SQLSmalllint containing the result of the division
818      *
819      * @exception StandardException Thrown on error
820      */

821
822     public NumberDataValue minus(NumberDataValue result)
823                                     throws StandardException
824     {
825         float minusResult;
826
827         if (result == null)
828         {
829             result = new SQLReal();
830         }
831
832         if (this.isNull())
833         {
834             result.setToNull();
835             return result;
836         }
837
838         minusResult = -(this.getFloat());
839         result.setValue(minusResult);
840         return result;
841     }
842
843     /**
844      * This method implements the isNegative method.
845      * Note: This method will return true for -0.0f.
846      *
847      * @return A boolean. If this.value is negative, return true.
848      * For positive values or null, return false.
849      */

850
851     protected boolean isNegative()
852     {
853         return !isNull() && (value < 0.0f);
854     }
855
856     /*
857      * String display of value
858      */

859
860     public String JavaDoc toString()
861     {
862         if (isNull())
863             return "NULL";
864         else
865             return Float.toString(value);
866     }
867
868     /*
869      * Hash code
870      */

871     public int hashCode()
872     {
873         long longVal = (long) value;
874
875         if (longVal != value)
876         {
877             longVal = Double.doubleToLongBits(value);
878         }
879
880         return (int) (longVal ^ (longVal >> 32));
881     }
882
883     static final int REAL_LENGTH = 16;
884
885     private static final int BASE_MEMORY_USAGE = ClassSize.estimateBaseFromCatalog( SQLReal.class);
886
887     public int estimateMemoryUsage()
888     {
889         return BASE_MEMORY_USAGE;
890     }
891
892     /*
893      * object state
894      */

895     private float value;
896     private boolean isnull;
897
898 }
899
Popular Tags