| 1 |
/** |
| 2 |
* Copyright (c) 2002-2006 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.Collection; |
| 15 |
import java.util.List; |
| 16 |
|
| 17 |
import org.w3c.dom.Attr; |
| 18 |
import org.w3c.dom.Node; |
| 19 |
|
| 20 |
import org.eclipse.emf.common.notify.Notification; |
| 21 |
import org.eclipse.emf.common.util.EList; |
| 22 |
import org.eclipse.emf.ecore.EClass; |
| 23 |
import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 24 |
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
| 25 |
import org.eclipse.emf.ecore.util.EObjectEList; |
| 26 |
|
| 27 |
import org.eclipse.xsd.XSDConcreteComponent; |
| 28 |
import org.eclipse.xsd.XSDDiagnostic; |
| 29 |
import org.eclipse.xsd.XSDDiagnosticSeverity; |
| 30 |
import org.eclipse.xsd.XSDPackage; |
| 31 |
import org.eclipse.xsd.XSDSchema; |
| 32 |
import org.eclipse.xsd.util.XSDParser; |
| 33 |
|
| 34 |
|
| 35 |
/** |
| 36 |
* <!-- begin-user-doc --> |
| 37 |
* An implementation of the model object '<em><b>Diagnostic</b></em>'. |
| 38 |
* <!-- end-user-doc --> |
| 39 |
* <p> |
| 40 |
* The following features are implemented: |
| 41 |
* </p> |
| 42 |
* <ul> |
| 43 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getSeverity <em>Severity</em>}</li> |
| 44 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getMessage <em>Message</em>}</li> |
| 45 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getLocationURI <em>Location URI</em>}</li> |
| 46 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getLine <em>Line</em>}</li> |
| 47 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getColumn <em>Column</em>}</li> |
| 48 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getNode <em>Node</em>}</li> |
| 49 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getAnnotationURI <em>Annotation URI</em>}</li> |
| 50 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getKey <em>Key</em>}</li> |
| 51 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getSubstitutions <em>Substitutions</em>}</li> |
| 52 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getComponents <em>Components</em>}</li> |
| 53 |
* <li>{@link org.eclipse.xsd.impl.XSDDiagnosticImpl#getPrimaryComponent <em>Primary Component</em>}</li> |
| 54 |
* </ul> |
| 55 |
* |
| 56 |
* @generated |
| 57 |
*/ |
| 58 |
public class XSDDiagnosticImpl |
| 59 |
extends XSDConcreteComponentImpl |
| 60 |
implements XSDDiagnostic |
| 61 |
{ |
| 62 |
/** |
| 63 |
* The default value of the '{@link #getSeverity() <em>Severity</em>}' attribute. |
| 64 |
* <!-- begin-user-doc --> |
| 65 |
* <!-- end-user-doc --> |
| 66 |
* @see #getSeverity() |
| 67 |
* @generated |
| 68 |
* @ordered |
| 69 |
*/ |
| 70 |
protected static final XSDDiagnosticSeverity SEVERITY_EDEFAULT = XSDDiagnosticSeverity.FATAL_LITERAL; |
| 71 |
|
| 72 |
/** |
| 73 |
* The offset of the flags representing the value of the '{@link #getSeverity() <em>Severity</em>}' attribute. |
| 74 |
* <!-- begin-user-doc --> |
| 75 |
* <!-- end-user-doc --> |
| 76 |
* @generated |
| 77 |
* @ordered |
| 78 |
*/ |
| 79 |
protected static final int SEVERITY_EFLAG_OFFSET = 8; |
| 80 |
|
| 81 |
/** |
| 82 |
* The flags representing the default value of the '{@link #getSeverity() <em>Severity</em>}' attribute. |
| 83 |
* <!-- begin-user-doc --> |
| 84 |
* <!-- end-user-doc --> |
| 85 |
* @generated |
| 86 |
* @ordered |
| 87 |
*/ |
| 88 |
protected static final int SEVERITY_EFLAG_DEFAULT = SEVERITY_EDEFAULT.ordinal() << SEVERITY_EFLAG_OFFSET; |
| 89 |
|
| 90 |
/** |
| 91 |
* The array of enumeration values for '{@link XSDDiagnosticSeverity Diagnostic Severity}' |
| 92 |
* <!-- begin-user-doc --> |
| 93 |
* <!-- end-user-doc --> |
| 94 |
* @generated |
| 95 |
* @ordered |
| 96 |
*/ |
| 97 |
private static final XSDDiagnosticSeverity[] SEVERITY_EFLAG_VALUES = XSDDiagnosticSeverity.values(); |
| 98 |
|
| 99 |
/** |
| 100 |
* The flags representing the value of the '{@link #getSeverity() <em>Severity</em>}' attribute. |
| 101 |
* <!-- begin-user-doc --> |
| 102 |
* <!-- end-user-doc --> |
| 103 |
* @see #getSeverity() |
| 104 |
* @generated |
| 105 |
* @ordered |
| 106 |
*/ |
| 107 |
protected static final int SEVERITY_EFLAG = 0x3 << SEVERITY_EFLAG_OFFSET; |
| 108 |
|
| 109 |
/** |
| 110 |
* The default value of the '{@link #getMessage() <em>Message</em>}' attribute. |
| 111 |
* <!-- begin-user-doc --> |
| 112 |
* <!-- end-user-doc --> |
| 113 |
* @see #getMessage() |
| 114 |
* @generated |
| 115 |
* @ordered |
| 116 |
*/ |
| 117 |
protected static final String MESSAGE_EDEFAULT = null; |
| 118 |
|
| 119 |
/** |
| 120 |
* The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. |
| 121 |
* <!-- begin-user-doc --> |
| 122 |
* <!-- end-user-doc --> |
| 123 |
* @see #getMessage() |
| 124 |
* @generated |
| 125 |
* @ordered |
| 126 |
*/ |
| 127 |
protected String message = MESSAGE_EDEFAULT; |
| 128 |
|
| 129 |
/** |
| 130 |
* The default value of the '{@link #getLocationURI() <em>Location URI</em>}' attribute. |
| 131 |
* <!-- begin-user-doc --> |
| 132 |
* <!-- end-user-doc --> |
| 133 |
* @see #getLocationURI() |
| 134 |
* @generated |
| 135 |
* @ordered |
| 136 |
*/ |
| 137 |
protected static final String LOCATION_URI_EDEFAULT = null; |
| 138 |
|
| 139 |
/** |
| 140 |
* The cached value of the '{@link #getLocationURI() <em>Location URI</em>}' attribute. |
| 141 |
* <!-- begin-user-doc --> |
| 142 |
* <!-- end-user-doc --> |
| 143 |
* @see #getLocationURI() |
| 144 |
* @generated |
| 145 |
* @ordered |
| 146 |
*/ |
| 147 |
protected String locationURI = LOCATION_URI_EDEFAULT; |
| 148 |
|
| 149 |
/** |
| 150 |
* The default value of the '{@link #getLine() <em>Line</em>}' attribute. |
| 151 |
* <!-- begin-user-doc --> |
| 152 |
* <!-- end-user-doc --> |
| 153 |
* @see #getLine() |
| 154 |
* @generated |
| 155 |
* @ordered |
| 156 |
*/ |
| 157 |
protected static final int LINE_EDEFAULT = 1; |
| 158 |
|
| 159 |
/** |
| 160 |
* The cached value of the '{@link #getLine() <em>Line</em>}' attribute. |
| 161 |
* <!-- begin-user-doc --> |
| 162 |
* <!-- end-user-doc --> |
| 163 |
* @see #getLine() |
| 164 |
* @generated |
| 165 |
* @ordered |
| 166 |
*/ |
| 167 |
protected int line = LINE_EDEFAULT; |
| 168 |
|
| 169 |
/** |
| 170 |
* The default value of the '{@link #getColumn() <em>Column</em>}' attribute. |
| 171 |
* <!-- begin-user-doc --> |
| 172 |
* <!-- end-user-doc --> |
| 173 |
* @see #getColumn() |
| 174 |
* @generated |
| 175 |
* @ordered |
| 176 |
*/ |
| 177 |
protected static final int COLUMN_EDEFAULT = 1; |
| 178 |
|
| 179 |
/** |
| 180 |
* The cached value of the '{@link #getColumn() <em>Column</em>}' attribute. |
| 181 |
* <!-- begin-user-doc --> |
| 182 |
* <!-- end-user-doc --> |
| 183 |
* @see #getColumn() |
| 184 |
* @generated |
| 185 |
* @ordered |
| 186 |
*/ |
| 187 |
protected int column = COLUMN_EDEFAULT; |
| 188 |
|
| 189 |
/** |
| 190 |
* The default value of the '{@link #getNode() <em>Node</em>}' attribute. |
| 191 |
* <!-- begin-user-doc --> |
| 192 |
* <!-- end-user-doc --> |
| 193 |
* @see #getNode() |
| 194 |
* @generated |
| 195 |
* @ordered |
| 196 |
*/ |
| 197 |
protected static final Node NODE_EDEFAULT = null; |
| 198 |
|
| 199 |
/** |
| 200 |
* The cached value of the '{@link #getNode() <em>Node</em>}' attribute. |
| 201 |
* <!-- begin-user-doc --> |
| 202 |
* <!-- end-user-doc --> |
| 203 |
* @see #getNode() |
| 204 |
* @generated |
| 205 |
* @ordered |
| 206 |
*/ |
| 207 |
protected Node node = NODE_EDEFAULT; |
| 208 |
|
| 209 |
/** |
| 210 |
* The default value of the '{@link #getAnnotationURI() <em>Annotation URI</em>}' attribute. |
| 211 |
* <!-- begin-user-doc --> |
| 212 |
* <!-- end-user-doc --> |
| 213 |
* @see #getAnnotationURI() |
| 214 |
* @generated |
| 215 |
* @ordered |
| 216 |
*/ |
| 217 |
protected static final String ANNOTATION_URI_EDEFAULT = null; |
| 218 |
|
| 219 |
/** |
| 220 |
* The cached value of the '{@link #getAnnotationURI() <em>Annotation URI</em>}' attribute. |
| 221 |
* <!-- begin-user-doc --> |
| 222 |
* <!-- end-user-doc --> |
| 223 |
* @see #getAnnotationURI() |
| 224 |
* @generated |
| 225 |
* @ordered |
| 226 |
*/ |
| 227 |
protected String annotationURI = ANNOTATION_URI_EDEFAULT; |
| 228 |
|
| 229 |
/** |
| 230 |
* The default value of the '{@link #getKey() <em>Key</em>}' attribute. |
| 231 |
* <!-- begin-user-doc --> |
| 232 |
* <!-- end-user-doc --> |
| 233 |
* @see #getKey() |
| 234 |
* @generated |
| 235 |
* @ordered |
| 236 |
*/ |
| 237 |
protected static final String KEY_EDEFAULT = null; |
| 238 |
|
| 239 |
/** |
| 240 |
* The cached value of the '{@link #getKey() <em>Key</em>}' attribute. |
| 241 |
* <!-- begin-user-doc --> |
| 242 |
* <!-- end-user-doc --> |
| 243 |
* @see #getKey() |
| 244 |
* @generated |
| 245 |
* @ordered |
| 246 |
*/ |
| 247 |
protected String key = KEY_EDEFAULT; |
| 248 |
|
| 249 |
/** |
| 250 |
* The cached value of the '{@link #getSubstitutions() <em>Substitutions</em>}' attribute list. |
| 251 |
* <!-- begin-user-doc --> |
| 252 |
* <!-- end-user-doc --> |
| 253 |
* @see #getSubstitutions() |
| 254 |
* @generated |
| 255 |
* @ordered |
| 256 |
*/ |
| 257 |
protected EList<String> substitutions; |
| 258 |
|
| 259 |
/** |
| 260 |
* The cached value of the '{@link #getComponents() <em>Components</em>}' reference list. |
| 261 |
* <!-- begin-user-doc --> |
| 262 |
* <!-- end-user-doc --> |
| 263 |
* @see #getComponents() |
| 264 |
* @generated |
| 265 |
* @ordered |
| 266 |
*/ |
| 267 |
protected EList<XSDConcreteComponent> components; |
| 268 |
|
| 269 |
/** |
| 270 |
* <!-- begin-user-doc --> |
| 271 |
* <!-- end-user-doc --> |
| 272 |
* @generated |
| 273 |
*/ |
| 274 |
protected XSDDiagnosticImpl() |
| 275 |
{ |
| 276 |
super(); |
| 277 |
} |
| 278 |
|
| 279 |
/** |
| 280 |
* <!-- begin-user-doc --> |
| 281 |
* <!-- end-user-doc --> |
| 282 |
* @generated |
| 283 |
*/ |
| 284 |
@Override |
| 285 |
protected EClass eStaticClass() |
| 286 |
{ |
| 287 |
return XSDPackage.Literals.XSD_DIAGNOSTIC; |
| 288 |
} |
| 289 |
|
| 290 |
/** |
| 291 |
* <!-- begin-user-doc --> |
| 292 |
* <!-- end-user-doc --> |
| 293 |
* @generated |
| 294 |
*/ |
| 295 |
@Override |
| 296 |
public XSDDiagnosticSeverity getSeverity() |
| 297 |
{ |
| 298 |
return SEVERITY_EFLAG_VALUES[(eFlags & SEVERITY_EFLAG) >>> SEVERITY_EFLAG_OFFSET]; |
| 299 |
} |
| 300 |
|
| 301 |
/** |
| 302 |
* <!-- begin-user-doc --> |
| 303 |
* <!-- end-user-doc --> |
| 304 |
* @generated |
| 305 |
*/ |
| 306 |
@Override |
| 307 |
public void setSeverity(XSDDiagnosticSeverity newSeverity) |
| 308 |
{ |
| 309 |
XSDDiagnosticSeverity oldSeverity = SEVERITY_EFLAG_VALUES[(eFlags & SEVERITY_EFLAG) >>> SEVERITY_EFLAG_OFFSET]; |
| 310 |
if (newSeverity == null) newSeverity = SEVERITY_EDEFAULT; |
| 311 |
eFlags = eFlags & ~SEVERITY_EFLAG | newSeverity.ordinal() << SEVERITY_EFLAG_OFFSET; |
| 312 |
if (eNotificationRequired()) |
| 313 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__SEVERITY, oldSeverity, newSeverity)); |
| 314 |
} |
| 315 |
|
| 316 |
/** |
| 317 |
* <!-- begin-user-doc --> |
| 318 |
* <!-- end-user-doc --> |
| 319 |
* @generated |
| 320 |
*/ |
| 321 |
@Override |
| 322 |
public String getMessage() |
| 323 |
{ |
| 324 |
return message; |
| 325 |
} |
| 326 |
|
| 327 |
/** |
| 328 |
* <!-- begin-user-doc --> |
| 329 |
* <!-- end-user-doc --> |
| 330 |
* @generated |
| 331 |
*/ |
| 332 |
@Override |
| 333 |
public void setMessage(String newMessage) |
| 334 |
{ |
| 335 |
String oldMessage = message; |
| 336 |
message = newMessage; |
| 337 |
if (eNotificationRequired()) |
| 338 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__MESSAGE, oldMessage, message)); |
| 339 |
} |
| 340 |
|
| 341 |
public String getLocation() |
| 342 |
{ |
| 343 |
return getLocationURI(); |
| 344 |
} |
| 345 |
|
| 346 |
/** |
| 347 |
* <!-- begin-user-doc --> |
| 348 |
* <!-- end-user-doc --> |
| 349 |
* @generated |
| 350 |
*/ |
| 351 |
public String getLocationURIGen() |
| 352 |
{ |
| 353 |
return locationURI; |
| 354 |
} |
| 355 |
|
| 356 |
public String getLocationURI() |
| 357 |
{ |
| 358 |
if (getLocationURIGen() == null) |
| 359 |
{ |
| 360 |
XSDConcreteComponent thePrimaryComponent = getPrimaryComponent(); |
| 361 |
if (thePrimaryComponent != null) |
| 362 |
{ |
| 363 |
XSDSchema xsdSchema = thePrimaryComponent.getSchema(); |
| 364 |
if (xsdSchema != null) |
| 365 |
{ |
| 366 |
return xsdSchema.getSchemaLocation(); |
| 367 |
} |
| 368 |
} |
| 369 |
} |
| 370 |
return getLocationURIGen(); |
| 371 |
} |
| 372 |
|
| 373 |
/** |
| 374 |
* <!-- begin-user-doc --> |
| 375 |
* <!-- end-user-doc --> |
| 376 |
* @generated |
| 377 |
*/ |
| 378 |
@Override |
| 379 |
public void setLocationURI(String newLocationURI) |
| 380 |
{ |
| 381 |
String oldLocationURI = locationURI; |
| 382 |
locationURI = newLocationURI; |
| 383 |
if (eNotificationRequired()) |
| 384 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__LOCATION_URI, oldLocationURI, locationURI)); |
| 385 |
} |
| 386 |
|
| 387 |
/** |
| 388 |
* <!-- begin-user-doc --> |
| 389 |
* <!-- end-user-doc --> |
| 390 |
* @generated |
| 391 |
*/ |
| 392 |
public int getLineGen() |
| 393 |
{ |
| 394 |
return line; |
| 395 |
} |
| 396 |
|
| 397 |
public int getLine() |
| 398 |
{ |
| 399 |
Node theNode = getNode(); |
| 400 |
if (theNode != null && theNode.getNodeType() == Node.ATTRIBUTE_NODE) |
| 401 |
{ |
| 402 |
theNode = ((Attr)theNode).getOwnerElement(); |
| 403 |
} |
| 404 |
if (theNode != null && XSDParser.getUserData(theNode) != null) |
| 405 |
{ |
| 406 |
return XSDParser.getStartLine(theNode); |
| 407 |
} |
| 408 |
|
| 409 |
return getLineGen(); |
| 410 |
} |
| 411 |
|
| 412 |
/** |
| 413 |
* <!-- begin-user-doc --> |
| 414 |
* <!-- end-user-doc --> |
| 415 |
* @generated |
| 416 |
*/ |
| 417 |
@Override |
| 418 |
public void setLine(int newLine) |
| 419 |
{ |
| 420 |
int oldLine = line; |
| 421 |
line = newLine; |
| 422 |
if (eNotificationRequired()) |
| 423 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__LINE, oldLine, line)); |
| 424 |
} |
| 425 |
|
| 426 |
/** |
| 427 |
* <!-- begin-user-doc --> |
| 428 |
* <!-- end-user-doc --> |
| 429 |
* @generated |
| 430 |
*/ |
| 431 |
public int getColumnGen() |
| 432 |
{ |
| 433 |
return column; |
| 434 |
} |
| 435 |
|
| 436 |
public int getColumn() |
| 437 |
{ |
| 438 |
Node theNode = getNode(); |
| 439 |
if (theNode != null && theNode.getNodeType() == Node.ATTRIBUTE_NODE) |
| 440 |
{ |
| 441 |
theNode = ((Attr)theNode).getOwnerElement(); |
| 442 |
} |
| 443 |
if (theNode != null && XSDParser.getUserData(theNode) != null) |
| 444 |
{ |
| 445 |
return XSDParser.getStartColumn(theNode); |
| 446 |
} |
| 447 |
|
| 448 |
return getColumnGen(); |
| 449 |
} |
| 450 |
|
| 451 |
/** |
| 452 |
* <!-- begin-user-doc --> |
| 453 |
* <!-- end-user-doc --> |
| 454 |
* @generated |
| 455 |
*/ |
| 456 |
@Override |
| 457 |
public void setColumn(int newColumn) |
| 458 |
{ |
| 459 |
int oldColumn = column; |
| 460 |
column = newColumn; |
| 461 |
if (eNotificationRequired()) |
| 462 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__COLUMN, oldColumn, column)); |
| 463 |
} |
| 464 |
|
| 465 |
/** |
| 466 |
* <!-- begin-user-doc --> |
| 467 |
* <!-- end-user-doc --> |
| 468 |
* @generated |
| 469 |
*/ |
| 470 |
@Override |
| 471 |
public Node getNode() |
| 472 |
{ |
| 473 |
return node; |
| 474 |
} |
| 475 |
|
| 476 |
/** |
| 477 |
* <!-- begin-user-doc --> |
| 478 |
* <!-- end-user-doc --> |
| 479 |
* @generated |
| 480 |
*/ |
| 481 |
@Override |
| 482 |
public void setNode(Node newNode) |
| 483 |
{ |
| 484 |
Node oldNode = node; |
| 485 |
node = newNode; |
| 486 |
if (eNotificationRequired()) |
| 487 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__NODE, oldNode, node)); |
| 488 |
} |
| 489 |
|
| 490 |
/** |
| 491 |
* <!-- begin-user-doc --> |
| 492 |
* <!-- end-user-doc --> |
| 493 |
* @generated |
| 494 |
*/ |
| 495 |
@Override |
| 496 |
public String getAnnotationURI() |
| 497 |
{ |
| 498 |
return annotationURI; |
| 499 |
} |
| 500 |
|
| 501 |
/** |
| 502 |
* <!-- begin-user-doc --> |
| 503 |
* <!-- end-user-doc --> |
| 504 |
* @generated |
| 505 |
*/ |
| 506 |
@Override |
| 507 |
public void setAnnotationURI(String newAnnotationURI) |
| 508 |
{ |
| 509 |
String oldAnnotationURI = annotationURI; |
| 510 |
annotationURI = newAnnotationURI; |
| 511 |
if (eNotificationRequired()) |
| 512 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__ANNOTATION_URI, oldAnnotationURI, annotationURI)); |
| 513 |
} |
| 514 |
|
| 515 |
/** |
| 516 |
* <!-- begin-user-doc --> |
| 517 |
* <!-- end-user-doc --> |
| 518 |
* @generated |
| 519 |
*/ |
| 520 |
@Override |
| 521 |
public String getKey() |
| 522 |
{ |
| 523 |
return key; |
| 524 |
} |
| 525 |
|
| 526 |
/** |
| 527 |
* <!-- begin-user-doc --> |
| 528 |
* <!-- end-user-doc --> |
| 529 |
* @generated |
| 530 |
*/ |
| 531 |
@Override |
| 532 |
public void setKey(String newKey) |
| 533 |
{ |
| 534 |
String oldKey = key; |
| 535 |
key = newKey; |
| 536 |
if (eNotificationRequired()) |
| 537 |
eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_DIAGNOSTIC__KEY, oldKey, key)); |
| 538 |
} |
| 539 |
|
| 540 |
/** |
| 541 |
* <!-- begin-user-doc --> |
| 542 |
* <!-- end-user-doc --> |
| 543 |
* @generated |
| 544 |
*/ |
| 545 |
@Override |
| 546 |
public EList<String> getSubstitutions() |
| 547 |
{ |
| 548 |
if (substitutions == null) |
| 549 |
{ |
| 550 |
substitutions = new EDataTypeUniqueEList<String>(String.class, this, XSDPackage.XSD_DIAGNOSTIC__SUBSTITUTIONS); |
| 551 |
} |
| 552 |
return substitutions; |
| 553 |
} |
| 554 |
|
| 555 |
/** |
| 556 |
* <!-- begin-user-doc --> |
| 557 |
* <!-- end-user-doc --> |
| 558 |
* @generated |
| 559 |
*/ |
| 560 |
@Override |
| 561 |
public EList<XSDConcreteComponent> getComponents() |
| 562 |
{ |
| 563 |
if (components == null) |
| 564 |
{ |
| 565 |
components = new EObjectEList<XSDConcreteComponent>(XSDConcreteComponent.class, this, XSDPackage.XSD_DIAGNOSTIC__COMPONENTS); |
| 566 |
} |
| 567 |
return components; |
| 568 |
} |
| 569 |
|
| 570 |
/** |
| 571 |
* <!-- begin-user-doc --> |
| 572 |
* <!-- end-user-doc --> |
| 573 |
* @generated modifiable |
| 574 |
*/ |
| 575 |
public XSDConcreteComponent getPrimaryComponent() |
| 576 |
{ |
| 577 |
List<XSDConcreteComponent> theComponents = getComponents(); |
| 578 |
return |
| 579 |
theComponents.size() > 0 ? |
| 580 |
theComponents.get(0) : |
| 581 |
null; |
| 582 |
} |
| 583 |
|
| 584 |
/** |
| 585 |
* <!-- begin-user-doc --> |
| 586 |
* <!-- end-user-doc --> |
| 587 |
* @generated modifiable |
| 588 |
*/ |
| 589 |
public void setPrimaryComponent(XSDConcreteComponent primaryComponent) |
| 590 |
{ |
| 591 |
List<XSDConcreteComponent> theComponents = getComponents(); |
| 592 |
if (primaryComponent == null) |
| 593 |
{ |
| 594 |
theComponents.clear(); |
| 595 |
} |
| 596 |
else if (theComponents.size() > 0) |
| 597 |
{ |
| 598 |
theComponents.set(0, primaryComponent); |
| 599 |
} |
| 600 |
else |
| 601 |
{ |
| 602 |
theComponents.add(primaryComponent); |
| 603 |
} |
| 604 |
} |
| 605 |
|
| 606 |
/** |
| 607 |
* <!-- begin-user-doc --> |
| 608 |
* <!-- end-user-doc --> |
| 609 |
* @generated |
| 610 |
*/ |
| 611 |
@Override |
| 612 |
public Object eGet(int featureID, boolean resolve, boolean coreType) |
| 613 |
{ |
| 614 |
switch (featureID) |
| 615 |
{ |
| 616 |
case XSDPackage.XSD_DIAGNOSTIC__SEVERITY: |
| 617 |
return getSeverity(); |
| 618 |
case XSDPackage.XSD_DIAGNOSTIC__MESSAGE: |
| 619 |
return getMessage(); |
| 620 |
case XSDPackage.XSD_DIAGNOSTIC__LOCATION_URI: |
| 621 |
return getLocationURI(); |
| 622 |
case XSDPackage.XSD_DIAGNOSTIC__LINE: |
| 623 |
return getLine(); |
| 624 |
case XSDPackage.XSD_DIAGNOSTIC__COLUMN: |
| 625 |
return getColumn(); |
| 626 |
case XSDPackage.XSD_DIAGNOSTIC__NODE: |
| 627 |
return getNode(); |
| 628 |
case XSDPackage.XSD_DIAGNOSTIC__ANNOTATION_URI: |
| 629 |
return getAnnotationURI(); |
| 630 |
case XSDPackage.XSD_DIAGNOSTIC__KEY: |
| 631 |
return getKey(); |
| 632 |
case XSDPackage.XSD_DIAGNOSTIC__SUBSTITUTIONS: |
| 633 |
return getSubstitutions(); |
| 634 |
case XSDPackage.XSD_DIAGNOSTIC__COMPONENTS: |
| 635 |
return getComponents(); |
| 636 |
case XSDPackage.XSD_DIAGNOSTIC__PRIMARY_COMPONENT: |
| 637 |
return getPrimaryComponent(); |
| 638 |
} |
| 639 |
return super.eGet(featureID, resolve, coreType); |
| 640 |
} |
| 641 |
|
| 642 |
/** |
| 643 |
* <!-- begin-user-doc --> |
| 644 |
* <!-- end-user-doc --> |
| 645 |
* @generated |
| 646 |
*/ |
| 647 |
@SuppressWarnings("unchecked") |
| 648 |
@Override |
| 649 |
public void eSet(int featureID, Object newValue) |
| 650 |
{ |
| 651 |
switch (featureID) |
| 652 |
{ |
| 653 |
case XSDPackage.XSD_DIAGNOSTIC__SEVERITY: |
| 654 |
setSeverity((XSDDiagnosticSeverity)newValue); |
| 655 |
return; |
| 656 |
case XSDPackage.XSD_DIAGNOSTIC__MESSAGE: |
| 657 |
setMessage((String)newValue); |
| 658 |
return; |
| 659 |
case XSDPackage.XSD_DIAGNOSTIC__LOCATION_URI: |
| 660 |
setLocationURI((String)newValue); |
| 661 |
return; |
| 662 |
case XSDPackage.XSD_DIAGNOSTIC__LINE: |
| 663 |
setLine((Integer)newValue); |
| 664 |
return; |
| 665 |
case XSDPackage.XSD_DIAGNOSTIC__COLUMN: |
| 666 |
setColumn((Integer)newValue); |
| 667 |
return; |
| 668 |
case XSDPackage.XSD_DIAGNOSTIC__NODE: |
| 669 |
setNode((Node)newValue); |
| 670 |
return; |
| 671 |
case XSDPackage.XSD_DIAGNOSTIC__ANNOTATION_URI: |
| 672 |
setAnnotationURI((String)newValue); |
| 673 |
return; |
| 674 |
case XSDPackage.XSD_DIAGNOSTIC__KEY: |
| 675 |
setKey((String)newValue); |
| 676 |
return; |
| 677 |
case XSDPackage.XSD_DIAGNOSTIC__SUBSTITUTIONS: |
| 678 |
getSubstitutions().clear(); |
| 679 |
getSubstitutions().addAll((Collection<? extends String>)newValue); |
| 680 |
return; |
| 681 |
case XSDPackage.XSD_DIAGNOSTIC__COMPONENTS: |
| 682 |
getComponents().clear(); |
| 683 |
getComponents().addAll((Collection<? extends XSDConcreteComponent>)newValue); |
| 684 |
return; |
| 685 |
case XSDPackage.XSD_DIAGNOSTIC__PRIMARY_COMPONENT: |
| 686 |
setPrimaryComponent((XSDConcreteComponent)newValue); |
| 687 |
return; |
| 688 |
} |
| 689 |
super.eSet(featureID, newValue); |
| 690 |
} |
| 691 |
|
| 692 |
/** |
| 693 |
* <!-- begin-user-doc --> |
| 694 |
* <!-- end-user-doc --> |
| 695 |
* @generated |
| 696 |
*/ |
| 697 |
@Override |
| 698 |
public void eUnset(int featureID) |
| 699 |
{ |
| 700 |
switch (featureID) |
| 701 |
{ |
| 702 |
case XSDPackage.XSD_DIAGNOSTIC__SEVERITY: |
| 703 |
setSeverity(SEVERITY_EDEFAULT); |
| 704 |
return; |
| 705 |
case XSDPackage.XSD_DIAGNOSTIC__MESSAGE: |
| 706 |
setMessage(MESSAGE_EDEFAULT); |
| 707 |
return; |
| 708 |
case XSDPackage.XSD_DIAGNOSTIC__LOCATION_URI: |
| 709 |
setLocationURI(LOCATION_URI_EDEFAULT); |
| 710 |
return; |
| 711 |
case XSDPackage.XSD_DIAGNOSTIC__LINE: |
| 712 |
setLine(LINE_EDEFAULT); |
| 713 |
return; |
| 714 |
case XSDPackage.XSD_DIAGNOSTIC__COLUMN: |
| 715 |
setColumn(COLUMN_EDEFAULT); |
| 716 |
return; |
| 717 |
case XSDPackage.XSD_DIAGNOSTIC__NODE: |
| 718 |
setNode(NODE_EDEFAULT); |
| 719 |
return; |
| 720 |
case XSDPackage.XSD_DIAGNOSTIC__ANNOTATION_URI: |
| 721 |
setAnnotationURI(ANNOTATION_URI_EDEFAULT); |
| 722 |
return; |
| 723 |
case XSDPackage.XSD_DIAGNOSTIC__KEY: |
| 724 |
setKey(KEY_EDEFAULT); |
| 725 |
return; |
| 726 |
case XSDPackage.XSD_DIAGNOSTIC__SUBSTITUTIONS: |
| 727 |
getSubstitutions().clear(); |
| 728 |
return; |
| 729 |
case XSDPackage.XSD_DIAGNOSTIC__COMPONENTS: |
| 730 |
getComponents().clear(); |
| 731 |
return; |
| 732 |
case XSDPackage.XSD_DIAGNOSTIC__PRIMARY_COMPONENT: |
| 733 |
setPrimaryComponent((XSDConcreteComponent)null); |
| 734 |
return; |
| 735 |
} |
| 736 |
super.eUnset(featureID); |
| 737 |
} |
| 738 |
|
| 739 |
/** |
| 740 |
* <!-- begin-user-doc --> |
| 741 |
* <!-- end-user-doc --> |
| 742 |
* @generated |
| 743 |
*/ |
| 744 |
@Override |
| 745 |
public boolean eIsSet(int featureID) |
| 746 |
{ |
| 747 |
switch (featureID) |
| 748 |
{ |
| 749 |
case XSDPackage.XSD_DIAGNOSTIC__SEVERITY: |
| 750 |
return (eFlags & SEVERITY_EFLAG) != SEVERITY_EFLAG_DEFAULT; |
| 751 |
case XSDPackage.XSD_DIAGNOSTIC__MESSAGE: |
| 752 |
return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); |
| 753 |
case XSDPackage.XSD_DIAGNOSTIC__LOCATION_URI: |
| 754 |
return LOCATION_URI_EDEFAULT == null ? locationURI != null : !LOCATION_URI_EDEFAULT.equals(locationURI); |
| 755 |
case XSDPackage.XSD_DIAGNOSTIC__LINE: |
| 756 |
return line != LINE_EDEFAULT; |
| 757 |
case XSDPackage.XSD_DIAGNOSTIC__COLUMN: |
| 758 |
return column != COLUMN_EDEFAULT; |
| 759 |
case XSDPackage.XSD_DIAGNOSTIC__NODE: |
| 760 |
return NODE_EDEFAULT == null ? node != null : !NODE_EDEFAULT.equals(node); |
| 761 |
case XSDPackage.XSD_DIAGNOSTIC__ANNOTATION_URI: |
| 762 |
return ANNOTATION_URI_EDEFAULT == null ? annotationURI != null : !ANNOTATION_URI_EDEFAULT.equals(annotationURI); |
| 763 |
case XSDPackage.XSD_DIAGNOSTIC__KEY: |
| 764 |
return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); |
| 765 |
case XSDPackage.XSD_DIAGNOSTIC__SUBSTITUTIONS: |
| 766 |
return substitutions != null && !substitutions.isEmpty(); |
| 767 |
case XSDPackage.XSD_DIAGNOSTIC__COMPONENTS: |
| 768 |
return components != null && !components.isEmpty(); |
| 769 |
case XSDPackage.XSD_DIAGNOSTIC__PRIMARY_COMPONENT: |
| 770 |
return getPrimaryComponent() != null; |
| 771 |
} |
| 772 |
return super.eIsSet(featureID); |
| 773 |
} |
| 774 |
|
| 775 |
/** |
| 776 |
* <!-- begin-user-doc --> |
| 777 |
* <!-- end-user-doc --> |
| 778 |
* @generated modifiable |
| 779 |
*/ |
| 780 |
public void unsetPrimaryComponent() |
| 781 |
{ |
| 782 |
List<XSDConcreteComponent> theComponents = getComponents(); |
| 783 |
theComponents.clear(); |
| 784 |
} |
| 785 |
|
| 786 |
/** |
| 787 |
* <!-- begin-user-doc --> |
| 788 |
* <!-- end-user-doc --> |
| 789 |
* @generated modifiable |
| 790 |
*/ |
| 791 |
public boolean isSetPrimaryComponent() |
| 792 |
{ |
| 793 |
List<XSDConcreteComponent> theComponents = getComponents(); |
| 794 |
return !theComponents.isEmpty(); |
| 795 |
} |
| 796 |
|
| 797 |
/** |
| 798 |
* <!-- begin-user-doc --> |
| 799 |
* <!-- end-user-doc --> |
| 800 |
* @generated |
| 801 |
*/ |
| 802 |
@Override |
| 803 |
public String toString() |
| 804 |
{ |
| 805 |
if (eIsProxy()) return super.toString(); |
| 806 |
|
| 807 |
StringBuilder result = new StringBuilder(super.toString()); |
| 808 |
result.append(" (severity: "); |
| 809 |
result.append(SEVERITY_EFLAG_VALUES[(eFlags & SEVERITY_EFLAG) >>> SEVERITY_EFLAG_OFFSET]); |
| 810 |
result.append(", message: "); |
| 811 |
result.append(message); |
| 812 |
result.append(", locationURI: "); |
| 813 |
result.append(locationURI); |
| 814 |
result.append(", line: "); |
| 815 |
result.append(line); |
| 816 |
result.append(", column: "); |
| 817 |
result.append(column); |
| 818 |
result.append(", node: "); |
| 819 |
result.append(node); |
| 820 |
result.append(", annotationURI: "); |
| 821 |
result.append(annotationURI); |
| 822 |
result.append(", key: "); |
| 823 |
result.append(key); |
| 824 |
result.append(", substitutions: "); |
| 825 |
result.append(substitutions); |
| 826 |
result.append(')'); |
| 827 |
return result.toString(); |
| 828 |
} |
| 829 |
|
| 830 |
} |