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 cosfunction 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, DOUBLE); 21 } 22 if (type <= 15) { 23 return new FieldLiteral(new Double (Math.cos( ( (Number ) object).doubleValue())), Datatype.DOUBLE); 24 } 25 throw new DException("DSE4108", new Object [] {StaticClass.getDataTypeName(type), "COS"}); 26 39 } 40 41 69 70 public AbstractRowValueExpression[] getChilds() { 71 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {_parennumericvalueexpression0}; 72 return childs; 73 } 74 75 public String getType() throws DException { 76 return (String ) _SNONRESERVEDWORD1364442551.run(null); 77 } 78 79 public String toString() { 80 StringBuffer sb = new StringBuffer (); 81 sb.append(" "); 82 sb.append(_SNONRESERVEDWORD1364442551); 83 sb.append(_parennumericvalueexpression0); 84 return sb.toString(); 85 } 86 87 public Object clone() throws CloneNotSupportedException { 88 cosfunction tempClass = new cosfunction(); 89 tempClass._parennumericvalueexpression0 = (parennumericvalueexpression) _parennumericvalueexpression0.clone(); 90 tempClass._SNONRESERVEDWORD1364442551 = (SNONRESERVEDWORD136444255) _SNONRESERVEDWORD1364442551.clone(); 91 return tempClass; 92 } 93 94 public ParameterInfo[] getParameterInfo() throws DException { 95 ParameterInfo[] paramInfo = super.getParameterInfo(); 96 for (int i = 0; i < paramInfo.length; i++) { 97 if (paramInfo[i].getQuestionMark()) { 98 paramInfo[i].setDataType(Datatypes.DOUBLE); 99 paramInfo[i].setName("COS Arg"); 100 } 101 } 102 return paramInfo; 103 } 104 105 public ByteComparison getByteComparison(Object object) throws DException { 106 ByteComparison byteComparison = new ByteComparison(false, new int[] {DOUBLE}); 107 byteComparison.setSize(getColumnSize(object)); 108 return byteComparison; 109 } 110 111 public _Reference[] checkSemantic(_ServerSession parent) throws DException { 112 _Reference[] ref = super.checkSemantic(parent); 113 if(ref!=null) { 114 return ref; 115 } 116 int type = _parennumericvalueexpression0.getByteComparison(parent).getDataTypes()[0]; 117 if (type == -1 || type <= 15) { 118 return ref; 119 } 120 throw new DException("DSE4108", new Object [] {StaticClass.getDataTypeName(type), "COS"}); 121 } 122 public int getColumnSize(Object object) throws DException { 123 return Datatypes.DOUBLESIZE; 124 } 125 } 126 | Popular Tags |