/* */ {
/* 975 */ if (ep.isValueList()) {
/* 976 */ return new Tree.Term(ep) {
/* */ protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
/* 978 */ TypeRef t = (TypeRef)this.val$ep.getTypes().get(0);
/* 979 */ LocalElement e = parent.element();
/* 980 */ e.block();
/* 981 */ QName tn = t.getTagName();
/* 982 */ e.name(tn.getLocalPart());
/* 983 */ com.sun.xml.bind.v2.schemagen.xmlschema.List lst = e.simpleType().list();
/* 984 */ XmlSchemaGenerator.Namespace.this.writeTypeRef(lst, t, "itemType");
/* 985 */ XmlSchemaGenerator.Namespace.this.elementFormDefault.writeForm(e, tn);
/* 986 */ writeOccurs(e, (isOptional) || (!this.val$ep.isRequired()), repeated);
/* */ }
/* */ };
/* */ }
/* 991 */ ArrayList children = new ArrayList();
/* 992 */ for (TypeRef t : ep.getTypes()) {
/* 993 */ children.add(new Tree.Term(t) {
/* */ protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
/* 995 */ LocalElement e = parent.element();
/* */
/* 997 */ QName tn = this.val$t.getTagName();
/* */
/* 999 */ if ((XmlSchemaGenerator.Namespace.this.canBeDirectElementRef(this.val$t, tn)) || ((!tn.getNamespaceURI().equals(XmlSchemaGenerator.Namespace.this.uri)) && (tn.getNamespaceURI().length() > 0))) {
/* 1000 */ e.ref(tn);
/* */ } else {
/* 1002 */ e.name(tn.getLocalPart());
/* 1003 */ XmlSchemaGenerator.Namespace.this.writeTypeRef(e, this.val$t, "type");
/* 1004 */ XmlSchemaGenerator.Namespace.this.elementFormDefault.writeForm(e, tn);
/* */ }
/* */
/* 1007 */ if (this.val$t.isNillable()) {
/* 1008 */ e.nillable(true);
/* */ }
/* 1010 */ if (this.val$t.getDefaultValue() != null)
/* 1011 */ e._default(this.val$t.getDefaultValue());
/* 1012 */ writeOccurs(e, isOptional, repeated);
/* */ }
/* */ });
/* */ }
/* 1017 */ Tree choice = Tree.makeGroup(GroupKind.CHOICE, children).makeOptional(!ep.isRequired()).makeRepeated(ep.isCollection());
/* */
/* 1022 */ QName ename = ep.getXmlName();
/* 1023 */ if (ename != null)
/* 1024 */ return new Tree.Term(ename, ep, choice) {
/* */ protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
/* 1026 */ LocalElement e = parent.element();
/* 1027 */ if ((this.val$ename.getNamespaceURI().length() > 0) &&
/* 1028 */ (!this.val$ename.getNamespaceURI().equals(XmlSchemaGenerator.Namespace.this.uri)))
/* */ {
/* 1031 */ e.ref(new QName(this.val$ename.getNamespaceURI(), this.val$ename.getLocalPart()));
/* 1032 */ return;
/* */ }
/* */
/* 1035 */ e.name(this.val$ename.getLocalPart());
/* 1036 */ XmlSchemaGenerator.Namespace.this.elementFormDefault.writeForm(e, this.val$ename);
/* */
/* 1038 */ if (this.val$ep.isCollectionNillable()) {
/* 1039 */ e.nillable(true);
/* */ }
/* 1041 */ writeOccurs(e, !this.val$ep.isCollectionRequired(), repeated);
/* */
/* 1043 */ ComplexType p = e.complexType();
/* 1044 */ this.val$choice.write(p);
/* */ }
/* */ };
/* 1048 */ return choice;
/* */ }