1 22 23 package org.xquark.extractor.algebra; 24 25 import java.util.List ; 26 import java.util.Map ; 27 28 import org.xquark.extractor.common.SqlWrapperException; 29 import org.xquark.extractor.sql.SqlExpression; 30 import org.xquark.jdbc.typing.DbType; 31 32 public class Attribute extends Expression 33 { 34 private static final String RCSRevision = "$Revision: 1.8 $"; 35 private static final String RCSName = "$Name: $"; 36 37 38 protected org.xquark.extractor.metadata.Attribute _attribute; 39 40 44 public Attribute(org.xquark.extractor.metadata.Attribute attribute) 45 { 46 setAttribute(attribute); 47 } 48 49 synchronized Object clone(Map clonedExprs) throws CloneNotSupportedException 50 { 51 53 Object retVal = super.clone(clonedExprs); 54 55 clonedExprs.put(this, retVal); 56 return retVal; 58 } 59 60 65 public org.xquark.extractor.metadata.Attribute getAttribute() 66 { 67 return _attribute; 68 } 69 70 75 public void setAttribute(org.xquark.extractor.metadata.Attribute aAttribute) 76 { 77 _attribute = aAttribute; 78 } 79 80 public String getName () { 81 return _attribute.getName(); 82 } 83 84 public String getAlias () { 85 return _attribute.getAlias(); 86 } 87 88 public SqlType getType() 89 { 90 return _type; 91 } 92 93 public DbType getPrimitiveType() 94 { 95 return _attribute.getMappingInfo().getDBType(); 96 } 97 98 public List getOperands() 99 { 100 return null; 101 } 102 103 public String getTableName() 104 { 105 return _attribute.getFather().getName(); 106 } 107 108 public String getSchemaName() 109 { 110 return _attribute.getFather().getFather().getName(); 111 } 112 113 public String getCatalogName() 114 { 115 return _attribute.getFather().getFather().getFather().getName(); 116 } 117 118 public String getFullName() 119 { 120 return _attribute.getFullName(); 121 } 122 123 public String pprint() 124 { 125 return getName(); 126 } 127 128 public SqlExpression accept (GenSqlVisitor visitor) throws SqlWrapperException 129 { 130 return visitor.visit(this); 131 } 132 133 public void accept (AlgebraVisitor visitor) throws SqlWrapperException 134 { 135 visitor.visit(this); 136 } 137 138 143 public boolean deepEquals(Object o) 144 { 145 if (o instanceof Attribute) 146 { 147 Attribute att = (Attribute)o; 148 return _attribute.equals(att.getAttribute()); } 150 return false; 151 } 152 } 153 | Popular Tags |