1 24 25 package com.mckoi.database.interpret; 26 27 import java.util.ArrayList ; 28 import com.mckoi.database.*; 29 30 35 36 public final class AlterTableAction 37 implements java.io.Serializable , StatementTreeObject, Cloneable { 38 39 static final long serialVersionUID = -3180332341627416727L; 40 41 44 private ArrayList elements; 45 46 49 private String action; 50 51 54 public AlterTableAction() { 55 elements = new ArrayList (); 56 } 57 58 61 public void setAction(String str) { 62 this.action = str; 63 } 64 65 68 public void addElement(Object ob) { 69 elements.add(ob); 70 } 71 72 75 public String getAction() { 76 return action; 77 } 78 79 82 public ArrayList getElements() { 83 return elements; 84 } 85 86 89 public Object getElement(int n) { 90 return elements.get(n); 91 } 92 93 public void prepareExpressions(ExpressionPreparer preparer) 95 throws DatabaseException { 96 for (int i = 0; i < elements.size(); ++i) { 98 Object ob = elements.get(i); 99 if (ob instanceof String ) { 100 } 102 else if (ob instanceof Expression) { 103 ((Expression) ob).prepare(preparer); 104 } 105 else if (ob instanceof StatementTreeObject) { 106 ((StatementTreeObject) ob).prepareExpressions(preparer); 107 } 108 else { 109 throw new DatabaseException( 110 "Unrecognised expression: " + ob.getClass()); 111 } 112 } 113 } 114 115 public Object clone() throws CloneNotSupportedException { 116 AlterTableAction v = (AlterTableAction) super.clone(); 118 ArrayList cloned_elements = new ArrayList (); 119 v.elements = cloned_elements; 120 121 for (int i = 0; i < elements.size(); ++i) { 122 Object ob = elements.get(i); 123 if (ob instanceof String ) { 124 } 126 else if (ob instanceof Expression) { 127 ob = ((Expression) ob).clone(); 128 } 129 else if (ob instanceof StatementTreeObject) { 130 ob = ((StatementTreeObject) ob).clone(); 131 } 132 else { 133 throw new CloneNotSupportedException (ob.getClass().toString()); 134 } 135 cloned_elements.add(ob); 136 } 137 138 return v; 139 } 140 141 } 142 | Popular Tags |