| 1 |
/** |
| 2 |
* Copyright (c) 2002-2007 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v20.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM - Initial API and implementation |
| 10 |
*/ |
| 11 |
package org.eclipse.xsd.impl; |
| 12 |
|
| 13 |
|
| 14 |
import java.util.ArrayList; |
| 15 |
import java.util.Collection; |
| 16 |
import java.util.HashSet; |
| 17 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
| 19 |
import java.util.StringTokenizer; |
| 20 |
|
| 21 |
import org.w3c.dom.Element; |
| 22 |
import org.w3c.dom.Node; |
| 23 |
|
| 24 |
import org.eclipse.emf.common.notify.Notification; |
| 25 |
import org.eclipse.emf.common.notify.NotificationChain; |
| 26 |
import org.eclipse.emf.common.util.EList; |
| 27 |
import org.eclipse.emf.ecore.EAttribute; |
| 28 |
import org.eclipse.emf.ecore.EClass; |
| 29 |
import org.eclipse.emf.ecore.EReference; |
| 30 |
import org.eclipse.emf.ecore.InternalEObject; |
| 31 |
import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 32 |
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| 33 |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 34 |
import org.eclipse.emf.ecore.util.EObjectEList; |
| 35 |
import org.eclipse.emf.ecore.util.InternalEList; |
| 36 |
|
| 37 |
import org.eclipse.xsd.XSDAnnotation; |
| 38 |
import org.eclipse.xsd.XSDComplexTypeDefinition; |
| 39 |
import org.eclipse.xsd.XSDConcreteComponent; |
| 40 |
import org.eclipse.xsd.XSDConstraint; |
| 41 |
import org.eclipse.xsd.XSDContentTypeCategory; |
| 42 |
import org.eclipse.xsd.XSDDiagnostic; |
| 43 |
import org.eclipse.xsd.XSDDiagnosticSeverity; |
| 44 |
import org.eclipse.xsd.XSDDisallowedSubstitutions; |
| 45 |
import org.eclipse.xsd.XSDElementDeclaration; |
| 46 |
import org.eclipse.xsd.XSDFactory; |
| 47 |
import org.eclipse.xsd.XSDFeature; |
| 48 |
import org.eclipse.xsd.XSDForm; |
| 49 |
import org.eclipse.xsd.XSDIdentityConstraintDefinition; |
| 50 |
import org.eclipse.xsd.XSDNamedComponent; |
| 51 |
import org.eclipse.xsd.XSDPackage; |
| 52 |
import org.eclipse.xsd.XSDParticle; |
| 53 |
import org.eclipse.xsd.XSDProhibitedSubstitutions; |
| 54 |
import org.eclipse.xsd.XSDSchema; |
| 55 |
import org.eclipse.xsd.XSDSimpleTypeDefinition; |
| 56 |
import org.eclipse.xsd.XSDSubstitutionGroupExclusions; |
| 57 |
import org.eclipse.xsd.XSDTypeDefinition; |
| 58 |
import org.eclipse.xsd.util.XSDConstants; |
| 59 |
|
| 60 |
|
| 61 |
/** |
| 62 |
* <!-- begin-user-doc --> |
| 63 |
* An implementation of the model object '<em><b>Element Declaration</b></em>'. |
| 64 |
* <!-- end-user-doc --> |
| 65 |
* <p> |
| 66 |
* The following features are implemented: |
| 67 |
* </p> |
| 68 |
* <ul> |
| 69 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#isNillable <em>Nillable</em>}</li> |
| 70 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getDisallowedSubstitutions <em>Disallowed Substitutions</em>}</li> |
| 71 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getSubstitutionGroupExclusions <em>Substitution Group Exclusions</em>}</li> |
| 72 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#isAbstract <em>Abstract</em>}</li> |
| 73 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getLexicalFinal <em>Lexical Final</em>}</li> |
| 74 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getBlock <em>Block</em>}</li> |
| 75 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#isElementDeclarationReference <em>Element Declaration Reference</em>}</li> |
| 76 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#isCircular <em>Circular</em>}</li> |
| 77 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getAnnotation <em>Annotation</em>}</li> |
| 78 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getAnonymousTypeDefinition <em>Anonymous Type Definition</em>}</li> |
| 79 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getTypeDefinition <em>Type Definition</em>}</li> |
| 80 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getIdentityConstraintDefinitions <em>Identity Constraint Definitions</em>}</li> |
| 81 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getResolvedElementDeclaration <em>Resolved Element Declaration</em>}</li> |
| 82 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getSubstitutionGroupAffiliation <em>Substitution Group Affiliation</em>}</li> |
| 83 |
* <li>{@link org.eclipse.xsd.impl.XSDElementDeclarationImpl#getSubstitutionGroup <em>Substitution Group</em>}</li> |
| 84 |
* </ul> |
| 85 |
* |
| 86 |
* @generated |
| 87 |
*/ |
| 88 |
public class XSDElementDeclarationImpl |
| 89 |
extends XSDFeatureImpl |
| 90 |
implements XSDElementDeclaration |
| 91 |
{ |
| 92 |
/** |
| 93 |
* The default value of the '{@link #isNillable() <em>Nillable</em>}' attribute. |
| 94 |
* <!-- begin-user-doc --> |
| 95 |
* <!-- end-user-doc --> |
| 96 |
* @see #isNillable() |
| 97 |
* @generated |
| 98 |
* @ordered |
| 99 |
*/ |
| 100 |
protected static final boolean NILLABLE_EDEFAULT = false; |
| 101 |
|
| 102 |
/** |
| 103 |
* The flag representing the value of the '{@link #isNillable() <em>Nillable</em>}' attribute. |
| 104 |
* <!-- begin-user-doc --> |
| 105 |
* <!-- end-user-doc --> |
| 106 |
* @see #isNillable() |
| 107 |
* @generated |
| 108 |
* @ordered |
| 109 |
*/ |
| 110 |
protected static final int NILLABLE_EFLAG = 1 << 12; |
| 111 |
|
| 112 |
/** |
| 113 |
* The flag representing whether the Nillable attribute has been set. |
| 114 |
* <!-- begin-user-doc --> |
| 115 |
* <!-- end-user-doc --> |
| 116 |
* @generated |
| 117 |
* @ordered |
| 118 |
*/ |
| 119 |
protected static final int NILLABLE_ESETFLAG = 1 << 13; |
| 120 |
|
| 121 |
/** |
| 122 |
* The cached value of the '{@link #getDisallowedSubstitutions() <em>Disallowed Substitutions</em>}' attribute list. |
| 123 |
* <!-- begin-user-doc --> |
| 124 |
* <!-- end-user-doc --> |
| 125 |
* @see #getDisallowedSubstitutions() |
| 126 |
* @generated |
| 127 |
* @ordered |
| 128 |
*/ |
| 129 |
protected EList<XSDDisallowedSubstitutions> disallowedSubstitutions; |
| 130 |
|
| 131 |
/** |
| 132 |
* The cached value of the '{@link #getSubstitutionGroupExclusions() <em>Substitution Group Exclusions</em>}' attribute list. |
| 133 |
* <!-- begin-user-doc --> |
| 134 |
* <!-- end-user-doc --> |
| 135 |
* @see #getSubstitutionGroupExclusions() |
| 136 |
* @generated |
| 137 |
* @ordered |
| 138 |
*/ |
| 139 |
protected EList<XSDSubstitutionGroupExclusions> substitutionGroupExclusions; |
| 140 |
|
| 141 |
/** |
| 142 |
* The default value of the '{@link #isAbstract() <em>Abstract</em>}' attribute. |
| 143 |
* <!-- begin-user-doc --> |
| 144 |
* <!-- end-user-doc --> |
| 145 |
* @see #isAbstract() |
| 146 |
* @generated |
| 147 |
* @ordered |
| 148 |
*/ |
| 149 |
protected static final boolean ABSTRACT_EDEFAULT = false; |
| 150 |
|
| 151 |
/** |
| 152 |
* The flag representing the value of the '{@link #isAbstract() <em>Abstract</em>}' attribute. |
| 153 |
* <!-- begin-user-doc --> |
| 154 |
* <!-- end-user-doc --> |
| 155 |
* @see #isAbstract() |
| 156 |
* @generated |
| 157 |
* @ordered |
| 158 |
*/ |
| 159 |
protected static final int ABSTRACT_EFLAG = 1 << 14; |
| 160 |
|
| 161 |
/** |
| 162 |
* The flag representing whether the Abstract attribute has been set. |
| 163 |
* <!-- begin-user-doc --> |
| 164 |
* <!-- end-user-doc --> |
| 165 |
* @generated |
| 166 |
* @ordered |
| 167 |
*/ |
| 168 |
protected static final int ABSTRACT_ESETFLAG = 1 << 15; |
| 169 |
|
| 170 |
/** |
| 171 |
* The cached value of the '{@link #getLexicalFinal() <em>Lexical Final</em>}' attribute list. |
| 172 |
* <!-- begin-user-doc --> |
| 173 |
* <!-- end-user-doc --> |
| 174 |
* @see #getLexicalFinal() |
| 175 |
* @generated |
| 176 |
* @ordered |
| 177 |
*/ |
| 178 |
protected EList<XSDProhibitedSubstitutions> lexicalFinal; |
| 179 |
|
| 180 |
/** |
| 181 |
* The cached value of the '{@link #getBlock() <em>Block</em>}' attribute list. |
| 182 |
* <!-- begin-user-doc --> |
| 183 |
* <!-- end-user-doc --> |
| 184 |
* @see #getBlock() |
| 185 |
* @generated |
| 186 |
* @ordered |
| 187 |
*/ |
| 188 |
protected EList<XSDDisallowedSubstitutions> block; |
| 189 |
|
| 190 |
/** |
| 191 |
* The default value of the '{@link #isElementDeclarationReference() <em>Element Declaration Reference</em>}' attribute. |
| 192 |
* <!-- begin-user-doc --> |
| 193 |
* <!-- end-user-doc --> |
| 194 |
* @see #isElementDeclarationReference() |
| 195 |
* @generated |
| 196 |
* @ordered |
| 197 |
*/ |
| 198 |
protected static final boolean ELEMENT_DECLARATION_REFERENCE_EDEFAULT = false; |
| 199 |
|
| 200 |
/** |
| 201 |
* The default value of the '{@link #isCircular() <em>Circular</em>}' attribute. |
| 202 |
* <!-- begin-user-doc --> |
| 203 |
* <!-- end-user-doc --> |
| 204 |
* @see #isCircular() |
| 205 |
* @generated |
| 206 |
* @ordered |
| 207 |
*/ |
| 208 |
protected static final boolean CIRCULAR_EDEFAULT = false; |
| 209 |
|
| 210 |
/** |
| 211 |
* The cached value of the '{@link #getAnnotation() <em>Annotation</em>}' containment reference. |
| 212 |
* <!-- begin-user-doc --> |
| 213 |
* <!-- end-user-doc --> |
| 214 |
* @see #getAnnotation() |
| 215 |
* @generated |
| 216 |
* @ordered |
| 217 |
*/ |
| 218 |
protected XSDAnnotation annotation; |
| 219 |
|
| 220 |
/** |
| 221 |
* The cached value of the '{@link #getAnonymousTypeDefinition() <em>Anonymous Type Definition</em>}' containment reference. |
| 222 |
* <!-- begin-user-doc --> |
| 223 |
* <!-- end-user-doc --> |
| 224 |
* @see #getAnonymousTypeDefinition() |
| 225 |
* @generated |
| 226 |
* @ordered |
| 227 |
*/ |
| 228 |
protected XSDTypeDefinition anonymousTypeDefinition; |
| 229 |
|
| 230 |
/** |
| 231 |
* The cached value of the '{@link #getTypeDefinition() <em>Type Definition</em>}' reference. |
| 232 |
* <!-- begin-user-doc --> |
| 233 |
* <!-- end-user-doc --> |
| 234 |
* @see #getTypeDefinition() |
| 235 |
* @generated |
| 236 |
* @ordered |
| 237 |
*/ |
| 238 |
protected XSDTypeDefinition typeDefinition; |
| 239 |
|
| 240 |
/** |
| 241 |
* The cached value of the '{@link #getIdentityConstraintDefinitions() <em>Identity Constraint Definitions</em>}' containment reference list. |
| 242 |
* <!-- begin-user-doc --> |
| 243 |
* <!-- end-user-doc --> |
| 244 |
* @see #getIdentityConstraintDefinitions() |
| 245 |
* @generated |
| 246 |
* @ordered |
| 247 |
*/ |
| 248 |
protected EList<XSDIdentityConstraintDefinition> identityConstraintDefinitions; |
| 249 |
|
| 250 |
/** |
| 251 |
* The cached value of the '{@link #getResolvedElementDeclaration() <em>Resolved Element Declaration</em>}' reference. |
| 252 |
* <!-- begin-user-doc --> |
| 253 |
* <!-- end-user-doc --> |
| 254 |
* @see #getResolvedElementDeclaration() |
| 255 |
* @generated |
| 256 |
* @ordered |
| 257 |
*/ |
| 258 |
protected XSDElementDeclaration resolvedElementDeclaration; |
| 259 |
|
| 260 |
/** |
| 261 |
* The cached value of the '{@link #getSubstitutionGroupAffiliation() <em>Substitution Group Affiliation</em>}' reference. |
| 262 |
* <!-- begin-user-doc --> |
| 263 |
* <!-- end-user-doc --> |
| 264 |
* @see #getSubstitutionGroupAffiliation() |
| 265 |
* @generated |
| 266 |
* @ordered |
| 267 |
*/ |
| 268 |
protected XSDElementDeclaration substitutionGroupAffiliation; |
| 269 |
|
| 270 |
/** |
| 271 |
* The cached value of the '{@link #getSubstitutionGroup() <em>Substitution Group</em>}' reference list. |
| 272 |
* <!-- begin-user-doc --> |
| 273 |
* <!-- end-user-doc --> |
| 274 |
* @see #getSubstitutionGroup() |
| 275 |
* @generated |
| 276 |
* @ordered |
| 277 |
*/ |
| 278 |
protected EList<XSDElementDeclaration> substitutionGroup; |
| 279 |
|
| 280 |
public static XSDElementDeclaration createElementDeclaration(Node node) |
| 281 |
{ |
| 282 |
if (XSDConstants.nodeType(node) == XSDConstants.ELEMENT_ELEMENT) |
| 283 |
{ |
| 284 |
XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); |
| 285 |
xsdElementDeclaration.setElement((Element)node); |
| 286 |
return xsdElementDeclaration; |
| 287 |
} |
| 288 |
|
| 289 |
return null; |
| 290 |
} |
| 291 |
|
| 292 |
protected int analysisState; |
| 293 |
|
| 294 |
/** |
| 295 |
* <!-- begin-user-doc --> |
| 296 |
* <!-- end-user-doc --> |
| 297 |
* @generated NOT |
| 298 |
*/ |
| 299 |
protected XSDElementDeclarationImpl() |
| 300 |
{ |
| 301 |
super(); |
| 302 |
this.resolvedElementDeclaration = this; |
| 303 |
// this.setResolvedElementDeclaration = true; |
| 304 |
} |
| 305 |
|
| 306 |
/** |
| 307 |
* <!-- begin-user-doc --> |
| 308 |
* <!-- end-user-doc --> |
| 309 |
* @generated |
| 310 |
*/ |
| 311 |
@Override |
| 312 |
protected EClass eStaticClass() |
| 313 |
{ |
| 314 |
return XSDPackage.Literals.XSD_ELEMENT_DECLARATION; |
| 315 |
} |
| 316 |
|
| 317 |
/** |
| 318 |
* <!-- begin-user-doc --> |
| 319 |
* <!-- end-user-doc --> |
| 320 |
* @generated |
| 321 |
*/ |
| 322 |
@Override |
| 323 |
public boolean isNillable() |
| 324 |
{ |
| 325 |
return (eFlags & NILLABLE_EFLAG) != 0; |
| 326 |
} |
| 327 |
|
| 328 |
/** |
| 329 |
* <!-- begin-user-doc --> |
| 330 |
* <!-- end-user-doc --> |
| 331 |
* @generated |
| 332 |
*/ |
| 333 |
@Override |
| 334 |
public void setNillable(boolean newNillable) |
| 335 |
{ |
| 336 |
boolean oldNillable = (eFlags & NILLABLE_EFLAG) != 0; |
| 337 |
if (newNillable) eFlags |= NILLABLE_EFLAG; else eFlags &= ~NILLABLE_EFLAG; |
| 338 |
boolean oldNillableESet = (eFlags & NILLABLE_ESETFLAG) != 0; |
| 339 |
eFlags |= NILLABLE_ESETFLAG; |
| 340 |
if (eNotificationRequired()) |
| 341 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE, oldNillable, newNillable, !oldNillableESet)); |
| 342 |
} |
| 343 |
|
| 344 |
/** |
| 345 |
* <!-- begin-user-doc --> |
| 346 |
* <!-- end-user-doc --> |
| 347 |
* @generated |
| 348 |
*/ |
| 349 |
@Override |
| 350 |
public void unsetNillable() |
| 351 |
{ |
| 352 |
boolean oldNillable = (eFlags & NILLABLE_EFLAG) != 0; |
| 353 |
boolean oldNillableESet = (eFlags & NILLABLE_ESETFLAG) != 0; |
| 354 |
if (NILLABLE_EDEFAULT) eFlags |= NILLABLE_EFLAG; else eFlags &= ~NILLABLE_EFLAG; |
| 355 |
eFlags &= ~NILLABLE_ESETFLAG; |
| 356 |
if (eNotificationRequired()) |
| 357 |
eNotify(new ENotificationImpl(this, Notification.UNSET, XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE, oldNillable, NILLABLE_EDEFAULT, oldNillableESet)); |
| 358 |
} |
| 359 |
|
| 360 |
/** |
| 361 |
* <!-- begin-user-doc --> |
| 362 |
* <!-- end-user-doc --> |
| 363 |
* @generated |
| 364 |
*/ |
| 365 |
@Override |
| 366 |
public boolean isSetNillable() |
| 367 |
{ |
| 368 |
return (eFlags & NILLABLE_ESETFLAG) != 0; |
| 369 |
} |
| 370 |
|
| 371 |
/** |
| 372 |
* <!-- begin-user-doc --> |
| 373 |
* <!-- end-user-doc --> |
| 374 |
* @generated |
| 375 |
*/ |
| 376 |
@Override |
| 377 |
public EList<XSDDisallowedSubstitutions> getDisallowedSubstitutions() |
| 378 |
{ |
| 379 |
if (disallowedSubstitutions == null) |
| 380 |
{ |
| 381 |
disallowedSubstitutions = new EDataTypeUniqueEList<XSDDisallowedSubstitutions>(XSDDisallowedSubstitutions.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__DISALLOWED_SUBSTITUTIONS); |
| 382 |
} |
| 383 |
return disallowedSubstitutions; |
| 384 |
} |
| 385 |
|
| 386 |
/** |
| 387 |
* <!-- begin-user-doc --> |
| 388 |
* <!-- end-user-doc --> |
| 389 |
* @generated |
| 390 |
*/ |
| 391 |
@Override |
| 392 |
public EList<XSDSubstitutionGroupExclusions> getSubstitutionGroupExclusions() |
| 393 |
{ |
| 394 |
if (substitutionGroupExclusions == null) |
| 395 |
{ |
| 396 |
substitutionGroupExclusions = new EDataTypeUniqueEList<XSDSubstitutionGroupExclusions>(XSDSubstitutionGroupExclusions.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_EXCLUSIONS); |
| 397 |
} |
| 398 |
return substitutionGroupExclusions; |
| 399 |
} |
| 400 |
|
| 401 |
/** |
| 402 |
* <!-- begin-user-doc --> |
| 403 |
* <!-- end-user-doc --> |
| 404 |
* @generated |
| 405 |
*/ |
| 406 |
@Override |
| 407 |
public boolean isAbstract() |
| 408 |
{ |
| 409 |
return (eFlags & ABSTRACT_EFLAG) != 0; |
| 410 |
} |
| 411 |
|
| 412 |
/** |
| 413 |
* <!-- begin-user-doc --> |
| 414 |
* <!-- end-user-doc --> |
| 415 |
* @generated |
| 416 |
*/ |
| 417 |
@Override |
| 418 |
public void setAbstract(boolean newAbstract) |
| 419 |
{ |
| 420 |
boolean oldAbstract = (eFlags & ABSTRACT_EFLAG) != 0; |
| 421 |
if (newAbstract) eFlags |= ABSTRACT_EFLAG; else eFlags &= ~ABSTRACT_EFLAG; |
| 422 |
boolean oldAbstractESet = (eFlags & ABSTRACT_ESETFLAG) != 0; |
| 423 |
eFlags |= ABSTRACT_ESETFLAG; |
| 424 |
if (eNotificationRequired()) |
| 425 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT, oldAbstract, newAbstract, !oldAbstractESet)); |
| 426 |
} |
| 427 |
|
| 428 |
/** |
| 429 |
* <!-- begin-user-doc --> |
| 430 |
* <!-- end-user-doc --> |
| 431 |
* @generated |
| 432 |
*/ |
| 433 |
@Override |
| 434 |
public void unsetAbstract() |
| 435 |
{ |
| 436 |
boolean oldAbstract = (eFlags & ABSTRACT_EFLAG) != 0; |
| 437 |
boolean oldAbstractESet = (eFlags & ABSTRACT_ESETFLAG) != 0; |
| 438 |
if (ABSTRACT_EDEFAULT) eFlags |= ABSTRACT_EFLAG; else eFlags &= ~ABSTRACT_EFLAG; |
| 439 |
eFlags &= ~ABSTRACT_ESETFLAG; |
| 440 |
if (eNotificationRequired()) |
| 441 |
eNotify(new ENotificationImpl(this, Notification.UNSET, XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT, oldAbstract, ABSTRACT_EDEFAULT, oldAbstractESet)); |
| 442 |
} |
| 443 |
|
| 444 |
/** |
| 445 |
* <!-- begin-user-doc --> |
| 446 |
* <!-- end-user-doc --> |
| 447 |
* @generated |
| 448 |
*/ |
| 449 |
@Override |
| 450 |
public boolean isSetAbstract() |
| 451 |
{ |
| 452 |
return (eFlags & ABSTRACT_ESETFLAG) != 0; |
| 453 |
} |
| 454 |
|
| 455 |
/** |
| 456 |
* <!-- begin-user-doc --> |
| 457 |
* <!-- end-user-doc --> |
| 458 |
* @generated |
| 459 |
*/ |
| 460 |
@Override |
| 461 |
public EList<XSDProhibitedSubstitutions> getLexicalFinal() |
| 462 |
{ |
| 463 |
if (lexicalFinal == null) |
| 464 |
{ |
| 465 |
lexicalFinal = new EDataTypeUniqueEList.Unsettable<XSDProhibitedSubstitutions>(XSDProhibitedSubstitutions.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL); |
| 466 |
} |
| 467 |
return lexicalFinal; |
| 468 |
} |
| 469 |
|
| 470 |
/** |
| 471 |
* <!-- begin-user-doc --> |
| 472 |
* <!-- end-user-doc --> |
| 473 |
* @generated |
| 474 |
*/ |
| 475 |
@Override |
| 476 |
public void unsetLexicalFinal() |
| 477 |
{ |
| 478 |
if (lexicalFinal != null) ((InternalEList.Unsettable<?>)lexicalFinal).unset(); |
| 479 |
} |
| 480 |
|
| 481 |
/** |
| 482 |
* <!-- begin-user-doc --> |
| 483 |
* <!-- end-user-doc --> |
| 484 |
* @generated |
| 485 |
*/ |
| 486 |
@Override |
| 487 |
public boolean isSetLexicalFinal() |
| 488 |
{ |
| 489 |
return lexicalFinal != null && ((InternalEList.Unsettable<?>)lexicalFinal).isSet(); |
| 490 |
} |
| 491 |
|
| 492 |
/** |
| 493 |
* <!-- begin-user-doc --> |
| 494 |
* <!-- end-user-doc --> |
| 495 |
* @generated |
| 496 |
*/ |
| 497 |
@Override |
| 498 |
public EList<XSDDisallowedSubstitutions> getBlock() |
| 499 |
{ |
| 500 |
if (block == null) |
| 501 |
{ |
| 502 |
block = new EDataTypeUniqueEList.Unsettable<XSDDisallowedSubstitutions>(XSDDisallowedSubstitutions.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__BLOCK); |
| 503 |
} |
| 504 |
return block; |
| 505 |
} |
| 506 |
|
| 507 |
/** |
| 508 |
* <!-- begin-user-doc --> |
| 509 |
* <!-- end-user-doc --> |
| 510 |
* @generated |
| 511 |
*/ |
| 512 |
@Override |
| 513 |
public void unsetBlock() |
| 514 |
{ |
| 515 |
if (block != null) ((InternalEList.Unsettable<?>)block).unset(); |
| 516 |
} |
| 517 |
|
| 518 |
/** |
| 519 |
* <!-- begin-user-doc --> |
| 520 |
* <!-- end-user-doc --> |
| 521 |
* @generated |
| 522 |
*/ |
| 523 |
@Override |
| 524 |
public boolean isSetBlock() |
| 525 |
{ |
| 526 |
return block != null && ((InternalEList.Unsettable<?>)block).isSet(); |
| 527 |
} |
| 528 |
|
| 529 |
/** |
| 530 |
* <!-- begin-user-doc --> |
| 531 |
* <!-- end-user-doc --> |
| 532 |
* @generated modifiable |
| 533 |
*/ |
| 534 |
public Boolean getElementDeclarationReference() |
| 535 |
{ |
| 536 |
return isElementDeclarationReference() ? Boolean.TRUE : Boolean.FALSE; |
| 537 |
} |
| 538 |
|
| 539 |
@Override |
| 540 |
public Element createElement() |
| 541 |
{ |
| 542 |
Element newElement = createElement(XSDConstants.ELEMENT_ELEMENT); |
| 543 |
setElement(newElement); |
| 544 |
|
| 545 |
XSDTypeDefinition anonymousTypeDefinition = getAnonymousTypeDefinition(); |
| 546 |
if (anonymousTypeDefinition != null) |
| 547 |
{ |
| 548 |
Element child = ((XSDConcreteComponentImpl)anonymousTypeDefinition).createElement(); |
| 549 |
newElement.appendChild(child); |
| 550 |
} |
| 551 |
return newElement; |
| 552 |
} |
| 553 |
|
| 554 |
@Override |
| 555 |
protected void patch() |
| 556 |
{ |
| 557 |
analysisState = UNANALYZED; |
| 558 |
super.patch(); |
| 559 |
XSDElementDeclaration theResolvedElementDeclaration = getResolvedElementDeclaration(); |
| 560 |
if (theResolvedElementDeclaration == this) |
| 561 |
{ |
| 562 |
XSDTypeDefinition typeDefinition = getTypeDefinition(); |
| 563 |
if (typeDefinition != null && (forceResolve && typeDefinition.getName() != null || typeDefinition.getContainer() == null)) |
| 564 |
{ |
| 565 |
XSDTypeDefinition newTypeDefinition = resolveTypeDefinition(typeDefinition.getTargetNamespace(), typeDefinition.getName()); |
| 566 |
if (forceResolve || newTypeDefinition.getContainer() != null && newTypeDefinition != typeDefinition) |
| 567 |
{ |
| 568 |
setTypeDefinitionGen(newTypeDefinition); |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation(); |
| 573 |
if (theSubstitutionGroupAffiliation != null && theSubstitutionGroupAffiliation.getContainer() == null) |
| 574 |
{ |
| 575 |
XSDElementDeclaration newSubstitutionGroupAffiliation = |
| 576 |
resolveElementDeclaration(theSubstitutionGroupAffiliation.getTargetNamespace(), theSubstitutionGroupAffiliation.getName()); |
| 577 |
if (newSubstitutionGroupAffiliation.getContainer() != null && newSubstitutionGroupAffiliation != theSubstitutionGroupAffiliation) |
| 578 |
{ |
| 579 |
setSubstitutionGroupAffiliation(newSubstitutionGroupAffiliation); |
| 580 |
} |
| 581 |
} |
| 582 |
|
| 583 |
if (!isAbstract() && !getSubstitutionGroup().contains(this)) |
| 584 |
{ |
| 585 |
getSubstitutionGroup().add(this); |
| 586 |
} |
| 587 |
|
| 588 |
XSDSchema xsdSchema = getSchema(); |
| 589 |
if (xsdSchema != null) |
| 590 |
{ |
| 591 |
// |
| 592 |
// |
| 593 |
List<XSDDisallowedSubstitutions> theBlock = getBlock(); |
| 594 |
if (!isSetBlock()) |
| 595 |
{ |
| 596 |
theBlock = getSchema().getBlockDefault(); |
| 597 |
} |
| 598 |
List<XSDDisallowedSubstitutions> newDisallowedSubstitutions = new ArrayList<XSDDisallowedSubstitutions>(); |
| 599 |
for (XSDDisallowedSubstitutions value : theBlock) |
| 600 |
{ |
| 601 |
if (value.toString().equals("all")) |
| 602 |
{ |
| 603 |
newDisallowedSubstitutions.add(XSDDisallowedSubstitutions.EXTENSION_LITERAL); |
| 604 |
newDisallowedSubstitutions.add(XSDDisallowedSubstitutions.RESTRICTION_LITERAL); |
| 605 |
newDisallowedSubstitutions.add(XSDDisallowedSubstitutions.SUBSTITUTION_LITERAL); |
| 606 |
break; |
| 607 |
} |
| 608 |
else |
| 609 |
{ |
| 610 |
newDisallowedSubstitutions.add(value); |
| 611 |
} |
| 612 |
} |
| 613 |
|
| 614 |
Collection<XSDDisallowedSubstitutions> oldDisallowedSubstitutions = new ArrayList<XSDDisallowedSubstitutions>(getDisallowedSubstitutions()); |
| 615 |
oldDisallowedSubstitutions.removeAll(newDisallowedSubstitutions); |
| 616 |
if (!oldDisallowedSubstitutions.isEmpty()) |
| 617 |
{ |
| 618 |
getDisallowedSubstitutions().removeAll(oldDisallowedSubstitutions); |
| 619 |
} |
| 620 |
setListContentAndOrder(getDisallowedSubstitutions(), newDisallowedSubstitutions); |
| 621 |
|
| 622 |
// |
| 623 |
// |
| 624 |
List<XSDProhibitedSubstitutions> theLexicalFinal = getLexicalFinal(); |
| 625 |
if (!isSetLexicalFinal()) |
| 626 |
{ |
| 627 |
theLexicalFinal = getSchema().getFinalDefault(); |
| 628 |
} |
| 629 |
List<XSDSubstitutionGroupExclusions> newSubstitutionGroupExclusions = new ArrayList<XSDSubstitutionGroupExclusions>(); |
| 630 |
for (Object value : theLexicalFinal) |
| 631 |
{ |
| 632 |
if (value.toString().equals("all")) |
| 633 |
{ |
| 634 |
newSubstitutionGroupExclusions.add(XSDSubstitutionGroupExclusions.EXTENSION_LITERAL); |
| 635 |
newSubstitutionGroupExclusions.add(XSDSubstitutionGroupExclusions.RESTRICTION_LITERAL); |
| 636 |
break; |
| 637 |
} |
| 638 |
else if (value.toString().equals("restriction")) |
| 639 |
{ |
| 640 |
newSubstitutionGroupExclusions.add(XSDSubstitutionGroupExclusions.RESTRICTION_LITERAL); |
| 641 |
} |
| 642 |
else |
| 643 |
{ |
| 644 |
newSubstitutionGroupExclusions.add(XSDSubstitutionGroupExclusions.EXTENSION_LITERAL); |
| 645 |
} |
| 646 |
} |
| 647 |
|
| 648 |
Collection<XSDSubstitutionGroupExclusions> oldSubstitutionGroupExclusions = |
| 649 |
new ArrayList<XSDSubstitutionGroupExclusions>(getSubstitutionGroupExclusions()); |
| 650 |
oldSubstitutionGroupExclusions.removeAll(newSubstitutionGroupExclusions); |
| 651 |
if (!oldSubstitutionGroupExclusions.isEmpty()) |
| 652 |
{ |
| 653 |
getSubstitutionGroupExclusions().removeAll(oldSubstitutionGroupExclusions); |
| 654 |
} |
| 655 |
setListContentAndOrder(getSubstitutionGroupExclusions(), newSubstitutionGroupExclusions); |
| 656 |
} |
| 657 |
} |
| 658 |
else |
| 659 |
{ |
| 660 |
XSDElementDeclaration newResolvedElementDeclaration = |
| 661 |
resolveElementDeclaration(theResolvedElementDeclaration.getTargetNamespace(), theResolvedElementDeclaration.getName()); |
| 662 |
if (newResolvedElementDeclaration != theResolvedElementDeclaration) |
| 663 |
{ |
| 664 |
setResolvedElementDeclaration(newResolvedElementDeclaration); |
| 665 |
} |
| 666 |
} |
| 667 |
} |
| 668 |
|
| 669 |
@Override |
| 670 |
protected void traverseToRootForAnalysis() |
| 671 |
{ |
| 672 |
analysisState = UNANALYZED; |
| 673 |
super.traverseToRootForAnalysis(); |
| 674 |
} |
| 675 |
|
| 676 |
@Override |
| 677 |
protected boolean analyze() |
| 678 |
{ |
| 679 |
switch (analysisState) |
| 680 |
{ |
| 681 |
case UNANALYZED: |
| 682 |
{ |
| 683 |
analysisState = ANALYZING; |
| 684 |
|
| 685 |
handleAnalysis(); |
| 686 |
if (analysisState == ANALYZING) |
| 687 |
{ |
| 688 |
analysisState = ANALYZED; |
| 689 |
return true; |
| 690 |
} |
| 691 |
else |
| 692 |
{ |
| 693 |
return false; |
| 694 |
} |
| 695 |
} |
| 696 |
case ANALYZED: |
| 697 |
{ |
| 698 |
return true; |
| 699 |
} |
| 700 |
case ANALYZING: |
| 701 |
case CIRCULAR: |
| 702 |
default: |
| 703 |
{ |
| 704 |
analysisState = CIRCULAR; |
| 705 |
return false; |
| 706 |
} |
| 707 |
} |
| 708 |
} |
| 709 |
|
| 710 |
protected boolean isTypeExplicit = false; |
| 711 |
protected void handleAnalysis() |
| 712 |
{ |
| 713 |
if (!isElementDeclarationReference()) |
| 714 |
{ |
| 715 |
XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation(); |
| 716 |
if (theSubstitutionGroupAffiliation != null && theSubstitutionGroupAffiliation.getContainer() != null) |
| 717 |
{ |
| 718 |
((XSDConcreteComponentImpl)theSubstitutionGroupAffiliation).analyze(); |
| 719 |
} |
| 720 |
|
| 721 |
XSDTypeDefinition theTypeDefinition = getTypeDefinition(); |
| 722 |
|
| 723 |
if (!isTypeExplicit || theTypeDefinition == null) |
| 724 |
{ |
| 725 |
XSDTypeDefinition newTypeDefinition = |
| 726 |
theSubstitutionGroupAffiliation == null || theSubstitutionGroupAffiliation.getTypeDefinition() == null ? |
| 727 |
getSchema().getSchemaForSchema().resolveTypeDefinition("anyType") : |
| 728 |
theSubstitutionGroupAffiliation.getTypeDefinition(); |
| 729 |
if (newTypeDefinition != theTypeDefinition) |
| 730 |
{ |
| 731 |
isTypeExplicit = false; |
| 732 |
setTypeDefinitionGen(newTypeDefinition); |
| 733 |
} |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
super.analyze(); |
| 738 |
} |
| 739 |
|
| 740 |
@Override |
| 741 |
protected void patchTargetNamespaceAttribute() |
| 742 |
{ |
| 743 |
if (!isElementDeclarationReference()) |
| 744 |
{ |
| 745 |
XSDSchema xsdSchema = getSchema(); |
| 746 |
if (xsdSchema != null) |
| 747 |
{ |
| 748 |
patchTargetNamespaceAttributeHelper(xsdSchema); |
| 749 |
} |
| 750 |
} |
| 751 |
} |
| 752 |
|
| 753 |
@Override |
| 754 |
protected void patchTargetNamespaceAttribute(XSDSchema xsdSchema) |
| 755 |
{ |
| 756 |
if (!isElementDeclarationReference()) |
| 757 |
{ |
| 758 |
patchTargetNamespaceAttributeHelper(xsdSchema); |
| 759 |
} |
| 760 |
} |
| 761 |
|
| 762 |
protected void patchTargetNamespaceAttributeHelper(XSDSchema xsdSchema) |
| 763 |
{ |
| 764 |
if (getScope() instanceof XSDSchema) |
| 765 |
{ |
| 766 |
if (!isSetForm() || XSDForm.QUALIFIED_LITERAL != getForm()) |
| 767 |
{ |
| 768 |
setForm(XSDForm.QUALIFIED_LITERAL); |
| 769 |
} |
| 770 |
} |
| 771 |
|
| 772 |
if (isSetForm() ? XSDForm.UNQUALIFIED_LITERAL == getForm() : XSDForm.UNQUALIFIED_LITERAL == xsdSchema.getElementFormDefault()) |
| 773 |
{ |
| 774 |
if (getTargetNamespace() != null) |
| 775 |
{ |
| 776 |
setTargetNamespace(null); |
| 777 |
} |
| 778 |
} |
| 779 |
else |
| 780 |
{ |
| 781 |
String newTargetNamespace = xsdSchema.getTargetNamespace(); |
| 782 |
if (newTargetNamespace == null ? getTargetNamespace() != null : !newTargetNamespace.equals(getTargetNamespace())) |
| 783 |
{ |
| 784 |
setTargetNamespace(newTargetNamespace); |
| 785 |
} |
| 786 |
} |
| 787 |
} |
| 788 |
|
| 789 |
@Override |
| 790 |
public void validate() |
| 791 |
{ |
| 792 |
super.validate(); |
| 793 |
|
| 794 |
Element theElement = getElement(); |
| 795 |
if (theElement != null) |
| 796 |
{ |
| 797 |
if (getContainer() instanceof XSDSchema) |
| 798 |
{ |
| 799 |
checkAttributes |
| 800 |
(XSDConstants.PART1, |
| 801 |
"element-element", |
| 802 |
theElement, |
| 803 |
new String [] |
| 804 |
{ |
| 805 |
XSDConstants.ABSTRACT_ATTRIBUTE, |
| 806 |
XSDConstants.BLOCK_ATTRIBUTE, |
| 807 |
XSDConstants.DEFAULT_ATTRIBUTE, |
| 808 |
XSDConstants.FINAL_ATTRIBUTE, |
| 809 |
XSDConstants.FIXED_ATTRIBUTE, |
| 810 |
XSDConstants.ID_ATTRIBUTE, |
| 811 |
XSDConstants.NAME_ATTRIBUTE, |
| 812 |
XSDConstants.NILLABLE_ATTRIBUTE, |
| 813 |
XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, |
| 814 |
XSDConstants.TYPE_ATTRIBUTE |
| 815 |
}); |
| 816 |
|
| 817 |
checkComplexContent("topLevelElement", XSDConstants.PART1, "element-element", theElement); |
| 818 |
|
| 819 |
checkBuiltInTypeConstraint |
| 820 |
("boolean", |
| 821 |
null, |
| 822 |
XSDConstants.PART1, |
| 823 |
"element-element", |
| 824 |
theElement, |
| 825 |
XSDConstants.ABSTRACT_ATTRIBUTE, |
| 826 |
false); |
| 827 |
|
| 828 |
checkBuiltInTypeConstraint |
| 829 |
("derivationSet", |
| 830 |
null, |
| 831 |
XSDConstants.PART1, |
| 832 |
"element-element", |
| 833 |
theElement, |
| 834 |
XSDConstants.FINAL_ATTRIBUTE, |
| 835 |
false); |
| 836 |
} |
| 837 |
else |
| 838 |
{ |
| 839 |
checkAttributes |
| 840 |
(XSDConstants.PART1, |
| 841 |
"element-element", |
| 842 |
theElement, |
| 843 |
new String [] |
| 844 |
{ |
| 845 |
XSDConstants.BLOCK_ATTRIBUTE, |
| 846 |
XSDConstants.DEFAULT_ATTRIBUTE, |
| 847 |
XSDConstants.FIXED_ATTRIBUTE, |
| 848 |
XSDConstants.FORM_ATTRIBUTE, |
| 849 |
XSDConstants.ID_ATTRIBUTE, |
| 850 |
XSDConstants.MAXOCCURS_ATTRIBUTE, |
| 851 |
XSDConstants.MINOCCURS_ATTRIBUTE, |
| 852 |
XSDConstants.NAME_ATTRIBUTE, |
| 853 |
XSDConstants.NILLABLE_ATTRIBUTE, |
| 854 |
XSDConstants.REF_ATTRIBUTE, |
| 855 |
XSDConstants.TYPE_ATTRIBUTE |
| 856 |
}); |
| 857 |
|
| 858 |
checkComplexContent("localElement", XSDConstants.PART1, "element-element", theElement); |
| 859 |
|
| 860 |
checkBuiltInTypeConstraint |
| 861 |
("formChoice", |
| 862 |
null, |
| 863 |
XSDConstants.PART1, |
| 864 |
"element-element", |
| 865 |
theElement, |
| 866 |
XSDConstants.FORM_ATTRIBUTE, |
| 867 |
false); |
| 868 |
|
| 869 |
checkBuiltInTypeConstraint |
| 870 |
("allNNI", |
| 871 |
null, |
| 872 |
XSDConstants.PART1, |
| 873 |
"element-element", |
| 874 |
theElement, |
| 875 |
XSDConstants.MAXOCCURS_ATTRIBUTE, |
| 876 |
false); |
| 877 |
|
| 878 |
checkBuiltInTypeConstraint |
| 879 |
("nonNegativeInteger", |
| 880 |
null, |
| 881 |
XSDConstants.PART1, |
| 882 |
"element-element", |
| 883 |
theElement, |
| 884 |
XSDConstants.MINOCCURS_ATTRIBUTE, |
| 885 |
false); |
| 886 |
} |
| 887 |
|
| 888 |
if (theElement.hasAttributeNS(null, XSDConstants.FIXED_ATTRIBUTE) && |
| 889 |
theElement.hasAttributeNS(null, XSDConstants.DEFAULT_ATTRIBUTE)) |
| 890 |
{ |
| 891 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.1"); |
| 892 |
} |
| 893 |
|
| 894 |
checkBuiltInTypeConstraint |
| 895 |
("ID", |
| 896 |
null, |
| 897 |
XSDConstants.PART1, |
| 898 |
"element-element", |
| 899 |
theElement, |
| 900 |
XSDConstants.ID_ATTRIBUTE, |
| 901 |
false); |
| 902 |
|
| 903 |
checkBuiltInTypeConstraint |
| 904 |
("boolean", |
| 905 |
null, |
| 906 |
XSDConstants.PART1, |
| 907 |
"element-element", |
| 908 |
theElement, |
| 909 |
XSDConstants.NILLABLE_ATTRIBUTE, |
| 910 |
false); |
| 911 |
|
| 912 |
checkBuiltInTypeConstraint |
| 913 |
("blockSet", |
| 914 |
null, |
| 915 |
XSDConstants.PART1, |
| 916 |
"element-element", |
| 917 |
theElement, |
| 918 |
XSDConstants.BLOCK_ATTRIBUTE, |
| 919 |
false); |
| 920 |
|
| 921 |
if (theElement.hasAttributeNS(null, XSDConstants.TYPE_ATTRIBUTE)) |
| 922 |
{ |
| 923 |
for (Node child = theElement.getFirstChild(); child != null; child = child.getNextSibling()) |
| 924 |
{ |
| 925 |
switch (XSDConstants.nodeType(child)) |
| 926 |
{ |
| 927 |
case XSDConstants.COMPLEXTYPE_ELEMENT: |
| 928 |
case XSDConstants.SIMPLETYPE_ELEMENT: |
| 929 |
{ |
| 930 |
XSDDiagnostic xsdDiagnostic = createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.3"); |
| 931 |
xsdDiagnostic.setNode(child); |
| 932 |
break; |
| 933 |
} |
| 934 |
} |
| 935 |
} |
| 936 |
} |
| 937 |
} |
| 938 |
|
| 939 |
if (isElementDeclarationReference()) |
| 940 |
{ |
| 941 |
XSDElementDeclaration theResolvedElementDeclaration = getResolvedElementDeclaration(); |
| 942 |
if (theResolvedElementDeclaration.getContainer() == null) |
| 943 |
{ |
| 944 |
createDiagnostic |
| 945 |
(XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedElementDeclaration_message", theResolvedElementDeclaration.getURI()); |
| 946 |
} |
| 947 |
|
| 948 |
if (theElement != null) |
| 949 |
{ |
| 950 |
if (theElement.hasAttributeNS(null, XSDConstants.NAME_ATTRIBUTE)) |
| 951 |
{ |
| 952 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.2.1"); |
| 953 |
} |
| 954 |
if (theElement.hasAttributeNS(null, XSDConstants.NILLABLE_ATTRIBUTE) || |
| 955 |
theElement.hasAttributeNS(null, XSDConstants.DEFAULT_ATTRIBUTE) || |
| 956 |
theElement.hasAttributeNS(null, XSDConstants.FIXED_ATTRIBUTE) || |
| 957 |
theElement.hasAttributeNS(null, XSDConstants.BLOCK_ATTRIBUTE)) |
| 958 |
{ |
| 959 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.2.2.1"); |
| 960 |
} |
| 961 |
} |
| 962 |
|
| 963 |
if (isSetForm() || theElement != null && theElement.hasAttributeNS(null, XSDConstants.FORM_ATTRIBUTE)) |
| 964 |
{ |
| 965 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.2.2.1"); |
| 966 |
} |
| 967 |
if (getType() != null || theElement != null && theElement.hasAttributeNS(null, XSDConstants.TYPE_ATTRIBUTE)) |
| 968 |
{ |
| 969 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.2.2.1"); |
| 970 |
} |
| 971 |
else if (theElement != null) |
| 972 |
{ |
| 973 |
for (Node child = theElement.getFirstChild(); child != null; child = child.getNextSibling()) |
| 974 |
{ |
| 975 |
switch (XSDConstants.nodeType(child)) |
| 976 |
{ |
| 977 |
case XSDConstants.COMPLEXTYPE_ELEMENT: |
| 978 |
case XSDConstants.SIMPLETYPE_ELEMENT: |
| 979 |
case XSDConstants.KEY_ELEMENT: |
| 980 |
case XSDConstants.KEYREF_ELEMENT: |
| 981 |
case XSDConstants.UNIQUE_ELEMENT: |
| 982 |
{ |
| 983 |
XSDDiagnostic xsdDiagnostic = createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "src-element.2.2.2"); |
| 984 |
xsdDiagnostic.setNode(child); |
| 985 |
break; |
| 986 |
} |
| 987 |
} |
| 988 |
} |
| 989 |
} |
| 990 |
} |
| 991 |
else |
| 992 |
{ |
| 993 |
checkBuiltInTypeConstraint |
| 994 |
("NCName", |
| 995 |
getName(), |
| 996 |
XSDConstants.PART1, |
| 997 |
"element-element", |
| 998 |
theElement, |
| 999 |
XSDConstants.NAME_ATTRIBUTE, |
| 1000 |
true); |
| 1001 |
|
| 1002 |
XSDTypeDefinition theTypeDefinition = getTypeDefinition(); |
| 1003 |
if (theTypeDefinition == null || theTypeDefinition.getContainer() == null) |
| 1004 |
{ |
| 1005 |
createDiagnostic |
| 1006 |
(XSDDiagnosticSeverity.ERROR_LITERAL, |
| 1007 |
"_UI_UnresolvedTypeDefinition_message", |
| 1008 |
theTypeDefinition == null ? "" : theTypeDefinition.getURI()); |
| 1009 |
} |
| 1010 |
|
| 1011 |
if (theTypeDefinition != null) |
| 1012 |
{ |
| 1013 |
if (getLexicalValue() != null) |
| 1014 |
{ |
| 1015 |
XSDSimpleTypeDefinition xsdSimpleTypeDefinition; |
| 1016 |
if (theTypeDefinition instanceof XSDComplexTypeDefinition) |
| 1017 |
{ |
| 1018 |
XSDComplexTypeDefinition xsdComplexTypeDefinition = (XSDComplexTypeDefinition)theTypeDefinition; |
| 1019 |
xsdSimpleTypeDefinition = ((XSDComplexTypeDefinition)theTypeDefinition).getSimpleType(); |
| 1020 |
if (xsdSimpleTypeDefinition == null) |
| 1021 |
{ |
| 1022 |
if (xsdComplexTypeDefinition.getContentTypeCategory() != XSDContentTypeCategory.MIXED_LITERAL || |
| 1023 |
!xsdComplexTypeDefinition.getComplexType().isEmptiable()) |
| 1024 |
{ |
| 1025 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-valid-default.2.2.2"); |
| 1026 |
} |
| 1027 |
} |
| 1028 |
} |
| 1029 |
else |
| 1030 |
{ |
| 1031 |
xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition)theTypeDefinition; |
| 1032 |
} |
| 1033 |
|
| 1034 |
if (xsdSimpleTypeDefinition != null) |
| 1035 |
{ |
| 1036 |
if (XSDConstants.isOrIsDerivedFromID(xsdSimpleTypeDefinition)) |
| 1037 |
{ |
| 1038 |
createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "e-props-correct.4"); |
| 1039 |
} |
| 1040 |
else |
| 1041 |
{ |
| 1042 |
checkSimpleTypeConstraint |
| 1043 |
(xsdSimpleTypeDefinition, |
| 1044 |
getLexicalValue(), |
| 1045 |
XSDConstants.PART1, |
| 1046 |
"element-element", |
| 1047 |
theElement, |
| 1048 |
getConstraint() == XSDConstraint.FIXED_LITERAL ? XSDConstants.FIXED_ATTRIBUTE : XSDConstants.DEFAULT_ATTRIBUTE, |
| 1049 |
false); |
| 1050 |
} |
| 1051 |
} |
| 1052 |
} |
| 1053 |
} |
| 1054 |
|
| 1055 |
XSDElementDeclaration substitutionGroupAffiliation = getSubstitutionGroupAffiliation(); |
| 1056 |
if (substitutionGroupAffiliation != null) |
| 1057 |
{ |
| 1058 |
if (substitutionGroupAffiliation.getResolvedElementDeclaration().getContainer() == null) |
| 1059 |
{ |
| 1060 |
createDiagnostic |
| 1061 |
(XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedElementDeclaration_message", substitutionGroupAffiliation.getURI()); |
| 1062 |
} |
| 1063 |
else if (theTypeDefinition != null) |
| 1064 |
{ |
| 1065 |
EList<XSDSubstitutionGroupExclusions> substitutionGroupExclusions = substitutionGroupAffiliation.getSubstitutionGroupExclusions(); |
| 1066 |
XSDTypeDefinition badTypeDefinition = |
| 1067 |
theTypeDefinition.getBadTypeDerivation |
| 1068 |
(substitutionGroupAffiliation.getTypeDefinition(), |
| 1069 |
!substitutionGroupExclusions.contains(XSDSubstitutionGroupExclusions.EXTENSION_LITERAL), |
| 1070 |
!substitutionGroupExclusions.contains(XSDSubstitutionGroupExclusions.RESTRICTION_LITERAL)); |
| 1071 |
if (badTypeDefinition != null) |
| 1072 |
{ |
| 1073 |
if (XSDConstants.isURType(badTypeDefinition) && substitutionGroupAffiliation.getTypeDefinition() != null) |
| 1074 |
{ |
| 1075 |
createDiagnostic |
| 1076 |
(XSDDiagnosticSeverity.ERROR_LITERAL, "e-props-correct.3", substitutionGroupAffiliation.getTypeDefinition().getURI()); |
| 1077 |
} |
| 1078 |
else |
| 1079 |
{ |
| 1080 |
createDiagnostic |
| 1081 |
(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-ct-derived-ok", badTypeDefinition.getURI()); |
| 1082 |
} |
| 1083 |
} |
| 1084 |
} |
| 1085 |
} |
| 1086 |
} |
| 1087 |
} |
| 1088 |
|
| 1089 |
@Override |
| 1090 |
protected void reconcileAttributes(Element changedElement) |
| 1091 |
{ |
| 1092 |
super.reconcileAttributes(changedElement); |
| 1093 |
|
| 1094 |
if (changedElement == getElement()) |
| 1095 |
{ |
| 1096 |
XSDElementDeclaration newResolvedElementDeclaration = this; |
| 1097 |
if (changedElement.hasAttributeNS(null, XSDConstants.REF_ATTRIBUTE)) |
| 1098 |
{ |
| 1099 |
newResolvedElementDeclaration = |
| 1100 |
resolveElementDeclarationURI(XSDConstants.lookupQNameForAttribute(changedElement, XSDConstants.REF_ATTRIBUTE)); |
| 1101 |
} |
| 1102 |
/* |
| 1103 |
else if (!changedElement.hasAttributeNS(null, XSDConstants.NAME_ATTRIBUTE)) |
| 1104 |
{ |
| 1105 |
newResolvedElementDeclaration = resolveElementDeclaration(null, "undefined"); |
| 1106 |
} |
| 1107 |
*/ |
| 1108 |
if (newResolvedElementDeclaration != getResolvedElementDeclaration()) |
| 1109 |
{ |
| 1110 |
setResolvedElementDeclaration(newResolvedElementDeclaration); |
| 1111 |
} |
| 1112 |
|
| 1113 |
if (this == newResolvedElementDeclaration) |
| 1114 |
{ |
| 1115 |
if (changedElement.hasAttributeNS(null, XSDConstants.TYPE_ATTRIBUTE)) |
| 1116 |
{ |
| 1117 |
isTypeExplicit = true; |
| 1118 |
XSDTypeDefinition newTypeDefinition = |
| 1119 |
resolveTypeDefinitionURI(XSDConstants.lookupQNameForAttribute(changedElement, XSDConstants.TYPE_ATTRIBUTE)); |
| 1120 |
if (newTypeDefinition != getTypeDefinition()) |
| 1121 |
{ |
| 1122 |
setTypeDefinition(newTypeDefinition); |
| 1123 |
} |
| 1124 |
} |
| 1125 |
else if (getAnonymousTypeDefinition() != getTypeDefinition()) |
| 1126 |
{ |
| 1127 |
isTypeExplicit = false; |
| 1128 |
setTypeDefinitionGen(resolveSimpleTypeDefinition(changedElement.getNamespaceURI(), "anyType")); |
| 1129 |
} |
| 1130 |
|
| 1131 |
if (changedElement.hasAttributeNS(null, XSDConstants.NILLABLE_ATTRIBUTE)) |
| 1132 |
{ |
| 1133 |
String newNillable = changedElement.getAttributeNS(null, XSDConstants.NILLABLE_ATTRIBUTE); |
| 1134 |
setNillable(convertToBoolean(newNillable)); |
| 1135 |
} |
| 1136 |
else |
| 1137 |
{ |
| 1138 |
unsetNillable(); |
| 1139 |
} |
| 1140 |
|
| 1141 |
if (changedElement.hasAttributeNS(null, XSDConstants.ABSTRACT_ATTRIBUTE)) |
| 1142 |
{ |
| 1143 |
String newAbstract = changedElement.getAttributeNS(null, XSDConstants.ABSTRACT_ATTRIBUTE); |
| 1144 |
setAbstract(convertToBoolean(newAbstract)); |
| 1145 |
} |
| 1146 |
else |
| 1147 |
{ |
| 1148 |
unsetAbstract(); |
| 1149 |
} |
| 1150 |
|
| 1151 |
if (getScope() instanceof XSDSchema) |
| 1152 |
{ |
| 1153 |
if (XSDForm.QUALIFIED_LITERAL != getForm()) |
| 1154 |
{ |
| 1155 |
setForm(XSDForm.QUALIFIED_LITERAL); |
| 1156 |
} |
| 1157 |
} |
| 1158 |
else |
| 1159 |
{ |
| 1160 |
if (changedElement.hasAttributeNS(null, XSDConstants.FORM_ATTRIBUTE)) |
| 1161 |
{ |
| 1162 |
XSDForm newForm = XSDForm.get(changedElement.getAttributeNS(null, XSDConstants.FORM_ATTRIBUTE)); |
| 1163 |
if (!isSetForm() || newForm != getForm()) |
| 1164 |
{ |
| 1165 |
setForm(newForm); |
| 1166 |
} |
| 1167 |
} |
| 1168 |
else if (isSetForm()) |
| 1169 |
{ |
| 1170 |
unsetForm(); |
| 1171 |
} |
| 1172 |
} |
| 1173 |
|
| 1174 |
if (changedElement.hasAttributeNS(null, XSDConstants.FINAL_ATTRIBUTE)) |
| 1175 |
{ |
| 1176 |
setStringLexicalFinal(changedElement.getAttributeNS(null, XSDConstants.FINAL_ATTRIBUTE)); |
| 1177 |
} |
| 1178 |
else if (isSetLexicalFinal()) |
| 1179 |
{ |
| 1180 |
unsetLexicalFinal(); |
| 1181 |
} |
| 1182 |
|
| 1183 |
if (changedElement.hasAttributeNS(null, XSDConstants.BLOCK_ATTRIBUTE)) |
| 1184 |
{ |
| 1185 |
setStringBlock(changedElement.getAttributeNS(null, XSDConstants.BLOCK_ATTRIBUTE)); |
| 1186 |
} |
| 1187 |
else if (isSetBlock()) |
| 1188 |
{ |
| 1189 |
unsetBlock(); |
| 1190 |
} |
| 1191 |
|
| 1192 |
XSDElementDeclaration newSubstituionGroupAffiliation = null; |
| 1193 |
if (changedElement.hasAttributeNS(null, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE)) |
| 1194 |
{ |
| 1195 |
newSubstituionGroupAffiliation = |
| 1196 |
resolveElementDeclarationURI(XSDConstants.lookupQNameForAttribute(changedElement, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE)); |
| 1197 |
} |
| 1198 |
|
| 1199 |
if (newSubstituionGroupAffiliation != getSubstitutionGroupAffiliation()) |
| 1200 |
{ |
| 1201 |
setSubstitutionGroupAffiliation(newSubstituionGroupAffiliation); |
| 1202 |
} |
| 1203 |
} |
| 1204 |
} |
| 1205 |
} |
| 1206 |
|
| 1207 |
@Override |
| 1208 |
protected void reconcileNameAttribute() |
| 1209 |
{ |
| 1210 |
if (!isElementDeclarationReference()) |
| 1211 |
{ |
| 1212 |
super.reconcileNameAttribute(); |
| 1213 |
} |
| 1214 |
} |
| 1215 |
|
| 1216 |
@Override |
| 1217 |
protected void reconcileContents(Element changedElement) |
| 1218 |
{ |
| 1219 |
super.reconcileContents(changedElement); |
| 1220 |
} |
| 1221 |
|
| 1222 |
@Override |
| 1223 |
protected void handleUnreconciledElement(Element child, List<XSDConcreteComponent> newContents, List<XSDConcreteComponent> remainingContents) |
| 1224 |
{ |
| 1225 |
XSDAnnotation xsdAnnotation = XSDAnnotationImpl.createAnnotation(child); |
| 1226 |
if (xsdAnnotation != null) |
| 1227 |
{ |
| 1228 |
if (newContents.isEmpty()) |
| 1229 |
{ |
| 1230 |
newContents.add(xsdAnnotation); |
| 1231 |
} |
| 1232 |
} |
| 1233 |
else |
| 1234 |
{ |
| 1235 |
XSDTypeDefinition xsdTypeDefinition = XSDTypeDefinitionImpl.createTypeDefinition(child); |
| 1236 |
if (xsdTypeDefinition != null) |
| 1237 |
{ |
| 1238 |
newContents.add(xsdTypeDefinition); |
| 1239 |
} |
| 1240 |
else |
| 1241 |
{ |
| 1242 |
XSDIdentityConstraintDefinition xsdIdentityConstraintDefinition = |
| 1243 |
XSDIdentityConstraintDefinitionImpl.createIdentityConstraintDefinition(child); |
| 1244 |
if (xsdIdentityConstraintDefinition != null) |
| 1245 |
{ |
| 1246 |
newContents.add(xsdIdentityConstraintDefinition); |
| 1247 |
} |
| 1248 |
} |
| 1249 |
} |
| 1250 |
} |
| 1251 |
|
| 1252 |
@Override |
| 1253 |
protected void handleReconciliation(List<XSDConcreteComponent> newContents, List<XSDConcreteComponent> remainingContents) |
| 1254 |
{ |
| 1255 |
handleAnnotationReconciliation(XSDPackage.Literals.XSD_ELEMENT_DECLARATION__ANNOTATION, newContents, remainingContents); |
| 1256 |
|
| 1257 |
if (!isElementDeclarationReference()) |
| 1258 |
{ |
| 1259 |
Element theElement = getElement(); |
| 1260 |
XSDTypeDefinition newTypeDefinition = null; |
| 1261 |
XSDTypeDefinition newAnonymousTypeDefinition = null; |
| 1262 |
if (!newContents.isEmpty()) |
| 1263 |
{ |
| 1264 |
XSDConcreteComponent newComponent = newContents.get(0); |
| 1265 |
if (newComponent instanceof XSDTypeDefinition) |
| 1266 |
{ |
| 1267 |
newTypeDefinition = newAnonymousTypeDefinition = (XSDTypeDefinition)newComponent; |
| 1268 |
newContents.remove(0); |
| 1269 |
} |
| 1270 |
} |
| 1271 |
|
| 1272 |
if (newAnonymousTypeDefinition != getAnonymousTypeDefinition()) |
| 1273 |
{ |
| 1274 |
remainingContents.remove(getAnonymousTypeDefinition()); |
| 1275 |
setAnonymousTypeDefinition(newAnonymousTypeDefinition); |
| 1276 |
} |
| 1277 |
|
| 1278 |
for (Iterator<XSDConcreteComponent> i = newContents.iterator(); i.hasNext(); ) |
| 1279 |
{ |
| 1280 |
if (!(i.next() instanceof XSDIdentityConstraintDefinition)) |
| 1281 |
{ |
| 1282 |
i.remove(); |
| 1283 |
} |
| 1284 |
} |
| 1285 |
|
| 1286 |
if (!remainingContents.isEmpty()) |
| 1287 |
{ |
| 1288 |
getIdentityConstraintDefinitions().removeAll(remainingContents); |
| 1289 |
} |
| 1290 |
|
| 1291 |
if (!newContents.isEmpty()) |
| 1292 |
{ |
| 1293 |
@SuppressWarnings("unchecked") List<XSDIdentityConstraintDefinition> list = (List<XSDIdentityConstraintDefinition>)(List<?>)newContents; |
| 1294 |
setListContentAndOrder(getIdentityConstraintDefinitions(), list); |
| 1295 |
} |
| 1296 |
|
| 1297 |
if (theElement.hasAttributeNS(null, XSDConstants.TYPE_ATTRIBUTE)) |
| 1298 |
{ |
| 1299 |
isTypeExplicit = true; |
| 1300 |
newTypeDefinition = resolveTypeDefinitionURI(XSDConstants.lookupQNameForAttribute(theElement, XSDConstants.TYPE_ATTRIBUTE)); |
| 1301 |
} |
| 1302 |
|
| 1303 |
if (newTypeDefinition != null && newTypeDefinition != getTypeDefinition()) |
| 1304 |
{ |
| 1305 |
setTypeDefinitionGen(newTypeDefinition); |
| 1306 |
} |
| 1307 |
} |
| 1308 |
} |
| 1309 |
|
| 1310 |
@Override |
| 1311 |
protected void changeAttribute(EAttribute eAttribute) |
| 1312 |
{ |
| 1313 |
super.changeAttribute(eAttribute); |
| 1314 |
if (!isElementDeclarationReference()) |
| 1315 |
{ |
| 1316 |
if (eAttribute == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__ABSTRACT) |
| 1317 |
{ |
| 1318 |
EList<XSDElementDeclaration> substitutionGroup = getSubstitutionGroup(); |
| 1319 |
Collection<XSDElementDeclaration> visited = new HashSet<XSDElementDeclaration>(); |
| 1320 |
if (isAbstract()) |
| 1321 |
{ |
| 1322 |
substitutionGroup.remove(this); |
| 1323 |
for (XSDElementDeclaration oldSubstitutionGroupAffiliation = substitutionGroupAffiliation; |
| 1324 |
oldSubstitutionGroupAffiliation != null; |
| 1325 |
oldSubstitutionGroupAffiliation = oldSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1326 |
{ |
| 1327 |
if (visited.add(oldSubstitutionGroupAffiliation)) |
| 1328 |
{ |
| 1329 |
oldSubstitutionGroupAffiliation.getSubstitutionGroup().remove(this); |
| 1330 |
} |
| 1331 |
else |
| 1332 |
{ |
| 1333 |
break; |
| 1334 |
} |
| 1335 |
} |
| 1336 |
} |
| 1337 |
else |
| 1338 |
{ |
| 1339 |
substitutionGroup.add(this); |
| 1340 |
for (XSDElementDeclaration newSubstitutionGroupAffiliation = substitutionGroupAffiliation; |
| 1341 |
newSubstitutionGroupAffiliation != null; |
| 1342 |
newSubstitutionGroupAffiliation = newSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1343 |
{ |
| 1344 |
if (visited.add(newSubstitutionGroupAffiliation)) |
| 1345 |
{ |
| 1346 |
newSubstitutionGroupAffiliation.getSubstitutionGroup().add(this); |
| 1347 |
} |
| 1348 |
else |
| 1349 |
{ |
| 1350 |
break; |
| 1351 |
} |
| 1352 |
} |
| 1353 |
} |
| 1354 |
} |
| 1355 |
|
| 1356 |
if (!isReconciling) |
| 1357 |
{ |
| 1358 |
Element theElement = getElement(); |
| 1359 |
if (theElement != null) |
| 1360 |
{ |
| 1361 |
if (eAttribute == null || eAttribute == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__ABSTRACT) |
| 1362 |
{ |
| 1363 |
niceSetAttribute(theElement, XSDConstants.ABSTRACT_ATTRIBUTE, isSetAbstract() ? isAbstract() ? "true" : "false" : null); |
| 1364 |
} |
| 1365 |
if (eAttribute == null || eAttribute == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__NILLABLE) |
| 1366 |
{ |
| 1367 |
niceSetAttribute(theElement, XSDConstants.NILLABLE_ATTRIBUTE, isSetNillable() ? isNillable() ? "true" : "false" : null); |
| 1368 |
} |
| 1369 |
if (eAttribute == null || eAttribute == XSDPackage.Literals.XSD_FEATURE__FORM) |
| 1370 |
{ |
| 1371 |
if (!(getScope() instanceof XSDSchema)) |
| 1372 |
{ |
| 1373 |
niceSetAttribute(theElement, XSDConstants.FORM_ATTRIBUTE, isSetForm() ? getForm().getName() : null); |
| 1374 |
} |
| 1375 |
} |
| 1376 |
if (eAttribute == null || eAttribute == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL) |
| 1377 |
{ |
| 1378 |
niceSetAttribute |
| 1379 |
(theElement, |
| 1380 |
XSDConstants.FINAL_ATTRIBUTE, |
| 1381 |
getStringLexicalFinal()); |
| 1382 |
if (eAttribute != null) |
| 1383 |
{ |
| 1384 |
traverseToRootForPatching(); |
| 1385 |
} |
| 1386 |
} |
| 1387 |
|
| 1388 |
if (eAttribute == null || eAttribute == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__BLOCK) |
| 1389 |
{ |
| 1390 |
niceSetAttribute |
| 1391 |
(theElement, |
| 1392 |
XSDConstants.BLOCK_ATTRIBUTE, |
| 1393 |
getStringBlock()); |
| 1394 |
if (eAttribute != null) |
| 1395 |
{ |
| 1396 |
traverseToRootForPatching(); |
| 1397 |
} |
| 1398 |
} |
| 1399 |
} |
| 1400 |
} |
| 1401 |
if (eAttribute == XSDPackage.Literals.XSD_FEATURE__FORM) |
| 1402 |
{ |
| 1403 |
patchTargetNamespaceAttribute(); |
| 1404 |
} |
| 1405 |
} |
| 1406 |
} |
| 1407 |
|
| 1408 |
@Override |
| 1409 |
public void eNotify(Notification msg) |
| 1410 |
{ |
| 1411 |
int eventType = msg.getEventType(); |
| 1412 |
Object feature = msg.getFeature(); |
| 1413 |
Object oldValue = msg.getOldValue(); |
| 1414 |
Object newValue = msg.getNewValue(); |
| 1415 |
|
| 1416 |
if (feature == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION) |
| 1417 |
{ |
| 1418 |
switch (eventType) |
| 1419 |
{ |
| 1420 |
case Notification.SET: |
| 1421 |
case Notification.UNSET: |
| 1422 |
{ |
| 1423 |
Collection<XSDElementDeclaration> substitutionGroup = new ArrayList<XSDElementDeclaration>(getSubstitutionGroup()); |
| 1424 |
if (!isAbstract()) |
| 1425 |
{ |
| 1426 |
substitutionGroup.add(this); |
| 1427 |
} |
| 1428 |
|
| 1429 |
if (oldValue != null) |
| 1430 |
{ |
| 1431 |
Collection<XSDElementDeclaration> visited = new HashSet<XSDElementDeclaration>(); |
| 1432 |
for (XSDElementDeclaration oldSubstitutionGroupAffiliation = (XSDElementDeclaration)oldValue; |
| 1433 |
oldSubstitutionGroupAffiliation != null; |
| 1434 |
oldSubstitutionGroupAffiliation = oldSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1435 |
{ |
| 1436 |
if (visited.add(oldSubstitutionGroupAffiliation)) |
| 1437 |
{ |
| 1438 |
oldSubstitutionGroupAffiliation.getSubstitutionGroup().removeAll(substitutionGroup); |
| 1439 |
} |
| 1440 |
else |
| 1441 |
{ |
| 1442 |
break; |
| 1443 |
} |
| 1444 |
} |
| 1445 |
} |
| 1446 |
if (newValue != null) |
| 1447 |
{ |
| 1448 |
Collection<XSDElementDeclaration> visited = new HashSet<XSDElementDeclaration>(); |
| 1449 |
for (XSDElementDeclaration newSubstitutionGroupAffiliation = (XSDElementDeclaration)newValue; |
| 1450 |
newSubstitutionGroupAffiliation != null; |
| 1451 |
newSubstitutionGroupAffiliation = newSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1452 |
{ |
| 1453 |
if (visited.add(newSubstitutionGroupAffiliation)) |
| 1454 |
{ |
| 1455 |
newSubstitutionGroupAffiliation.getSubstitutionGroup().addAll(substitutionGroup); |
| 1456 |
} |
| 1457 |
else |
| 1458 |
{ |
| 1459 |
break; |
| 1460 |
} |
| 1461 |
} |
| 1462 |
} |
| 1463 |
break; |
| 1464 |
} |
| 1465 |
} |
| 1466 |
} |
| 1467 |
super.eNotify(msg); |
| 1468 |
} |
| 1469 |
|
| 1470 |
@Override |
| 1471 |
protected void eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID) |
| 1472 |
{ |
| 1473 |
if (substitutionGroupAffiliation != null) |
| 1474 |
{ |
| 1475 |
EList<XSDElementDeclaration> substitutionGroup = getSubstitutionGroup(); |
| 1476 |
Collection<XSDElementDeclaration> visited = new HashSet<XSDElementDeclaration>(); |
| 1477 |
if (newContainer == null) |
| 1478 |
{ |
| 1479 |
for (XSDElementDeclaration oldSubstitutionGroupAffiliation = substitutionGroupAffiliation; |
| 1480 |
oldSubstitutionGroupAffiliation != null; |
| 1481 |
oldSubstitutionGroupAffiliation = oldSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1482 |
{ |
| 1483 |
if (visited.add(oldSubstitutionGroupAffiliation)) |
| 1484 |
{ |
| 1485 |
oldSubstitutionGroupAffiliation.getSubstitutionGroup().removeAll(substitutionGroup); |
| 1486 |
} |
| 1487 |
else |
| 1488 |
{ |
| 1489 |
break; |
| 1490 |
} |
| 1491 |
} |
| 1492 |
} |
| 1493 |
else |
| 1494 |
{ |
| 1495 |
for (XSDElementDeclaration newSubstitutionGroupAffiliation = substitutionGroupAffiliation; |
| 1496 |
newSubstitutionGroupAffiliation != null; |
| 1497 |
newSubstitutionGroupAffiliation = newSubstitutionGroupAffiliation.getSubstitutionGroupAffiliation()) |
| 1498 |
{ |
| 1499 |
if (visited.add(newSubstitutionGroupAffiliation)) |
| 1500 |
{ |
| 1501 |
newSubstitutionGroupAffiliation.getSubstitutionGroup().addAll(substitutionGroup); |
| 1502 |
} |
| 1503 |
else |
| 1504 |
{ |
| 1505 |
break; |
| 1506 |
} |
| 1507 |
} |
| 1508 |
} |
| 1509 |
} |
| 1510 |
super.eBasicSetContainer(newContainer, newContainerFeatureID); |
| 1511 |
} |
| 1512 |
|
| 1513 |
@Override |
| 1514 |
protected void changeReference(EReference eReference) |
| 1515 |
{ |
| 1516 |
super.changeReference(eReference); |
| 1517 |
Element theElement = getElement(); |
| 1518 |
if (isElementDeclarationReference()) |
| 1519 |
{ |
| 1520 |
if (eReference == null || eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION) |
| 1521 |
{ |
| 1522 |
XSDElementDeclaration theResolvedElementDeclaration = getResolvedElementDeclaration(); |
| 1523 |
if (theElement != null) |
| 1524 |
{ |
| 1525 |
niceSetAttributeURIValue(theElement, XSDConstants.REF_ATTRIBUTE, theResolvedElementDeclaration.getURI()); |
| 1526 |
} |
| 1527 |
if (eReference != null && getContainer() instanceof XSDParticle) |
| 1528 |
{ |
| 1529 |
((XSDParticle)getContainer()).setTerm(theResolvedElementDeclaration); |
| 1530 |
} |
| 1531 |
} |
| 1532 |
} |
| 1533 |
else |
| 1534 |
{ |
| 1535 |
if (theElement != null && eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION) |
| 1536 |
{ |
| 1537 |
niceSetAttributeURIValue(theElement, XSDConstants.REF_ATTRIBUTE, null); |
| 1538 |
} |
| 1539 |
|
| 1540 |
if (eReference == null || eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION) |
| 1541 |
{ |
| 1542 |
XSDTypeDefinition theTypeDefinition = getTypeDefinition(); |
| 1543 |
XSDTypeDefinition theAnonymousTypeDefinition = getAnonymousTypeDefinition(); |
| 1544 |
|
| 1545 |
if (!isTypeExplicit || |
| 1546 |
theTypeDefinition == null || |
| 1547 |
theTypeDefinition == theAnonymousTypeDefinition) |
| 1548 |
{ |
| 1549 |
if (theElement != null) |
| 1550 |
{ |
| 1551 |
niceSetAttribute(theElement, XSDConstants.TYPE_ATTRIBUTE, null); |
| 1552 |
} |
| 1553 |
} |
| 1554 |
else |
| 1555 |
{ |
| 1556 |
if (theElement != null) |
| 1557 |
{ |
| 1558 |
niceSetAttributeURIValue(theElement, XSDConstants.TYPE_ATTRIBUTE, theTypeDefinition.getURI()); |
| 1559 |
} |
| 1560 |
if (eReference != null && theAnonymousTypeDefinition != null) |
| 1561 |
{ |
| 1562 |
setAnonymousTypeDefinition(null); |
| 1563 |
} |
| 1564 |
} |
| 1565 |
} |
| 1566 |
if (eReference == null || eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION) |
| 1567 |
{ |
| 1568 |
if (theElement != null) |
| 1569 |
{ |
| 1570 |
XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation(); |
| 1571 |
if (theSubstitutionGroupAffiliation == null) |
| 1572 |
{ |
| 1573 |
niceSetAttribute(theElement, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, null); |
| 1574 |
} |
| 1575 |
else |
| 1576 |
{ |
| 1577 |
niceSetAttributeURIValue(theElement, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, theSubstitutionGroupAffiliation.getURI()); |
| 1578 |
} |
| 1579 |
} |
| 1580 |
} |
| 1581 |
} |
| 1582 |
} |
| 1583 |
|
| 1584 |
@Override |
| 1585 |
protected void adoptContent(EReference eReference, XSDConcreteComponent xsdConcreteComponent) |
| 1586 |
{ |
| 1587 |
super.adoptContent(eReference, xsdConcreteComponent); |
| 1588 |
if (eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION) |
| 1589 |
{ |
| 1590 |
setTypeDefinition((XSDTypeDefinition)xsdConcreteComponent); |
| 1591 |
traverseToRootForPatching(); |
| 1592 |
} |
| 1593 |
} |
| 1594 |
|
| 1595 |
@Override |
| 1596 |
protected void orphanContent(EReference eReference, XSDConcreteComponent xsdConcreteComponent) |
| 1597 |
{ |
| 1598 |
super.orphanContent(eReference, xsdConcreteComponent); |
| 1599 |
if (eReference == XSDPackage.Literals.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION) |
| 1600 |
{ |
| 1601 |
if (getTypeDefinition() == xsdConcreteComponent) |
| 1602 |
{ |
| 1603 |
setTypeDefinition(null); |
| 1604 |
} |
| 1605 |
} |
| 1606 |
} |
| 1607 |
|
| 1608 |
public boolean isElementDeclarationReference() |
| 1609 |
{ |
| 1610 |
return this != getResolvedElementDeclaration(); |
| 1611 |
} |
| 1612 |
|
| 1613 |
/** |
| 1614 |
* <!-- begin-user-doc --> |
| 1615 |
* <!-- end-user-doc --> |
| 1616 |
* @generated modifiable |
| 1617 |
*/ |
| 1618 |
public Boolean getCircular() |
| 1619 |
{ |
| 1620 |
return isCircular() ? Boolean.TRUE : Boolean.FALSE; |
| 1621 |
} |
| 1622 |
|
| 1623 |
@Override |
| 1624 |
public String getQName() |
| 1625 |
{ |
| 1626 |
XSDElementDeclaration resolvedElementDeclaration = getResolvedElementDeclaration(); |
| 1627 |
if (resolvedElementDeclaration == this) |
| 1628 |
{ |
| 1629 |
return super.getQName(); |
| 1630 |
} |
| 1631 |
else |
| 1632 |
{ |
| 1633 |
return resolvedElementDeclaration.getQName(this); |
| 1634 |
} |
| 1635 |
} |
| 1636 |
|
| 1637 |
@Override |
| 1638 |
public boolean isNamedComponentReference() |
| 1639 |
{ |
| 1640 |
return isElementDeclarationReference(); |
| 1641 |
} |
| 1642 |
|
| 1643 |
@Override |
| 1644 |
public XSDNamedComponent getResolvedNamedComponent() |
| 1645 |
{ |
| 1646 |
return getResolvedElementDeclaration(); |
| 1647 |
} |
| 1648 |
|
| 1649 |
@Override |
| 1650 |
public boolean isFeatureReference() |
| 1651 |
{ |
| 1652 |
return isElementDeclarationReference(); |
| 1653 |
} |
| 1654 |
|
| 1655 |
@Override |
| 1656 |
public XSDFeature getResolvedFeature() |
| 1657 |
{ |
| 1658 |
return getResolvedElementDeclaration(); |
| 1659 |
} |
| 1660 |
|
| 1661 |
@Override |
| 1662 |
public XSDTypeDefinition getType() |
| 1663 |
{ |
| 1664 |
return getTypeDefinition(); |
| 1665 |
} |
| 1666 |
|
| 1667 |
public String getStringLexicalFinal() |
| 1668 |
{ |
| 1669 |
if (isSetLexicalFinal()) |
| 1670 |
{ |
| 1671 |
StringBuffer result = new StringBuffer(); |
| 1672 |
for (Object literal : getLexicalFinal()) |
| 1673 |
{ |
| 1674 |
if (result.length() != 0) |
| 1675 |
{ |
| 1676 |
result.append(' '); |
| 1677 |
} |
| 1678 |
if (literal.toString().equals("all")) |
| 1679 |
{ |
| 1680 |
result.append("#all"); |
| 1681 |
} |
| 1682 |
else |
| 1683 |
{ |
| 1684 |
result.append(literal); |
| 1685 |
} |
| 1686 |
} |
| 1687 |
return result.toString(); |
| 1688 |
} |
| 1689 |
else |
| 1690 |
{ |
| 1691 |
return null; |
| 1692 |
} |
| 1693 |
} |
| 1694 |
|
| 1695 |
public void setStringLexicalFinal(String finalDefault) |
| 1696 |
{ |
| 1697 |
if (finalDefault == null) |
| 1698 |
{ |
| 1699 |
unsetLexicalFinal(); |
| 1700 |
} |
| 1701 |
else |
| 1702 |
{ |
| 1703 |
List<XSDProhibitedSubstitutions> newLexicalFinal = new ArrayList<XSDProhibitedSubstitutions>(); |
| 1704 |
for (StringTokenizer stringTokenizer = new StringTokenizer(finalDefault); stringTokenizer.hasMoreTokens(); ) |
| 1705 |
{ |
| 1706 |
String token = stringTokenizer.nextToken(); |
| 1707 |
if (token.equals("#all")) |
| 1708 |
{ |
| 1709 |
token = "all"; |
| 1710 |
} |
| 1711 |
|
| 1712 |
XSDProhibitedSubstitutions literal = XSDProhibitedSubstitutions.get(token); |
| 1713 |
if (literal != null) |
| 1714 |
{ |
| 1715 |
newLexicalFinal.add(literal); |
| 1716 |
} |
| 1717 |
} |
| 1718 |
if (!newLexicalFinal.equals(getLexicalFinal())) |
| 1719 |
{ |
| 1720 |
Collection<XSDProhibitedSubstitutions> oldContents = new ArrayList<XSDProhibitedSubstitutions>(getLexicalFinal()); |
| 1721 |
oldContents.removeAll(newLexicalFinal); |
| 1722 |
if (!oldContents.isEmpty()) |
| 1723 |
{ |
| 1724 |
getLexicalFinal().removeAll(oldContents); |
| 1725 |
} |
| 1726 |
setListContentAndOrder(getLexicalFinal(), newLexicalFinal); |
| 1727 |
} |
| 1728 |
else if (newLexicalFinal.isEmpty() && !isSetLexicalFinal()) |
| 1729 |
{ |
| 1730 |
getLexicalFinal().clear(); |
| 1731 |
} |
| 1732 |
} |
| 1733 |
} |
| 1734 |
|
| 1735 |
public String getStringBlock() |
| 1736 |
{ |
| 1737 |
if (isSetBlock()) |
| 1738 |
{ |
| 1739 |
StringBuffer result = new StringBuffer(); |
| 1740 |
for (Object literal : getBlock()) |
| 1741 |
{ |
| 1742 |
if (result.length() != 0) |
| 1743 |
{ |
| 1744 |
result.append(' '); |
| 1745 |
} |
| 1746 |
if (literal.toString().equals("all")) |
| 1747 |
{ |
| 1748 |
result.append("#all"); |
| 1749 |
} |
| 1750 |
else |
| 1751 |
{ |
| 1752 |
result.append(literal); |
| 1753 |
} |
| 1754 |
} |
| 1755 |
return result.toString(); |
| 1756 |
} |
| 1757 |
else |
| 1758 |
{ |
| 1759 |
return null; |
| 1760 |
} |
| 1761 |
} |
| 1762 |
|
| 1763 |
public void setStringBlock(String block) |
| 1764 |
{ |
| 1765 |
if (block == null) |
| 1766 |
{ |
| 1767 |
unsetBlock(); |
| 1768 |
} |
| 1769 |
else |
| 1770 |
{ |
| 1771 |
List<XSDDisallowedSubstitutions> newBlock = new ArrayList<XSDDisallowedSubstitutions>(); |
| 1772 |
for (StringTokenizer stringTokenizer = new StringTokenizer(block); stringTokenizer.hasMoreTokens(); ) |
| 1773 |
{ |
| 1774 |
String token = stringTokenizer.nextToken(); |
| 1775 |
if (token.equals("#all")) |
| 1776 |
{ |
| 1777 |
token = "all"; |
| 1778 |
} |
| 1779 |
XSDDisallowedSubstitutions literal = XSDDisallowedSubstitutions.get(token); |
| 1780 |
if (literal != null) |
| 1781 |
{ |
| 1782 |
newBlock.add(literal); |
| 1783 |
} |
| 1784 |
} |
| 1785 |
if (!newBlock.equals(getBlock())) |
| 1786 |
{ |
| 1787 |
Collection<XSDDisallowedSubstitutions> oldContents = new ArrayList<XSDDisallowedSubstitutions>(getBlock()); |
| 1788 |
oldContents.removeAll(newBlock); |
| 1789 |
if (!oldContents.isEmpty()) |
| 1790 |
{ |
| 1791 |
getBlock().removeAll(oldContents); |
| 1792 |
} |
| 1793 |
setListContentAndOrder(getBlock(), newBlock); |
| 1794 |
} |
| 1795 |
else if (newBlock.isEmpty() && !isSetBlock()) |
| 1796 |
{ |
| 1797 |
getBlock().clear(); |
| 1798 |
} |
| 1799 |
} |
| 1800 |
} |
| 1801 |
|
| 1802 |
public String getStringDisallowedSubstitutions() |
| 1803 |
{ |
| 1804 |
StringBuffer result = new StringBuffer(); |
| 1805 |
for (Object literal : getDisallowedSubstitutions()) |
| 1806 |
{ |
| 1807 |
if (result.length() != 0) |
| 1808 |
{ |
| 1809 |
result.append(' '); |
| 1810 |
} |
| 1811 |
result.append(literal); |
| 1812 |
} |
| 1813 |
return result.toString(); |
| 1814 |
} |
| 1815 |
|
| 1816 |
public String getStringSubstitutionGroupExclusions() |
| 1817 |
{ |
| 1818 |
StringBuffer result = new StringBuffer(); |
| 1819 |
for (Object literal : getSubstitutionGroupExclusions()) |
| 1820 |
{ |
| 1821 |
if (result.length() != 0) |
| 1822 |
{ |
| 1823 |
result.append(' '); |
| 1824 |
} |
| 1825 |
result.append(literal); |
| 1826 |
} |
| 1827 |
return result.toString(); |
| 1828 |
} |
| 1829 |
|
| 1830 |
public boolean isCircular() |
| 1831 |
{ |
| 1832 |
return analysisState == CIRCULAR; |
| 1833 |
} |
| 1834 |
|
| 1835 |
/** |
| 1836 |
* <!-- begin-user-doc --> |
| 1837 |
* <!-- end-user-doc --> |
| 1838 |
* @generated |
| 1839 |
*/ |
| 1840 |
@Override |
| 1841 |
public XSDAnnotation getAnnotation() |
| 1842 |
{ |
| 1843 |
return annotation; |
| 1844 |
} |
| 1845 |
|
| 1846 |
/** |
| 1847 |
* <!-- begin-user-doc --> |
| 1848 |
* <!-- end-user-doc --> |
| 1849 |
* @generated |
| 1850 |
*/ |
| 1851 |
@Override |
| 1852 |
public void setAnnotation(XSDAnnotation newAnnotation) |
| 1853 |
{ |
| 1854 |
if (newAnnotation != annotation) |
| 1855 |
{ |
| 1856 |
NotificationChain msgs = null; |
| 1857 |
if (annotation != null) |
| 1858 |
msgs = ((InternalEObject)annotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION, null, msgs); |
| 1859 |
if (newAnnotation != null) |
| 1860 |
msgs = ((InternalEObject)newAnnotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION, null, msgs); |
| 1861 |
msgs = basicSetAnnotation(newAnnotation, msgs); |
| 1862 |
if (msgs != null) msgs.dispatch(); |
| 1863 |
} |
| 1864 |
else if (eNotificationRequired()) |
| 1865 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION, newAnnotation, newAnnotation)); |
| 1866 |
} |
| 1867 |
|
| 1868 |
/** |
| 1869 |
* <!-- begin-user-doc --> |
| 1870 |
* <!-- end-user-doc --> |
| 1871 |
* @generated |
| 1872 |
*/ |
| 1873 |
public NotificationChain basicSetAnnotation(XSDAnnotation newAnnotation, NotificationChain msgs) |
| 1874 |
{ |
| 1875 |
XSDAnnotation oldAnnotation = annotation; |
| 1876 |
annotation = newAnnotation; |
| 1877 |
if (eNotificationRequired()) |
| 1878 |
{ |
| 1879 |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION, oldAnnotation, newAnnotation); |
| 1880 |
if (msgs == null) msgs = notification; else msgs.add(notification); |
| 1881 |
} |
| 1882 |
return msgs; |
| 1883 |
} |
| 1884 |
|
| 1885 |
/** |
| 1886 |
* <!-- begin-user-doc --> |
| 1887 |
* <!-- end-user-doc --> |
| 1888 |
* @generated |
| 1889 |
*/ |
| 1890 |
@Override |
| 1891 |
public XSDTypeDefinition getAnonymousTypeDefinition() |
| 1892 |
{ |
| 1893 |
return anonymousTypeDefinition; |
| 1894 |
} |
| 1895 |
|
| 1896 |
/** |
| 1897 |
* <!-- begin-user-doc --> |
| 1898 |
* <!-- end-user-doc --> |
| 1899 |
* @generated |
| 1900 |
*/ |
| 1901 |
@Override |
| 1902 |
public void setAnonymousTypeDefinition(XSDTypeDefinition newAnonymousTypeDefinition) |
| 1903 |
{ |
| 1904 |
if (newAnonymousTypeDefinition != anonymousTypeDefinition) |
| 1905 |
{ |
| 1906 |
NotificationChain msgs = null; |
| 1907 |
if (anonymousTypeDefinition != null) |
| 1908 |
msgs = ((InternalEObject)anonymousTypeDefinition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION, null, msgs); |
| 1909 |
if (newAnonymousTypeDefinition != null) |
| 1910 |
msgs = ((InternalEObject)newAnonymousTypeDefinition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION, null, msgs); |
| 1911 |
msgs = basicSetAnonymousTypeDefinition(newAnonymousTypeDefinition, msgs); |
| 1912 |
if (msgs != null) msgs.dispatch(); |
| 1913 |
} |
| 1914 |
else if (eNotificationRequired()) |
| 1915 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION, newAnonymousTypeDefinition, newAnonymousTypeDefinition)); |
| 1916 |
} |
| 1917 |
|
| 1918 |
/** |
| 1919 |
* <!-- begin-user-doc --> |
| 1920 |
* <!-- end-user-doc --> |
| 1921 |
* @generated |
| 1922 |
*/ |
| 1923 |
public NotificationChain basicSetAnonymousTypeDefinition(XSDTypeDefinition newAnonymousTypeDefinition, NotificationChain msgs) |
| 1924 |
{ |
| 1925 |
XSDTypeDefinition oldAnonymousTypeDefinition = anonymousTypeDefinition; |
| 1926 |
anonymousTypeDefinition = newAnonymousTypeDefinition; |
| 1927 |
if (eNotificationRequired()) |
| 1928 |
{ |
| 1929 |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION, oldAnonymousTypeDefinition, newAnonymousTypeDefinition); |
| 1930 |
if (msgs == null) msgs = notification; else msgs.add(notification); |
| 1931 |
} |
| 1932 |
return msgs; |
| 1933 |
} |
| 1934 |
|
| 1935 |
/** |
| 1936 |
* <!-- begin-user-doc --> |
| 1937 |
* <!-- end-user-doc --> |
| 1938 |
* @generated |
| 1939 |
*/ |
| 1940 |
@Override |
| 1941 |
public XSDTypeDefinition getTypeDefinition() |
| 1942 |
{ |
| 1943 |
return typeDefinition; |
| 1944 |
} |
| 1945 |
|
| 1946 |
/** |
| 1947 |
* <!-- begin-user-doc --> |
| 1948 |
* <!-- end-user-doc --> |
| 1949 |
* @generated |
| 1950 |
*/ |
| 1951 |
public void setTypeDefinitionGen(XSDTypeDefinition newTypeDefinition) |
| 1952 |
{ |
| 1953 |
XSDTypeDefinition oldTypeDefinition = typeDefinition; |
| 1954 |
typeDefinition = newTypeDefinition; |
| 1955 |
if (eNotificationRequired()) |
| 1956 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION, oldTypeDefinition, typeDefinition)); |
| 1957 |
} |
| 1958 |
|
| 1959 |
public void setTypeDefinition(XSDTypeDefinition newTypeDefinition) |
| 1960 |
{ |
| 1961 |
isTypeExplicit = newTypeDefinition != null; |
| 1962 |
setTypeDefinitionGen(newTypeDefinition); |
| 1963 |
} |
| 1964 |
|
| 1965 |
/** |
| 1966 |
* <!-- begin-user-doc --> |
| 1967 |
* <!-- end-user-doc --> |
| 1968 |
* @generated |
| 1969 |
*/ |
| 1970 |
@Override |
| 1971 |
public EList<XSDIdentityConstraintDefinition> getIdentityConstraintDefinitions() |
| 1972 |
{ |
| 1973 |
if (identityConstraintDefinitions == null) |
| 1974 |
{ |
| 1975 |
identityConstraintDefinitions = new EObjectContainmentEList<XSDIdentityConstraintDefinition>(XSDIdentityConstraintDefinition.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS); |
| 1976 |
} |
| 1977 |
return identityConstraintDefinitions; |
| 1978 |
} |
| 1979 |
|
| 1980 |
/** |
| 1981 |
* <!-- begin-user-doc --> |
| 1982 |
* <!-- end-user-doc --> |
| 1983 |
* @generated |
| 1984 |
*/ |
| 1985 |
@Override |
| 1986 |
public XSDElementDeclaration getResolvedElementDeclaration() |
| 1987 |
{ |
| 1988 |
return resolvedElementDeclaration; |
| 1989 |
} |
| 1990 |
|
| 1991 |
/** |
| 1992 |
* <!-- begin-user-doc --> |
| 1993 |
* <!-- end-user-doc --> |
| 1994 |
* @generated |
| 1995 |
*/ |
| 1996 |
@Override |
| 1997 |
public void setResolvedElementDeclaration(XSDElementDeclaration newResolvedElementDeclaration) |
| 1998 |
{ |
| 1999 |
XSDElementDeclaration oldResolvedElementDeclaration = resolvedElementDeclaration; |
| 2000 |
resolvedElementDeclaration = newResolvedElementDeclaration; |
| 2001 |
if (eNotificationRequired()) |
| 2002 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION, oldResolvedElementDeclaration, resolvedElementDeclaration)); |
| 2003 |
} |
| 2004 |
|
| 2005 |
/** |
| 2006 |
* <!-- begin-user-doc --> |
| 2007 |
* <!-- end-user-doc --> |
| 2008 |
* @generated |
| 2009 |
*/ |
| 2010 |
@Override |
| 2011 |
public XSDElementDeclaration getSubstitutionGroupAffiliation() |
| 2012 |
{ |
| 2013 |
return substitutionGroupAffiliation; |
| 2014 |
} |
| 2015 |
|
| 2016 |
/** |
| 2017 |
* <!-- begin-user-doc --> |
| 2018 |
* <!-- end-user-doc --> |
| 2019 |
* @generated |
| 2020 |
*/ |
| 2021 |
@Override |
| 2022 |
public void setSubstitutionGroupAffiliation(XSDElementDeclaration newSubstitutionGroupAffiliation) |
| 2023 |
{ |
| 2024 |
XSDElementDeclaration oldSubstitutionGroupAffiliation = substitutionGroupAffiliation; |
| 2025 |
substitutionGroupAffiliation = newSubstitutionGroupAffiliation; |
| 2026 |
if (eNotificationRequired()) |
| 2027 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION, oldSubstitutionGroupAffiliation, substitutionGroupAffiliation)); |
| 2028 |
} |
| 2029 |
|
| 2030 |
/** |
| 2031 |
* <!-- begin-user-doc --> |
| 2032 |
* <!-- end-user-doc --> |
| 2033 |
* @generated |
| 2034 |
*/ |
| 2035 |
@Override |
| 2036 |
public EList<XSDElementDeclaration> getSubstitutionGroup() |
| 2037 |
{ |
| 2038 |
if (substitutionGroup == null) |
| 2039 |
{ |
| 2040 |
substitutionGroup = new EObjectEList<XSDElementDeclaration>(XSDElementDeclaration.class, this, XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP); |
| 2041 |
} |
| 2042 |
return substitutionGroup; |
| 2043 |
} |
| 2044 |
|
| 2045 |
/** |
| 2046 |
* <!-- begin-user-doc --> |
| 2047 |
* <!-- end-user-doc --> |
| 2048 |
* @generated |
| 2049 |
*/ |
| 2050 |
@Override |
| 2051 |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| 2052 |
{ |
| 2053 |
switch (featureID) |
| 2054 |
{ |
| 2055 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION: |
| 2056 |
return basicSetAnnotation(null, msgs); |
| 2057 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION: |
| 2058 |
return basicSetAnonymousTypeDefinition(null, msgs); |
| 2059 |
case XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS: |
| 2060 |
return ((InternalEList<?>)getIdentityConstraintDefinitions()).basicRemove(otherEnd, msgs); |
| 2061 |
} |
| 2062 |
return super.eInverseRemove(otherEnd, featureID, msgs); |
| 2063 |
} |
| 2064 |
|
| 2065 |
/** |
| 2066 |
* <!-- begin-user-doc --> |
| 2067 |
* <!-- end-user-doc --> |
| 2068 |
* @generated |
| 2069 |
*/ |
| 2070 |
@Override |
| 2071 |
public Object eGet(int featureID, boolean resolve, boolean coreType) |
| 2072 |
{ |
| 2073 |
switch (featureID) |
| 2074 |
{ |
| 2075 |
case XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE: |
| 2076 |
return isNillable(); |
| 2077 |
case XSDPackage.XSD_ELEMENT_DECLARATION__DISALLOWED_SUBSTITUTIONS: |
| 2078 |
return getDisallowedSubstitutions(); |
| 2079 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_EXCLUSIONS: |
| 2080 |
return getSubstitutionGroupExclusions(); |
| 2081 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT: |
| 2082 |
return isAbstract(); |
| 2083 |
case XSDPackage.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL: |
| 2084 |
return getLexicalFinal(); |
| 2085 |
case XSDPackage.XSD_ELEMENT_DECLARATION__BLOCK: |
| 2086 |
return getBlock(); |
| 2087 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ELEMENT_DECLARATION_REFERENCE: |
| 2088 |
return isElementDeclarationReference(); |
| 2089 |
case XSDPackage.XSD_ELEMENT_DECLARATION__CIRCULAR: |
| 2090 |
return isCircular(); |
| 2091 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION: |
| 2092 |
return getAnnotation(); |
| 2093 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION: |
| 2094 |
return getAnonymousTypeDefinition(); |
| 2095 |
case XSDPackage.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION: |
| 2096 |
return getTypeDefinition(); |
| 2097 |
case XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS: |
| 2098 |
return getIdentityConstraintDefinitions(); |
| 2099 |
case XSDPackage.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION: |
| 2100 |
return getResolvedElementDeclaration(); |
| 2101 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION: |
| 2102 |
return getSubstitutionGroupAffiliation(); |
| 2103 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP: |
| 2104 |
return getSubstitutionGroup(); |
| 2105 |
} |
| 2106 |
return super.eGet(featureID, resolve, coreType); |
| 2107 |
} |
| 2108 |
|
| 2109 |
/** |
| 2110 |
* <!-- begin-user-doc --> |
| 2111 |
* <!-- end-user-doc --> |
| 2112 |
* @generated |
| 2113 |
*/ |
| 2114 |
@SuppressWarnings("unchecked") |
| 2115 |
@Override |
| 2116 |
public void eSet(int featureID, Object newValue) |
| 2117 |
{ |
| 2118 |
switch (featureID) |
| 2119 |
{ |
| 2120 |
case XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE: |
| 2121 |
setNillable((Boolean)newValue); |
| 2122 |
return; |
| 2123 |
case XSDPackage.XSD_ELEMENT_DECLARATION__DISALLOWED_SUBSTITUTIONS: |
| 2124 |
getDisallowedSubstitutions().clear(); |
| 2125 |
getDisallowedSubstitutions().addAll((Collection<? extends XSDDisallowedSubstitutions>)newValue); |
| 2126 |
return; |
| 2127 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_EXCLUSIONS: |
| 2128 |
getSubstitutionGroupExclusions().clear(); |
| 2129 |
getSubstitutionGroupExclusions().addAll((Collection<? extends XSDSubstitutionGroupExclusions>)newValue); |
| 2130 |
return; |
| 2131 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT: |
| 2132 |
setAbstract((Boolean)newValue); |
| 2133 |
return; |
| 2134 |
case XSDPackage.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL: |
| 2135 |
getLexicalFinal().clear(); |
| 2136 |
getLexicalFinal().addAll((Collection<? extends XSDProhibitedSubstitutions>)newValue); |
| 2137 |
return; |
| 2138 |
case XSDPackage.XSD_ELEMENT_DECLARATION__BLOCK: |
| 2139 |
getBlock().clear(); |
| 2140 |
getBlock().addAll((Collection<? extends XSDDisallowedSubstitutions>)newValue); |
| 2141 |
return; |
| 2142 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION: |
| 2143 |
setAnnotation((XSDAnnotation)newValue); |
| 2144 |
return; |
| 2145 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION: |
| 2146 |
setAnonymousTypeDefinition((XSDTypeDefinition)newValue); |
| 2147 |
return; |
| 2148 |
case XSDPackage.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION: |
| 2149 |
setTypeDefinition((XSDTypeDefinition)newValue); |
| 2150 |
return; |
| 2151 |
case XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS: |
| 2152 |
getIdentityConstraintDefinitions().clear(); |
| 2153 |
getIdentityConstraintDefinitions().addAll((Collection<? extends XSDIdentityConstraintDefinition>)newValue); |
| 2154 |
return; |
| 2155 |
case XSDPackage.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION: |
| 2156 |
setResolvedElementDeclaration((XSDElementDeclaration)newValue); |
| 2157 |
return; |
| 2158 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION: |
| 2159 |
setSubstitutionGroupAffiliation((XSDElementDeclaration)newValue); |
| 2160 |
return; |
| 2161 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP: |
| 2162 |
getSubstitutionGroup().clear(); |
| 2163 |
getSubstitutionGroup().addAll((Collection<? extends XSDElementDeclaration>)newValue); |
| 2164 |
return; |
| 2165 |
} |
| 2166 |
super.eSet(featureID, newValue); |
| 2167 |
} |
| 2168 |
|
| 2169 |
/** |
| 2170 |
* <!-- begin-user-doc --> |
| 2171 |
* <!-- end-user-doc --> |
| 2172 |
* @generated |
| 2173 |
*/ |
| 2174 |
@Override |
| 2175 |
public void eUnset(int featureID) |
| 2176 |
{ |
| 2177 |
switch (featureID) |
| 2178 |
{ |
| 2179 |
case XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE: |
| 2180 |
unsetNillable(); |
| 2181 |
return; |
| 2182 |
case XSDPackage.XSD_ELEMENT_DECLARATION__DISALLOWED_SUBSTITUTIONS: |
| 2183 |
getDisallowedSubstitutions().clear(); |
| 2184 |
return; |
| 2185 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_EXCLUSIONS: |
| 2186 |
getSubstitutionGroupExclusions().clear(); |
| 2187 |
return; |
| 2188 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT: |
| 2189 |
unsetAbstract(); |
| 2190 |
return; |
| 2191 |
case XSDPackage.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL: |
| 2192 |
unsetLexicalFinal(); |
| 2193 |
return; |
| 2194 |
case XSDPackage.XSD_ELEMENT_DECLARATION__BLOCK: |
| 2195 |
unsetBlock(); |
| 2196 |
return; |
| 2197 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION: |
| 2198 |
setAnnotation((XSDAnnotation)null); |
| 2199 |
return; |
| 2200 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION: |
| 2201 |
setAnonymousTypeDefinition((XSDTypeDefinition)null); |
| 2202 |
return; |
| 2203 |
case XSDPackage.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION: |
| 2204 |
setTypeDefinition((XSDTypeDefinition)null); |
| 2205 |
return; |
| 2206 |
case XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS: |
| 2207 |
getIdentityConstraintDefinitions().clear(); |
| 2208 |
return; |
| 2209 |
case XSDPackage.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION: |
| 2210 |
setResolvedElementDeclaration((XSDElementDeclaration)null); |
| 2211 |
return; |
| 2212 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION: |
| 2213 |
setSubstitutionGroupAffiliation((XSDElementDeclaration)null); |
| 2214 |
return; |
| 2215 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP: |
| 2216 |
getSubstitutionGroup().clear(); |
| 2217 |
return; |
| 2218 |
} |
| 2219 |
super.eUnset(featureID); |
| 2220 |
} |
| 2221 |
|
| 2222 |
/** |
| 2223 |
* <!-- begin-user-doc --> |
| 2224 |
* <!-- end-user-doc --> |
| 2225 |
* @generated |
| 2226 |
*/ |
| 2227 |
@Override |
| 2228 |
public boolean eIsSet(int featureID) |
| 2229 |
{ |
| 2230 |
switch (featureID) |
| 2231 |
{ |
| 2232 |
case XSDPackage.XSD_ELEMENT_DECLARATION__NILLABLE: |
| 2233 |
return isSetNillable(); |
| 2234 |
case XSDPackage.XSD_ELEMENT_DECLARATION__DISALLOWED_SUBSTITUTIONS: |
| 2235 |
return disallowedSubstitutions != null && !disallowedSubstitutions.isEmpty(); |
| 2236 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_EXCLUSIONS: |
| 2237 |
return substitutionGroupExclusions != null && !substitutionGroupExclusions.isEmpty(); |
| 2238 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ABSTRACT: |
| 2239 |
return isSetAbstract(); |
| 2240 |
case XSDPackage.XSD_ELEMENT_DECLARATION__LEXICAL_FINAL: |
| 2241 |
return isSetLexicalFinal(); |
| 2242 |
case XSDPackage.XSD_ELEMENT_DECLARATION__BLOCK: |
| 2243 |
return isSetBlock(); |
| 2244 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ELEMENT_DECLARATION_REFERENCE: |
| 2245 |
return isElementDeclarationReference() != ELEMENT_DECLARATION_REFERENCE_EDEFAULT; |
| 2246 |
case XSDPackage.XSD_ELEMENT_DECLARATION__CIRCULAR: |
| 2247 |
return isCircular() != CIRCULAR_EDEFAULT; |
| 2248 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANNOTATION: |
| 2249 |
return annotation != null; |
| 2250 |
case XSDPackage.XSD_ELEMENT_DECLARATION__ANONYMOUS_TYPE_DEFINITION: |
| 2251 |
return anonymousTypeDefinition != null; |
| 2252 |
case XSDPackage.XSD_ELEMENT_DECLARATION__TYPE_DEFINITION: |
| 2253 |
return typeDefinition != null; |
| 2254 |
case XSDPackage.XSD_ELEMENT_DECLARATION__IDENTITY_CONSTRAINT_DEFINITIONS: |
| 2255 |
return identityConstraintDefinitions != null && !identityConstraintDefinitions.isEmpty(); |
| 2256 |
case XSDPackage.XSD_ELEMENT_DECLARATION__RESOLVED_ELEMENT_DECLARATION: |
| 2257 |
return resolvedElementDeclaration != null; |
| 2258 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP_AFFILIATION: |
| 2259 |
return substitutionGroupAffiliation != null; |
| 2260 |
case XSDPackage.XSD_ELEMENT_DECLARATION__SUBSTITUTION_GROUP: |
| 2261 |
return substitutionGroup != null && !substitutionGroup.isEmpty(); |
| 2262 |
} |
| 2263 |
return super.eIsSet(featureID); |
| 2264 |
} |
| 2265 |
|
| 2266 |
/** |
| 2267 |
* <!-- begin-user-doc --> |
| 2268 |
* <!-- end-user-doc --> |
| 2269 |
* @generated |
| 2270 |
*/ |
| 2271 |
@Override |
| 2272 |
public String toString() |
| 2273 |
{ |
| 2274 |
if (eIsProxy()) return super.toString(); |
| 2275 |
|
| 2276 |
StringBuilder result = new StringBuilder(super.toString()); |
| 2277 |
result.append(" (nillable: "); |
| 2278 |
if ((eFlags & NILLABLE_ESETFLAG) != 0) result.append((eFlags & NILLABLE_EFLAG) != 0); else result.append("<unset>"); |
| 2279 |
result.append(", disallowedSubstitutions: "); |
| 2280 |
result.append(disallowedSubstitutions); |
| 2281 |
result.append(", substitutionGroupExclusions: "); |
| 2282 |
result.append(substitutionGroupExclusions); |
| 2283 |
result.append(", abstract: "); |
| 2284 |
if ((eFlags & ABSTRACT_ESETFLAG) != 0) result.append((eFlags & ABSTRACT_EFLAG) != 0); else result.append("<unset>"); |
| 2285 |
result.append(", lexicalFinal: "); |
| 2286 |
result.append(lexicalFinal); |
| 2287 |
result.append(", block: "); |
| 2288 |
result.append(block); |
| 2289 |
result.append(')'); |
| 2290 |
return result.toString(); |
| 2291 |
} |
| 2292 |
|
| 2293 |
@Override |
| 2294 |
public XSDConcreteComponent cloneConcreteComponent(boolean deep, boolean shareDOM) |
| 2295 |
{ |
| 2296 |
XSDElementDeclarationImpl clonedElementDeclaration = |
| 2297 |
(XSDElementDeclarationImpl)getXSDFactory().createXSDElementDeclaration(); |
| 2298 |
clonedElementDeclaration.isReconciling = true; |
| 2299 |
|
| 2300 |
if (isElementDeclarationReference()) |
| 2301 |
{ |
| 2302 |
XSDElementDeclaration theResolvedElementDeclaration = getResolvedElementDeclaration(); |
| 2303 |
clonedElementDeclaration.setResolvedElementDeclaration |
| 2304 |
(createUnresolvedElementDeclaration |
| 2305 |
(theResolvedElementDeclaration.getTargetNamespace(), theResolvedElementDeclaration.getName())); |
| 2306 |
} |
| 2307 |
else |
| 2308 |
{ |
| 2309 |
if (getName() != null) |
| 2310 |
{ |
| 2311 |
clonedElementDeclaration.setName(getName()); |
| 2312 |
} |
| 2313 |
if (isSetForm()) |
| 2314 |
{ |
| 2315 |
clonedElementDeclaration.setForm(getForm()); |
| 2316 |
} |
| 2317 |
if (isSetConstraint()) |
| 2318 |
{ |
| 2319 |
clonedElementDeclaration.setConstraint(getConstraint()); |
| 2320 |
} |
| 2321 |
if (getLexicalValue() != null) |
| 2322 |
{ |
| 2323 |
clonedElementDeclaration.setLexicalValue(getLexicalValue()); |
| 2324 |
} |
| 2325 |
if (isSetNillable()) |
| 2326 |
{ |
| 2327 |
clonedElementDeclaration.setNillable(isNillable()); |
| 2328 |
} |
| 2329 |
if (isSetAbstract()) |
| 2330 |
{ |
| 2331 |
clonedElementDeclaration.setAbstract(isAbstract()); |
| 2332 |
} |
| 2333 |
if (isSetBlock()) |
| 2334 |
{ |
| 2335 |
if (!getBlock().isEmpty()) |
| 2336 |
{ |
| 2337 |
clonedElementDeclaration.getBlock().addAll(getBlock()); |
| 2338 |
} |
| 2339 |
else |
| 2340 |
{ |
| 2341 |
clonedElementDeclaration.getBlock().clear(); |
| 2342 |
} |
| 2343 |
} |
| 2344 |
if (isSetLexicalFinal()) |
| 2345 |
{ |
| 2346 |
if (!getLexicalFinal().isEmpty()) |
| 2347 |
{ |
| 2348 |
clonedElementDeclaration.getLexicalFinal().addAll(getLexicalFinal()); |
| 2349 |
} |
| 2350 |
else |
| 2351 |
{ |
| 2352 |
clonedElementDeclaration.getLexicalFinal().clear(); |
| 2353 |
} |
| 2354 |
} |
| 2355 |
|
| 2356 |
if (getTypeDefinition() != null && getTypeDefinition() != getAnonymousTypeDefinition()) |
| 2357 |
{ |
| 2358 |
XSDTypeDefinition theTypeDefinition = getTypeDefinition(); |
| 2359 |
clonedElementDeclaration.setTypeDefinition |
| 2360 |
(createUnresolvedTypeDefinition |
| 2361 |
(theTypeDefinition.getTargetNamespace(), theTypeDefinition.getName())); |
| 2362 |
} |
| 2363 |
|
| 2364 |
if (deep) |
| 2365 |
{ |
| 2366 |
if (getAnonymousTypeDefinition() != null) |
| 2367 |
{ |
| 2368 |
clonedElementDeclaration.setAnonymousTypeDefinition |
| 2369 |
((XSDTypeDefinition)getAnonymousTypeDefinition().cloneConcreteComponent(deep, shareDOM)); |
| 2370 |
} |
| 2371 |
if (!getIdentityConstraintDefinitions().isEmpty()) |
| 2372 |
{ |
| 2373 |
clonedElementDeclaration.getIdentityConstraintDefinitions().addAll |
| 2374 |
(cloneConcreteComponents(getIdentityConstraintDefinitions(), true, shareDOM)); |
| 2375 |
} |
| 2376 |
XSDElementDeclaration theSubstitutionGroupAffiliation = getSubstitutionGroupAffiliation(); |
| 2377 |
if (theSubstitutionGroupAffiliation != null) |
| 2378 |
{ |
| 2379 |
clonedElementDeclaration.setSubstitutionGroupAffiliation |
| 2380 |
(createUnresolvedElementDeclaration |
| 2381 |
(theSubstitutionGroupAffiliation.getTargetNamespace(), theSubstitutionGroupAffiliation.getName())); |
| 2382 |
} |
| 2383 |
} |
| 2384 |
} |
| 2385 |
|
| 2386 |
if (deep) |
| 2387 |
{ |
| 2388 |
if (getAnnotation() != null) |
| 2389 |
{ |
| 2390 |
clonedElementDeclaration.setAnnotation((XSDAnnotation)getAnnotation().cloneConcreteComponent(deep, shareDOM)); |
| 2391 |
} |
| 2392 |
} |
| 2393 |
|
| 2394 |
if (shareDOM && getElement() != null) |
| 2395 |
{ |
| 2396 |
clonedElementDeclaration.setElement(getElement()); |
| 2397 |
} |
| 2398 |
|
| 2399 |
clonedElementDeclaration.isReconciling = shareDOM; |
| 2400 |
return clonedElementDeclaration; |
| 2401 |
} |
| 2402 |
} |