1 package com.daffodilwoods.daffodildb.server.sql99.expression.numericvalueexpression; 2 3 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 4 import com.daffodilwoods.daffodildb.server.serversystem.*; 5 import com.daffodilwoods.daffodildb.server.sql99.common.*; 6 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 7 import com.daffodilwoods.daffodildb.server.sql99.token.*; 8 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 9 import com.daffodilwoods.daffodildb.utils.*; 10 import com.daffodilwoods.daffodildb.utils.field.*; 11 import com.daffodilwoods.database.resource.*; 12 13 public class atanfunction extends AbstractNumericValueFunction { 14 15 public parennumericvalueexpression _parennumericvalueexpression0; 16 public SNONRESERVEDWORD136444255 _SNONRESERVEDWORD1364442551; 17 18 protected Object getResult(int type, Object object) throws DException { 19 if (object == null) { 20 return new FieldLiteral(FieldUtility.NULLBUFFERRANGE, Datatype.DOUBLE); 21 } else if (type <= 15) { 22 Number number = (Number ) object; 23 return new FieldLiteral(new Double (Math.atan(number.doubleValue())), 24 Datatype.DOUBLE); 25 } 26 throw new DException("DSE4108", 27 new Object [] {StaticClass.getDataTypeName(type), 28 "ATAN"}); 29 42 } 43 44 82 83 public AbstractRowValueExpression[] getChilds() { 84 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {_parennumericvalueexpression0}; 85 return childs; 86 } 87 88 public String getType() throws DException { 89 return (String ) _SNONRESERVEDWORD1364442551.run(null); 90 } 91 92 public String toString() { 93 StringBuffer sb = new StringBuffer (); 94 sb.append(" "); 95 sb.append(_SNONRESERVEDWORD1364442551); 96 sb.append(_parennumericvalueexpression0); 97 return sb.toString(); 98 } 99 100 public Object clone() throws CloneNotSupportedException { 101 atanfunction tempClass = new atanfunction(); 102 tempClass._parennumericvalueexpression0 = (parennumericvalueexpression) _parennumericvalueexpression0.clone(); 103 tempClass._SNONRESERVEDWORD1364442551 = (SNONRESERVEDWORD136444255) _SNONRESERVEDWORD1364442551.clone(); 104 return tempClass; 105 } 106 107 public ParameterInfo[] getParameterInfo() throws DException { 108 ParameterInfo[] paramInfo = super.getParameterInfo(); 109 for (int i = 0; i < paramInfo.length; i++) { 110 if (paramInfo[i].getQuestionMark()) { 111 paramInfo[i].setDataType(Datatypes.DOUBLE); 112 paramInfo[i].setName("ATAN Arg"); 113 } 114 } 115 return paramInfo; 116 } 117 118 public ByteComparison getByteComparison(Object object) throws DException { 119 ByteComparison byteComparison = new ByteComparison(false, new int[] {DOUBLE}); 120 byteComparison.setSize(getColumnSize(object)); 121 return byteComparison; 122 } 123 124 public _Reference[] checkSemantic(_ServerSession parent) throws DException { 125 _Reference[] ref = super.checkSemantic(parent); 126 if(ref!=null) { 127 return ref; 128 } 129 int type = _parennumericvalueexpression0.getByteComparison(parent).getDataTypes()[0]; 130 if (type == -1 || type <= 15) { 131 return ref; 132 } 133 throw new DException("DSE4108", 134 new Object [] {StaticClass.getDataTypeName(type), 135 "ATAN"}); 136 } 137 public int getColumnSize(Object object) throws DException { 138 return Datatypes.DOUBLESIZE; 139 } 140 141 } 142 | Popular Tags |