1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.commons.betwixt.schema; |
18 |
|
|
19 |
|
import java.beans.IntrospectionException; |
20 |
|
import java.util.Collection; |
21 |
|
import java.util.Iterator; |
22 |
|
|
23 |
|
import org.apache.commons.betwixt.ElementDescriptor; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
public class LocalComplexType extends ComplexType { |
31 |
|
|
32 |
|
|
33 |
0 |
public LocalComplexType() {} |
34 |
|
|
35 |
|
public LocalComplexType(TranscriptionConfiguration configuration, ElementDescriptor elementDescriptor, Schema schema) throws IntrospectionException { |
36 |
65 |
super(configuration, elementDescriptor, schema); |
37 |
65 |
} |
38 |
|
|
39 |
|
public boolean equals(Object obj) { |
40 |
676 |
boolean result = false; |
41 |
676 |
if (obj instanceof GlobalComplexType) { |
42 |
156 |
GlobalComplexType complexType = (GlobalComplexType) obj; |
43 |
156 |
result = |
44 |
156 |
equalContents(attributes, complexType.attributes) && |
45 |
0 |
equalContents(elements, complexType.elements); |
46 |
|
|
47 |
|
} |
48 |
676 |
return result; |
49 |
|
} |
50 |
|
|
51 |
|
|
52 |
|
private boolean equalContents(Collection one, Collection two) |
53 |
|
{ |
54 |
|
|
55 |
156 |
if (one.size() != two.size()) { |
56 |
156 |
return false; |
57 |
|
} |
58 |
0 |
for (Iterator it=one.iterator();it.hasNext();) { |
59 |
0 |
Object object = it.next(); |
60 |
0 |
if (!two.contains(object)) { |
61 |
0 |
return false; |
62 |
|
} |
63 |
|
} |
64 |
0 |
return true; |
65 |
|
} |
66 |
|
|
67 |
|
public int hashCode() { |
68 |
130 |
return 0; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
private boolean isEqual(String one, String two) { |
78 |
0 |
boolean result = false; |
79 |
0 |
if (one == null) { |
80 |
0 |
result = (two == null); |
81 |
|
} |
82 |
|
else |
83 |
|
{ |
84 |
0 |
result = one.equals(two); |
85 |
|
} |
86 |
|
|
87 |
0 |
return result; |
88 |
|
} |
89 |
|
|
90 |
|
public String toString() { |
91 |
0 |
StringBuffer buffer = new StringBuffer(); |
92 |
0 |
buffer.append("<xsd:complexType>"); |
93 |
0 |
buffer.append("<xsd:sequence>"); |
94 |
0 |
for (Iterator it=elements.iterator(); it.hasNext();) { |
95 |
0 |
buffer.append(it.next()); |
96 |
|
} |
97 |
0 |
buffer.append("</xsd:sequence>"); |
98 |
|
|
99 |
0 |
for (Iterator it=attributes.iterator(); it.hasNext();) { |
100 |
0 |
buffer.append(it.next()); |
101 |
|
} |
102 |
0 |
buffer.append("</xsd:complexType>"); |
103 |
0 |
return buffer.toString(); |
104 |
|
} |
105 |
|
} |