1 19 20 28 29 package org.netbeans.modules.xml.schema.model.impl; 30 31 import org.netbeans.modules.xml.schema.model.AnyElement; 32 import org.netbeans.modules.xml.schema.model.SchemaComponent; 33 import org.netbeans.modules.xml.schema.model.visitor.SchemaVisitor; 34 import org.w3c.dom.Element ; 35 36 40 public class AnyImpl extends CommonAnyImpl implements AnyElement { 41 42 public AnyImpl(SchemaModelImpl model) { 43 this(model,createNewComponent(SchemaElements.ANY,model)); 44 } 45 46 49 public AnyImpl(SchemaModelImpl model, Element el) { 50 super(model, el); 51 } 52 53 57 public Class <? extends SchemaComponent> getComponentType() { 58 return AnyElement.class; 59 } 60 61 64 public void setMinOccurs(Integer occurs) { 65 setAttribute(MIN_OCCURS_PROPERTY, SchemaAttributes.MIN_OCCURS, occurs); 66 } 67 68 71 public void setMaxOccurs(String occurs) { 72 setAttribute(MAX_OCCURS_PROPERTY, SchemaAttributes.MAX_OCCURS, occurs); 73 } 74 75 78 public Integer getMinOccurs() { 79 String v = getAttribute(SchemaAttributes.MIN_OCCURS); 80 return v == null ? null : Integer.valueOf(v); 81 } 82 83 86 public String getMaxOccurs() { 87 return getAttribute(SchemaAttributes.MAX_OCCURS); 88 } 89 90 public int getMinOccursDefault() { 91 return 1; 92 } 93 94 public int getMinOccursEffective() { 95 String s = getAttribute(SchemaAttributes.MIN_OCCURS); 96 return s == null ? getMinOccursDefault() : Integer.valueOf(s).intValue(); 97 } 98 99 public String getMaxOccursDefault() { 100 return String.valueOf(1); 101 } 102 103 public String getMaxOccursEffective() { 104 String s = getAttribute(SchemaAttributes.MAX_OCCURS); 105 return s == null ? getMaxOccursDefault() : s; 106 } 107 108 111 public void accept(SchemaVisitor v) { 112 v.visit(this); 113 } 114 } | Popular Tags |