001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.ESqlClause;
004import gudusoft.gsqlparser.TCustomSqlStatement;
005
006
007/**
008 * array access of plsql.
009*/
010public class TArrayAccess extends TParseTreeNode {
011    private TObjectName arrayName = null;
012    private TExpression index1 = null;
013    private TExpression index2 = null;
014
015    public TExpression getIndex3() {
016        return index3;
017    }
018
019    private TExpression index3 = null;
020
021    public TObjectName getArrayName() {
022        return arrayName;
023    }
024
025    public TExpression getIndex1() {
026        return index1;
027    }
028
029    public TExpression getIndex2() {
030        return index2;
031    }
032
033    public TObjectName getPropertyName() {
034        return propertyName;
035    }
036
037    private TObjectName propertyName = null;
038
039    public void init(Object arg1,Object arg2,Object arg3,Object arg4)
040    {
041        arrayName = (TObjectName)arg1;
042        if (arg2 instanceof TExpressionList){
043            index1 = ((TExpressionList)arg2).getExpression(0);
044        }else if (arg3 instanceof TExpression){
045           index2 = (TExpression)arg3;
046        }
047
048        if (arg4 != null){
049            if (arg4 instanceof TObjectName){
050                propertyName = (TObjectName)arg4;
051            }else if (arg4 instanceof TExpression){
052                index3 = (TExpression)arg4;
053            }
054        }
055        
056    }
057
058    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
059
060        if (index1 != null){
061            index1.doParse(psql,plocation);
062        }
063
064        if (index2 != null){
065            index2.doParse(psql,plocation);
066        }
067
068        if (index3 != null){
069            index3.doParse(psql,plocation);
070        }
071    }
072
073    public void accept(TParseTreeVisitor v){
074        v.preVisit(this);
075        v.postVisit(this);
076    }
077
078    public void acceptChildren(TParseTreeVisitor v){
079        v.preVisit(this);
080        v.postVisit(this);
081    }
082
083    public void setArrayName(TObjectName arrayName) {
084        this.arrayName = arrayName;
085    }
086
087    public void setIndex1(TExpression index1) {
088        this.index1 = index1;
089    }
090
091    public void setIndex2(TExpression index2) {
092        this.index2 = index2;
093    }
094
095    public void setIndex3(TExpression index3) {
096        this.index3 = index3;
097    }
098
099    public void setPropertyName(TObjectName propertyName) {
100        this.propertyName = propertyName;
101    }
102}