1 22 23 package org.xquark.extractor.algebra; 24 25 import org.xquark.extractor.common.SqlWrapperException; 26 import org.xquark.extractor.sql.SqlExpression; 27 import org.xquark.jdbc.typing.MappingInfo; 28 import org.xquark.schema.SimpleType; 29 30 35 public class ExternalVariable extends Literal { 36 private String _expandedName = null; 37 public MappingInfo _mappingInfo = null; 38 39 public ExternalVariable(String ns, String localName, SimpleType sType) { 40 _expandedName = getExpandedName(ns, localName); 41 if (sType != null) 42 _mappingInfo = new MappingInfo(sType); 43 } 44 45 public static String getExpandedName(String ns, String varName) { 46 StringBuffer sb = new StringBuffer (); 47 if (ns != null) { 48 sb.append('{'); 49 sb.append(ns); 50 sb.append('}'); 51 } 52 sb.append(varName); 53 return sb.toString(); 54 } 55 56 public SqlExpression accept(GenSqlVisitor visitor) throws SqlWrapperException { 57 return visitor.visit(this); 58 } 59 60 63 public String getExpandedName() { 64 return _expandedName; 65 } 66 67 public MappingInfo getMappingInfo() { 68 return _mappingInfo; 69 } 70 71 public SimpleType getSimpleType() { 72 return _mappingInfo.getXMLType(); 73 } 74 75 public void accept(AlgebraVisitor visitor) throws SqlWrapperException { 76 visitor.visit(this); 77 } 78 79 public boolean deepEquals(Object o) { 80 if (o instanceof ExternalVariable) 81 { 82 ExternalVariable cast = (ExternalVariable)o; 83 return _expandedName.equals(cast.getExpandedName()); 84 } 85 return false; 86 } 87 } 88 | Popular Tags |