1 package com.daffodilwoods.daffodildb.server.sql99.token; 2 3 import java.math.*; 4 5 import com.daffodilwoods.daffodildb.server.sql99.common.*; 6 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 7 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 8 import com.daffodilwoods.daffodildb.utils.byteconverter.*; 9 import com.daffodilwoods.daffodildb.utils.field.*; 10 import com.daffodilwoods.database.resource.*; 11 12 public class approximatenumericliteral extends AbstractClassExpressionPrimary implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, unsignednumericliteral, TypeConstants, Datatypes { 13 14 public exponent _exponent0; 15 public erule _erule1; 16 public mantissa _mantissa2; 17 private ColumnDetails cd; 18 private BigDecimal identifier; 19 private byte[] retruningBytes = null; 20 private FieldBase fieldBase; 21 22 public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent) throws DException { 23 return null; 24 } 25 26 public Object run(Object object) throws com.daffodilwoods.database.resource.DException { 27 if (fieldBase == null) { 28 String result = ( (FieldBase) _mantissa2.run(object)).getObject() + "E" + ( (FieldBase) _exponent0.run(object)).getObject(); 29 fieldBase = new FieldLiteral(new java.math.BigDecimal (result), BIGDECIMAL); 30 } 31 return fieldBase; 32 } 33 34 public ColumnDetails[] getColumnDetails() throws DException { 35 ColumnDetails[] columns = _mantissa2.getColumnDetails(); 36 columns[0].setType(CONSTANT); 37 columns[0].setDatatype(BIGDECIMAL); 38 cd = columns[0]; 39 return columns; 40 } 41 42 public Object [] getParameters(Object object) throws DException { 43 return null; 44 } 45 46 public ParameterInfo[] getParameterInfo() throws DException { 47 ParameterInfo parameterInfo = new ParameterInfo(); 48 parameterInfo.setDataType(Datatypes.BIGDECIMAL); 49 return new ParameterInfo[] {parameterInfo}; 50 } 51 52 public int getType() { 53 return OTHERS; 54 } 55 56 private byte[] getAppropriateBytes() throws DException { 57 int datatype = cd.getDatatype(); 58 switch (datatype) { 59 case INT: 60 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 61 case TINYINT: 62 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 63 case INTEGER: 64 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 65 case LONG: 66 return CCzufDpowfsufs.getBytes(new Long (identifier.longValue())); 67 case SHORT: 68 return CCzufDpowfsufs.getBytes(new Short (identifier.shortValue())); 69 case SMALLINT: 70 return CCzufDpowfsufs.getBytes(new Short (identifier.shortValue())); 71 case BYTE: 72 return new byte[] {identifier.byteValue()}; 73 case FLOAT: 74 return CCzufDpowfsufs.getBytes(new Float (identifier.floatValue())); 75 case DOUBLE: 76 return CCzufDpowfsufs.getBytes(new Double (identifier.doubleValue())); 77 case BIGDECIMAL: 78 return CCzufDpowfsufs.getBytes(identifier); 79 default: 80 throw new DException("DSE514", new Object [] {new Integer (datatype)}); 81 } 82 } 83 84 public AbstractRowValueExpression[] getChilds() { 85 return new AbstractRowValueExpression[] {}; 86 } 87 88 public String toString() { 89 StringBuffer sb = new StringBuffer (); 90 sb.append(" "); 91 sb.append(_mantissa2); sb.append(_erule1); sb.append(_exponent0); return sb.toString(); 95 } 96 97 public Object clone() throws CloneNotSupportedException { 98 approximatenumericliteral tempClass = new approximatenumericliteral(); 99 tempClass._exponent0 = (exponent) _exponent0.clone(); 100 tempClass._erule1 = (erule) _erule1.clone(); 101 tempClass._mantissa2 = (mantissa) _mantissa2.clone(); 102 return tempClass; 103 } 104 105 public int getCardinality() throws DException { 106 return 1; 107 } 108 109 public ByteComparison getByteComparison(Object object) throws DException { 110 return new ByteComparison(false, new int[] {BIGDECIMAL}); 111 } 112 113 public byte[][] getByte(_VariableValues variableValues) throws DException { 114 throw new UnsupportedOperationException ("Not Supported yet"); 115 } 116 117 public Object getObject(_VariableValues variableValues) throws DException { 118 throw new UnsupportedOperationException ("Not Supported yet"); 119 } 120 } 121 | Popular Tags |