1 package com.daffodilwoods.daffodildb.server.sql99.token; 2 3 import com.daffodilwoods.daffodildb.server.sql99.common.*; 4 import com.daffodilwoods.daffodildb.server.sql99.expression.*; 5 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 6 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 7 import com.daffodilwoods.daffodildb.utils.byteconverter.*; 8 import com.daffodilwoods.daffodildb.utils.field.*; 9 import com.daffodilwoods.database.resource.*; 10 11 public class RepdigitSperiod_991726143OptRepdigit extends AbstractValueExpression implements exactnumericliteral, TypeConstants, Datatypes { 12 13 public digit[] _OptRepdigit0; 14 public Speriod_991726143 _Speriod_9917261431; 15 public digit[] _Repdigit2; 16 17 private ColumnDetails cd; 18 private java.math.BigDecimal identifier; 19 private byte[] returningBytes = null; 20 private FieldBase field; 21 22 public Object run(Object object) throws com.daffodilwoods.database.resource. 23 DException { 24 if (field == null) { 25 field = new FieldLiteral(getString(), -1); 26 } 27 return field; 28 } 29 30 private String getString() throws DException { 31 StringBuffer strbuf = new StringBuffer (); 32 for (int i = 0, length = _Repdigit2.length; i < length; i++) { 33 strbuf.append(_Repdigit2[i].run(null)); 34 } 35 strbuf.append('.'); 36 if (_OptRepdigit0 == null) { 37 strbuf.append("0"); 38 } else { 39 for (int i = 0, length = _OptRepdigit0.length; i < length; i++) { 40 strbuf.append(_OptRepdigit0[i].toString().trim()); 41 } 42 } 43 return strbuf.toString(); 44 } 45 46 public ColumnDetails[] getColumnDetails() throws DException { 47 ColumnDetails columnDetails = new ColumnDetails(); 48 columnDetails.setType(CONSTANT); 49 columnDetails.setColumnName(new String [] {getString()}); 50 51 columnDetails.setObject(this); 52 53 cd = columnDetails; 54 return new ColumnDetails[] { 55 columnDetails}; 56 } 57 58 public Object [] getParameters(Object object) throws DException { 59 return null; 60 } 61 62 public int getType() { 63 return OTHERS; 64 } 65 66 private byte[] getAppropriateBytes() throws DException { 67 int datatype = cd.getDatatype(); 68 switch (datatype) { 69 case INT: 70 case TINYINT: 71 case INTEGER: 72 case LONG: 73 case SHORT: 74 case SMALLINT: 75 case BYTE: 76 throw new DException("DSE4113", 77 new Object [] {StaticClass.getDataTypeName(datatype)}); case FLOAT: 79 return CCzufDpowfsufs.getBytes(new Float (identifier.floatValue())); 80 case DOUBLE: 81 return CCzufDpowfsufs.getBytes(new Double (identifier.doubleValue())); 82 case REAL: 83 case NUMERIC: 84 case BIGDECIMAL: 85 return CCzufDpowfsufs.getBytes(identifier); 86 default: 87 throw new DException("DSE514", new Object [] {new Integer (datatype)}); 88 } 89 } 90 91 public AbstractRowValueExpression[] getChilds() { 92 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {}; 93 return childs; 94 } 95 96 public String toString() { 97 StringBuffer sb = new StringBuffer (); 98 sb.append(" "); 99 for (int i = 0; i < _Repdigit2.length; i++) { 100 sb.append(_Repdigit2[i].toString().trim()); 101 } 102 sb.append(_Speriod_9917261431); 103 if (_OptRepdigit0 != null) { 104 for (int i = 0; i < _OptRepdigit0.length; i++) { 105 sb.append("").append(_OptRepdigit0[i].toString().trim()); 106 } 107 } 108 return sb.toString(); 109 } 110 111 public Object clone() throws CloneNotSupportedException { 112 RepdigitSperiod_991726143OptRepdigit tempClass = new 113 RepdigitSperiod_991726143OptRepdigit(); 114 if (_OptRepdigit0 != null) { 115 digit[] temp_OptRepdigit0 = new digit[_OptRepdigit0.length]; 116 for (int i = 0; i < _OptRepdigit0.length; i++) { 117 temp_OptRepdigit0[i] = (digit) _OptRepdigit0[i].clone(); 118 } 119 tempClass._OptRepdigit0 = temp_OptRepdigit0; 120 } 121 tempClass._Speriod_9917261431 = (Speriod_991726143) _Speriod_9917261431. 122 clone(); 123 digit[] temp_Repdigit2 = new digit[_Repdigit2.length]; 124 for (int i = 0; i < _Repdigit2.length; i++) { 125 temp_Repdigit2[i] = (digit) _Repdigit2[i].clone(); 126 } 127 tempClass._Repdigit2 = temp_Repdigit2; 128 return tempClass; 129 } 130 131 public int getCardinality() throws DException { 132 return 1; 133 } 134 135 public ParameterInfo[] getParameterInfo() throws DException { 136 ParameterInfo parameterInfo = new ParameterInfo(); 137 parameterInfo.setDataType(cd.getDatatype()); 138 return new ParameterInfo[] {parameterInfo}; 139 } 140 141 public ByteComparison getByteComparison(Object object) throws DException { 142 return new ByteComparison(true, new int[] {cd.getDatatype()}); 143 } 144 145 } 146 | Popular Tags |