1 16 17 package org.apache.commons.betwixt.schema; 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 27 public class Dbms 28 { 29 private String kind; 30 private ArrayList dbidCollection; 31 32 public Dbms() 33 { 34 dbidCollection = new ArrayList (); 35 } 36 37 public Dbms(String kind) 38 { 39 System.out.println("kind constructor called"); 40 setKind(kind); 41 } 42 43 public void addDbid(Dbid dbid) 44 { 45 dbidCollection.add(dbid); 46 } 47 48 public List getDbids() { 49 return this.dbidCollection; 50 } 51 52 public void setKind(String kind) 53 { 54 this.kind = kind; 55 } 56 57 public String getKind() 58 { 59 return this.kind; 60 } 61 62 public boolean equals(Object object) 63 { 64 if (object == null) { 65 return false; 66 } 67 68 if (object instanceof Dbms) { 69 Dbms dbms = (Dbms) object; 70 if (dbms.getKind().equals(this.getKind())) { 71 int count = 0; 72 Iterator it = dbms.getDbids().iterator(); 73 while ( it.hasNext() ) { 74 if (count >= dbidCollection.size() ) { 75 return false; 76 } 77 if (! it.next().equals( dbidCollection.get(count++) ) ) { 78 return false; 79 } 80 } 81 82 return true; 83 } 84 } 85 return false; 86 } 87 88 public String toString() { 89 return "[DBMS: name='" + getKind() + "']"; 90 } 91 } 92 93 | Popular Tags |