001package gudusoft.gsqlparser.nodes.functions;
002
003
004import gudusoft.gsqlparser.EFunctionType;
005import gudusoft.gsqlparser.ESqlClause;
006import gudusoft.gsqlparser.TCustomSqlStatement;
007import gudusoft.gsqlparser.nodes.*;
008
009public class TFlattenFunction extends TTableFunction {
010
011    public void init(Object arg1,Object arg2){
012        functionType = EFunctionType.flatten_t;
013        functionName = ((TObjectName) arg1);
014        Args = ((TExpressionList) arg2);
015    }
016
017    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
018        for(int i=0;i< getArgs().size();i++){
019            getArgs().getExpression(i).doParse(psql,plocation);
020        }
021
022        if (withinGroup != null){
023            withinGroup.doParse(psql,plocation);
024        }
025        if (analyticFunction != null){
026            analyticFunction.doParse(psql,plocation);
027        }
028
029        if (filterClause != null){
030            filterClause.doParse(psql,plocation);
031        }
032
033        if (windowDef != null){
034            windowDef.doParse(psql,plocation);
035        }
036    }
037
038    public void accept(TParseTreeVisitor v){
039        v.preVisit(this);
040        v.postVisit(this);
041    }
042
043    public void acceptChildren(TParseTreeVisitor v) {
044        v.preVisit(this);
045        this.getFunctionName().acceptChildren(v);
046        for(int i=0;i< getArgs().size();i++){
047            getArgs().getExpression(i).acceptChildren(v);
048        }
049
050
051        if (this.getAnalyticFunction() != null){
052            this.getAnalyticFunction().acceptChildren(v);
053        }
054
055        if (this.getFilterClause() != null){
056            this.getFilterClause().acceptChildren(v);
057        }
058
059        if (this.getWindowDef()  != null){
060            this.getWindowDef().acceptChildren(v);
061        }
062
063        v.postVisit(this);
064    }
065}