001package gudusoft.gsqlparser.nodes; 002/* 003 * Date: 13-10-21 004 */ 005 006import gudusoft.gsqlparser.ESequenceOptionType; 007 008public class TSequenceOption extends TParseTreeNode { 009 private ESequenceOptionType sequenceOptionType; 010 private TConstant optionValue; 011 012 private TObjectName ownedBy; 013 private TTypeName dataType; 014 015 public TObjectName getOwnedBy() { 016 return ownedBy; 017 } 018 019 public TTypeName getDataType() { 020 return dataType; 021 } 022 023 public void init(Object arg1){ 024 sequenceOptionType = (ESequenceOptionType)arg1; 025 } 026 027 public TConstant getOptionValue() { 028 return optionValue; 029 } 030 031 public ESequenceOptionType getSequenceOptionType() { 032 return sequenceOptionType; 033 } 034 035 public void init(Object arg1,Object arg2){ 036 init(arg1); 037 switch (this.sequenceOptionType){ 038 case ownedBy: 039 case ownerTo: 040 case setSchema: 041 case renameTo: 042 case sequenceName: 043 this.ownedBy = (TObjectName) arg2; 044 break; 045 case asType: 046 this.dataType = (TTypeName) arg2; 047 break; 048 default: 049 if (arg2 instanceof TConstant) { 050 optionValue = (TConstant) arg2; 051 } else if (arg2 instanceof TObjectName) { 052 this.ownedBy = (TObjectName) arg2; 053 } 054 055 } 056 } 057 058 public void setSequenceOptionType(ESequenceOptionType sequenceOptionType) { 059 this.sequenceOptionType = sequenceOptionType; 060 } 061 062 public void setOptionValue(TConstant optionValue) { 063 this.optionValue = optionValue; 064 } 065 066 public void accept(TParseTreeVisitor v){ 067 v.preVisit(this); 068 v.postVisit(this); 069 } 070 071 public void acceptChildren(TParseTreeVisitor v) { 072 v.preVisit(this); 073 v.postVisit(this); 074 } 075}