/* Generated By:JJTree: Do not edit this line. WindowFunction.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.symbol.v7;
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion;
import org.teiid.query.parser.LanguageVisitor;
import org.teiid.query.parser.v7.Teiid7Parser;
import org.teiid.query.sql.symbol.AggregateSymbol;
import org.teiid.query.sql.symbol.Symbol;
import org.teiid.query.sql.symbol.WindowFunction;
import org.teiid.query.sql.symbol.WindowSpecification;
/**
* From Teiid Version 7, the WindowFunction extends Symbol.
* This is changed in version 8.
*/
public class Window7Function extends Symbol implements WindowFunction {
private AggregateSymbol function;
private WindowSpecification windowSpecification;
/**
* @param p
* @param id
*/
public Window7Function(ITeiidServerVersion p, int id) {
super(p, id);
}
/**
* @return the function
*/
@Override
public AggregateSymbol getFunction() {
return this.function;
}
/**
* @param function the function to set
*/
@Override
public void setFunction(AggregateSymbol function) {
this.function = function;
this.function.setWindowed(true);
}
/**
* @return the windowSpecification
*/
@Override
public WindowSpecification getWindowSpecification() {
return this.windowSpecification;
}
/**
* @param windowSpecification the windowSpecification to set
*/
@Override
public void setWindowSpecification(WindowSpecification windowSpecification) {
this.windowSpecification = windowSpecification;
}
@Override
public Class<?> getType() {
return function.getType();
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((this.function == null) ? 0 : this.function.hashCode());
result = prime * result + ((this.windowSpecification == null) ? 0 : this.windowSpecification.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;
Window7Function other = (Window7Function)obj;
if (this.function == null) {
if (other.function != null) return false;
} else if (!this.function.equals(other.function)) return false;
if (this.windowSpecification == null) {
if (other.windowSpecification != null) return false;
} else if (!this.windowSpecification.equals(other.windowSpecification)) return false;
return true;
}
/** Accept the visitor. **/
@Override
public void acceptVisitor(LanguageVisitor visitor) {
visitor.visit(this);
}
@Override
public Window7Function clone() {
Window7Function clone = new Window7Function(getTeiidVersion(), this.id);
if(getFunction() != null)
clone.setFunction(getFunction().clone());
if(getWindowSpecification() != null)
clone.setWindowSpecification(getWindowSpecification().clone());
if(getShortCanonicalName() != null)
clone.setShortCanonicalName(getShortCanonicalName());
if(getOutputName() != null)
clone.setOutputName(getOutputName());
if(getShortName() != null)
clone.setShortName(getShortName());
if(getName() != null)
clone.setName(getName());
return clone;
}
}
/* JavaCC - OriginalChecksum=da43cffa8d1927cfd8b4f378cdcfeae0 (do not edit this line) */