1 package jimm.datavision.source; 2 import jimm.datavision.Identity; 3 import jimm.datavision.Nameable; 4 import java.util.TreeMap ; 5 import java.util.Iterator ; 6 7 16 public class Table implements Identity, Nameable { 17 18 protected DataSource dataSource; 19 protected String name; 20 protected TreeMap columns; 21 22 29 public Column findColumn(Object id) { 30 if (dataSource.getReport().caseSensitiveDatabaseNames()) 31 return (Column)columns.get(id.toString()); 32 33 String target = id.toString().toLowerCase(); 35 for (Iterator iter = columns.keySet().iterator(); iter.hasNext(); ) { 36 String key = (String )iter.next(); 37 if (target.equals(key.toLowerCase())) 38 return (Column)columns.get(key); 39 } 40 return null; 41 } 42 43 49 public Table(DataSource dataSource, String name) { 50 this.dataSource = dataSource; 51 this.name = name; 52 columns = new TreeMap (); 53 } 54 55 60 public Object getId() { return name; } 61 62 67 public String getName() { return name; } 68 69 70 public void setName(String name) { } 71 72 77 public void addColumn(Column col) { 78 columns.put(col.getId().toString(), col); 79 } 80 81 86 public Iterator columns() { return columns.values().iterator(); } 87 88 } 89 | Popular Tags |