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