Debian Codegraph @

plugins/org.eclipse.xsd/src/org/eclipse/xsd/impl/XSDConstrainingFacetImpl.java

raw
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 org.w3c.dom.Node;
15
16 import org.eclipse.emf.ecore.EClass;
17
18 import org.eclipse.xsd.XSDConstrainingFacet;
19 import org.eclipse.xsd.XSDPackage;
20 import org.eclipse.xsd.XSDSimpleTypeDefinition;
21 import org.eclipse.xsd.util.XSDConstants;
22
23
24 /**
25 * <!-- begin-user-doc -->
26 * An implementation of the model object '<em><b>Constraining Facet</b></em>'.
27 * <!-- end-user-doc -->
28 *
29 * @generated
30 */
31 public abstract class XSDConstrainingFacetImpl
32 extends XSDFacetImpl
33 implements XSDConstrainingFacet
34 {
35 public static XSDConstrainingFacet createConstrainingFacet(Node node)
36 {
37 XSDConstrainingFacet result = XSDFixedFacetImpl.createFixedFacet(node);
38 if (result == null)
39 {
40 result = XSDRepeatableFacetImpl.createRepeatableFacet(node);
41 }
42 return result;
43 }
44
45 /**
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @generated
49 */
50 protected XSDConstrainingFacetImpl()
51 {
52 super();
53 }
54
55 /**
56 * <!-- begin-user-doc -->
57 * <!-- end-user-doc -->
58 * @generated
59 */
60 @Override
61 protected EClass eStaticClass()
62 {
63 return XSDPackage.Literals.XSD_CONSTRAINING_FACET;
64 }
65
66 @Override
67 public void validate()
68 {
69 XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition)getContainer();
70 if (!xsdSimpleTypeDefinition.getValidFacets().contains(getFacetName()) && !xsdSimpleTypeDefinition.isCircular())
71 {
72 XSDSimpleTypeDefinition rootTypeDefinition = xsdSimpleTypeDefinition.getRootTypeDefinition();
73 reportConstraintViolation
74 (XSDConstants.PART2,
75 "cos-applicable-facets",
76 getElement(),
77 null,
78 new Object [] { getFacetName(), rootTypeDefinition.getURI() });
79 }
80 else
81 {
82 super.validate();
83 }
84 }
85
86 public boolean isConstraintSatisfied(Object value)
87 {
88 return false;
89 }
90 }