/* Generated By:JJTree: Do not edit this line. ProjectedColumn.java Version 4.3 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=,NODE_EXTENDS=,NODE_FACTORY=TeiidNodeFactory,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.teiid.query.sql.lang; import org.teiid.designer.query.sql.lang.IProjectedColumn; import org.teiid.designer.runtime.version.spi.ITeiidServerVersion; import org.teiid.query.parser.LanguageVisitor; import org.teiid.query.parser.TeiidNodeFactory.ASTNodes; import org.teiid.query.sql.symbol.ElementSymbol; /** * */ public class ProjectedColumn extends SimpleNode implements IProjectedColumn<LanguageVisitor> { private String name; private String type; private ElementSymbol symbol; /** * @param p * @param id */ public ProjectedColumn(ITeiidServerVersion p, int id) { super(p, id); } /** * @return symbol */ public ElementSymbol getSymbol() { if (symbol == null) { this.symbol = createASTNode(ASTNodes.ELEMENT_SYMBOL); } this.symbol.setName(name); this.symbol.setType(getDataTypeService().getDataTypeClass(type)); return symbol; } /** * @return the name */ public String getName() { return this.name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; getSymbol(); } /** * @return the type */ public String getType() { return this.type; } /** * @param type the type to set */ public void setType(String type) { this.type = type; getSymbol(); } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); result = prime * result + ((this.symbol == null) ? 0 : this.symbol.hashCode()); result = prime * result + ((this.type == null) ? 0 : this.type.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ProjectedColumn other = (ProjectedColumn)obj; if (this.name == null) { if (other.name != null) return false; } else if (!this.name.equals(other.name)) return false; if (this.symbol == null) { if (other.symbol != null) return false; } else if (!this.symbol.equals(other.symbol)) return false; if (this.type == null) { if (other.type != null) return false; } else if (!this.type.equals(other.type)) return false; return true; } /** Accept the visitor. **/ @Override public void acceptVisitor(LanguageVisitor visitor) { visitor.visit(this); } @Override public ProjectedColumn clone() { ProjectedColumn clone = new ProjectedColumn(getTeiidVersion(), this.id); if(getName() != null) clone.setName(getName()); if(getType() != null) clone.setType(getType()); return clone; } } /* JavaCC - OriginalChecksum=991e5fb319eb5a871b3cd33dacf6a7ed (do not edit this line) */