1 22 23 package org.xquark.extractor.xfunctions; 24 25 import java.util.List ; 26 27 import org.xquark.extractor.algebra.Expression; 28 import org.xquark.extractor.sql.SqlExpression; 29 import org.xquark.jdbc.typing.DbType; 30 31 public final class XfCast extends Expression { 32 33 private static final String RCSRevision = "$Revision: 1.6 $"; 34 private static final String RCSName = "$Name: $"; 35 36 37 Expression _expression = null; 38 DbType _targetType = null; 39 40 public XfCast() 41 { 42 } 43 44 public XfCast(Expression arg, DbType targetType) 45 { 46 setExpression(arg); 47 setTargetType(targetType); 48 } 49 50 public Expression getExpression() 51 { 52 return _expression; 53 } 54 55 public void setExpression(Expression expression) 56 { 57 _expression = expression; 58 _expression.setFather(this); 59 } 60 61 public DbType getTargetType() 62 { 63 return _targetType; 64 } 65 66 public void setTargetType(DbType targetType) 67 { 68 _targetType = targetType; 69 } 70 71 public String getName() 72 { 73 return null; 74 } 75 76 public List getOperands() 77 { 78 return null; 79 } 80 81 public boolean replaceChild(Expression oldChild, Expression newChild) 82 { 83 boolean retVal = false; 85 86 if (getExpression().equals(oldChild)) { 87 setExpression(newChild); 88 retVal = true; 89 } 90 91 return retVal; 93 } 94 95 public String pprint() 96 { 97 StringBuffer retVal = new StringBuffer (); 98 retVal.append("XfCast("); 99 retVal.append(getExpression().pprint()); 100 retVal.append(", "); 101 retVal.append(getTargetType().pprint()); 102 retVal.append(")"); 103 return retVal.toString(); 104 } 105 106 public SqlExpression accept(org.xquark.extractor.algebra.GenSqlVisitor visitor) 107 { 108 return visitor.visit(this); 109 } 110 111 public void accept(org.xquark.extractor.algebra.AlgebraVisitor visitor) 112 { 113 visitor.visit(this); 114 } 115 116 119 public boolean deepEquals(Object o) 120 { 121 if (o instanceof XfCast) 122 { 123 XfCast cast = (XfCast)o; 124 return _expression.deepEquals(cast.getExpression()) 125 && _targetType.equals(cast.getTargetType()); 126 } 127 return false; 128 } 129 } 130 131 | Popular Tags |