1 23 24 31 package org.enhydra.dods.trans; 32 33 import java.util.ArrayList ; 34 35 38 public class Index { 39 40 43 protected ArrayList indColumn = new ArrayList (); 44 45 48 protected String id = null; 49 50 55 protected boolean unique = false; 56 57 62 protected boolean clustered = false; 63 64 67 public Index() { 68 this.id = null; 69 this.unique = false; 70 } 71 72 78 public Index(String id, boolean unique) { 79 this.id = id; 80 this.unique = unique; 81 } 82 83 88 public void id(String id) { 89 this.id = id; 90 } 91 92 97 public void isUnique(boolean unique) { 98 this.unique = unique; 99 } 100 101 106 public void isClustered(boolean clustered) { 107 this.clustered = clustered; 108 } 109 110 115 public void addIndexColumn(String id) { 116 indColumn.add(new String (id)); 117 } 118 119 124 public int size() { 125 return indColumn.size(); 126 } 127 128 133 public String id() { 134 return id; 135 } 136 137 142 public boolean isUnique() { 143 return unique; 144 } 145 146 151 public boolean isClustered() { 152 return clustered; 153 } 154 155 160 public ArrayList indexColumns() { 161 return indColumn; 162 } 163 164 171 public String indexColumn(int index) { 172 return (String ) indColumn.get(index); 173 } 174 175 180 public String toString() { 181 StringBuffer ret = new StringBuffer ("id=").append(id).append(" unique=").append(unique).append(" index columns: "); 182 183 for (int i = 0; i < indColumn.size(); i++) { 184 ret.append(indColumn.get(i)).append(" "); 185 } 186 return ret.toString(); 187 } 188 189 public static void main(String [] args) { 190 Index ind = new Index("MeinIndexName1", true); 191 192 ind.addIndexColumn("KEYVALUE"); 193 ind.addIndexColumn("ATTRTYPE"); 194 System.out.println("Index: \n" + ind); 195 } 196 } 197 | Popular Tags |