001package gudusoft.gsqlparser.nodes;
002
003import java.util.ArrayList;
004
005/**
006 * Column identity clause.
007 *
008 */
009public class TIdentityClause extends TParseTreeNode {
010
011    private TExpression columnExpr;
012
013    public TExpression getColumnExpr() {
014        return columnExpr;
015    }
016
017    private ArrayList<TSequenceOption> identityOptions = null;
018
019    public ArrayList<TSequenceOption> getIdentityOptions() {
020        return identityOptions;
021    }
022
023    /**
024     * Seed value for Dameng IDENTITY(seed,step) form.
025     */
026    private TConstant seedValue;
027
028    public TConstant getSeedValue() {
029        return seedValue;
030    }
031
032    public void setSeedValue(TConstant seedValue) {
033        this.seedValue = seedValue;
034    }
035
036    /**
037     * Increment (step) value for Dameng IDENTITY(seed,step) form.
038     */
039    private TConstant incrementValue;
040
041    public TConstant getIncrementValue() {
042        return incrementValue;
043    }
044
045    public void setIncrementValue(TConstant incrementValue) {
046        this.incrementValue = incrementValue;
047    }
048
049    public void init(Object arg1){
050        if (arg1 instanceof TExpression){
051            columnExpr = (TExpression)arg1;
052        }else{
053            identityOptions = (ArrayList<TSequenceOption>)arg1;
054        }
055
056    }
057
058    public void accept(TParseTreeVisitor v){
059        v.preVisit(this);
060        v.postVisit(this);
061    }
062
063    public void acceptChildren(TParseTreeVisitor v) {
064        v.preVisit(this);
065        if (identityOptions != null){
066            for(TSequenceOption option:identityOptions){
067                option.acceptChildren(v);
068            }
069        }
070        v.postVisit(this);
071    }
072}