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
26
27
28 public class PhysicalSchema
29 {
30
31 private ArrayList dbmsCollection;
32
33
34 private boolean autoCreate = false;
35
36 public PhysicalSchema()
37 {
38 dbmsCollection = new ArrayList();
39 }
40 public PhysicalSchema(String autoCreate)
41 {
42 this.autoCreate = autoCreate.equalsIgnoreCase("yes");
43 }
44 public void setAutocreate(String autoCreate)
45 {
46 this.autoCreate = (autoCreate.equalsIgnoreCase("yes"));
47 }
48
49 public String getAutocreate()
50 {
51 return this.autoCreate?"yes":"no";
52 }
53
54 public void addDbms(Dbms dbms)
55 {
56 dbmsCollection.add(dbms);
57 }
58
59 public List getDbmss()
60 {
61 return dbmsCollection;
62 }
63
64 public boolean equals(Object object)
65 {
66 if (object == null) {
67 return false;
68 }
69 if (object instanceof PhysicalSchema) {
70 PhysicalSchema schema = (PhysicalSchema) object;
71 if (schema.getAutocreate().equals(this.getAutocreate())) {
72 int count = 0;
73 Iterator it = schema.getDbmss().iterator();
74 while ( it.hasNext() ) {
75 if (count >= dbmsCollection.size() ) {
76 return false;
77 }
78 if (! it.next().equals( dbmsCollection.get(count++) ) ) {
79 return false;
80 }
81 }
82
83 return true;
84 }
85 }
86 return false;
87 }
88
89 public String toString() {
90 return "[PhysicalSchema] autocreate=" + getAutocreate() + " dbmass=" + getDbmss();
91 }
92 }
93