1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.betwixt.schema;
19
20 import java.util.ArrayList;
21 import java.util.Iterator;
22 import java.util.List;
23
24 /***
25 * @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
26 * @version $Id: Dbms.java 438373 2006-08-30 05:17:21Z bayard $
27 */
28 public class Dbms
29 {
30 private String kind;
31 private ArrayList dbidCollection;
32
33 public Dbms()
34 {
35 dbidCollection = new ArrayList();
36 }
37
38 public Dbms(String kind)
39 {
40 System.out.println("kind constructor called");
41 setKind(kind);
42 }
43
44 public void addDbid(Dbid dbid)
45 {
46 dbidCollection.add(dbid);
47 }
48
49 public List getDbids() {
50 return this.dbidCollection;
51 }
52
53 public void setKind(String kind)
54 {
55 this.kind = kind;
56 }
57
58 public String getKind()
59 {
60 return this.kind;
61 }
62
63 public boolean equals(Object object)
64 {
65 if (object == null) {
66 return false;
67 }
68
69 if (object instanceof Dbms) {
70 Dbms dbms = (Dbms) object;
71 if (dbms.getKind().equals(this.getKind())) {
72 int count = 0;
73 Iterator it = dbms.getDbids().iterator();
74 while ( it.hasNext() ) {
75 if (count >= dbidCollection.size() ) {
76 return false;
77 }
78 if (! it.next().equals( dbidCollection.get(count++) ) ) {
79 return false;
80 }
81 }
82
83 return true;
84 }
85 }
86 return false;
87 }
88
89 public String toString() {
90 return "[DBMS: name='" + getKind() + "']";
91 }
92 }
93