1 21 22 package org.apache.derby.iapi.sql.dictionary; 23 24 import org.apache.derby.iapi.error.StandardException; 25 import org.apache.derby.iapi.services.sanity.SanityManager; 26 27 import org.apache.derby.catalog.UUID; 28 29 import org.apache.derby.iapi.error.StandardException; 30 import org.apache.derby.iapi.services.sanity.SanityManager; 31 32 import java.util.ArrayList ; 33 import java.util.Iterator ; 34 35 38 39 public class ColumnDescriptorList extends ArrayList 40 { 41 47 public void add(UUID tableID, ColumnDescriptor column) 48 { 49 58 add(column); 59 } 60 61 69 public ColumnDescriptor getColumnDescriptor(UUID tableID, 70 String columnName) 71 { 72 ColumnDescriptor returnValue = null; 73 74 for (Iterator iterator = iterator(); iterator.hasNext(); ) 75 { 76 ColumnDescriptor columnDescriptor = (ColumnDescriptor) iterator.next(); 77 78 if ( columnName.equals( columnDescriptor.getColumnName() ) && 79 tableID.equals( columnDescriptor.getReferencingUUID() ) ) 80 { 81 returnValue = columnDescriptor; 82 break; 83 } 84 } 85 86 return returnValue; 87 } 88 89 97 public ColumnDescriptor getColumnDescriptor(UUID tableID, int columnID) 98 { 99 ColumnDescriptor returnValue = null; 100 101 for (Iterator iterator = iterator(); iterator.hasNext(); ) 102 { 103 ColumnDescriptor columnDescriptor = (ColumnDescriptor) iterator.next(); 104 if ( ( columnID == columnDescriptor.getPosition() ) && 105 tableID.equals( columnDescriptor.getReferencingUUID() ) ) 106 { 107 returnValue = columnDescriptor; 108 break; 109 } 110 } 111 112 return returnValue; 113 } 114 115 122 public ColumnDescriptor elementAt(int n) 123 { 124 return (ColumnDescriptor) get(n); 125 } 126 127 133 public String [] getColumnNames() 134 { 135 String strings[] = new String [size()]; 136 137 int size = size(); 138 139 for (int index = 0; index < size; index++) 140 { 141 ColumnDescriptor columnDescriptor = elementAt(index); 142 strings[index] = columnDescriptor.getColumnName(); 143 } 144 return strings; 145 } 146 } 147 | Popular Tags |