コード例 #1
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link LibraryPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static LibraryPackage init() {
    if (isInited)
      return (LibraryPackage) EPackage.Registry.INSTANCE.getEPackage(LibraryPackage.eNS_URI);

    // Obtain or create and register package
    LibraryPackageImpl theLibraryPackage =
        (LibraryPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof LibraryPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new LibraryPackageImpl());

    isInited = true;

    // Create package meta-data objects
    theLibraryPackage.createPackageContents();

    // Initialize created meta-data
    theLibraryPackage.initializePackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theLibraryPackage,
        new EValidator.Descriptor() {
          public EValidator getEValidator() {
            return LibraryValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theLibraryPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(LibraryPackage.eNS_URI, theLibraryPackage);
    return theLibraryPackage;
  }
コード例 #2
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends. Simple dependencies are satisfied by calling this method on all dependent
   * packages before doing anything else. This method drives initialization for interdependent
   * packages directly, in parallel with this package, itself.
   *
   * <p>Of this package and its interdependencies, all packages which have not yet been registered
   * by their URI values are first created and registered. The packages are then initialized in two
   * steps: meta-model objects for all of the packages are created before any are initialized, since
   * one package's meta-model objects may refer to those of another.
   *
   * <p>Invocation of this method will not affect any packages that have already been initialized.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static ScrPackage init() {
    if (isInited) return (ScrPackage) EPackage.Registry.INSTANCE.getEPackage(ScrPackage.eNS_URI);

    // Obtain or create and register package
    ScrPackageImpl theScrPackage =
        (ScrPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ScrPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI)
                : new ScrPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    XMLTypePackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theScrPackage.createPackageContents();

    // Initialize created meta-data
    theScrPackage.initializePackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theScrPackage,
        new EValidator.Descriptor() {
          public EValidator getEValidator() {
            return ScrValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theScrPackage.freeze();

    return theScrPackage;
  }
コード例 #3
0
ファイル: LanguageConfig.java プロジェクト: huibo-shi/xtext
  /** @since 2.3 */
  protected void validateGrammar(Grammar grammar) {
    validateAllImports(grammar);
    EValidator validator = EValidator.Registry.INSTANCE.getEValidator(XtextPackage.eINSTANCE);
    if (validator != null) {
      DiagnosticChain chain =
          new DiagnosticChain() {

            @Override
            public void add(Diagnostic diagnostic) {
              if (diagnostic.getSeverity() == Diagnostic.ERROR) {
                if (diagnostic.getException() == null)
                  throw new IllegalStateException(diagnostic.getMessage());
                else
                  throw new IllegalStateException(
                      diagnostic.getMessage(), diagnostic.getException());
              }
            }

            @Override
            public void addAll(Diagnostic diagnostic) {
              add(diagnostic);
            }

            @Override
            public void merge(Diagnostic diagnostic) {
              throw new UnsupportedOperationException();
            }
          };
      validator.validate(grammar, chain, null);
      TreeIterator<EObject> iterator = grammar.eAllContents();
      while (iterator.hasNext())
        validator.validate(iterator.next(), chain, new HashMap<Object, Object>());
    }
  }
コード例 #4
0
ファイル: ModelPackageImpl.java プロジェクト: master-mck/ECP
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link ModelPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static ModelPackage init() {
    if (isInited) {
      return (ModelPackage) EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI);
    }

    // Obtain or create and register package
    final ModelPackageImpl theModelPackage =
        (ModelPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ModelPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new ModelPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    VCategorizationPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theModelPackage.createPackageContents();

    // Initialize created meta-data
    theModelPackage.initializePackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theModelPackage,
        new EValidator.Descriptor() {
          @Override
          public EValidator getEValidator() {
            return ModelValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theModelPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
    return theModelPackage;
  }
コード例 #5
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link SGraphPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @generated
   */
  public static SGraphPackage init() {
    if (isInited)
      return (SGraphPackage) EPackage.Registry.INSTANCE.getEPackage(SGraphPackage.eNS_URI);

    // Obtain or create and register package
    SGraphPackageImpl theSGraphPackage =
        (SGraphPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SGraphPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new SGraphPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    BasePackage.eINSTANCE.eClass();

    // Load packages
    theSGraphPackage.loadPackage();

    // Fix loaded packages
    theSGraphPackage.fixPackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theSGraphPackage,
        new EValidator.Descriptor() {
          public EValidator getEValidator() {
            return SGraphValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theSGraphPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(SGraphPackage.eNS_URI, theSGraphPackage);
    return theSGraphPackage;
  }
コード例 #6
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link Core_avPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static Core_avPackage init() {
    if (isInited)
      return (Core_avPackage) EPackage.Registry.INSTANCE.getEPackage(Core_avPackage.eNS_URI);

    // Obtain or create and register package
    Core_avPackageImpl theCore_avPackage =
        (Core_avPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Core_avPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new Core_avPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    Identifier_avPackage.eINSTANCE.eClass();
    Stoex_avPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    Pcm_avPackageImpl thePcm_avPackage =
        (Pcm_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Pcm_avPackage.eNS_URI)
                    instanceof Pcm_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Pcm_avPackage.eNS_URI)
                : Pcm_avPackage.eINSTANCE);
    Entity_avPackageImpl theEntity_avPackage =
        (Entity_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Entity_avPackage.eNS_URI)
                    instanceof Entity_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Entity_avPackage.eNS_URI)
                : Entity_avPackage.eINSTANCE);
    Composition_avPackageImpl theComposition_avPackage =
        (Composition_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Composition_avPackage.eNS_URI)
                    instanceof Composition_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Composition_avPackage.eNS_URI)
                : Composition_avPackage.eINSTANCE);
    Usagemodel_avPackageImpl theUsagemodel_avPackage =
        (Usagemodel_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Usagemodel_avPackage.eNS_URI)
                    instanceof Usagemodel_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Usagemodel_avPackage.eNS_URI)
                : Usagemodel_avPackage.eINSTANCE);
    Repository_avPackageImpl theRepository_avPackage =
        (Repository_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Repository_avPackage.eNS_URI)
                    instanceof Repository_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Repository_avPackage.eNS_URI)
                : Repository_avPackage.eINSTANCE);
    Resourcetype_avPackageImpl theResourcetype_avPackage =
        (Resourcetype_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Resourcetype_avPackage.eNS_URI)
                    instanceof Resourcetype_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Resourcetype_avPackage.eNS_URI)
                : Resourcetype_avPackage.eINSTANCE);
    Protocol_avPackageImpl theProtocol_avPackage =
        (Protocol_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Protocol_avPackage.eNS_URI)
                    instanceof Protocol_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Protocol_avPackage.eNS_URI)
                : Protocol_avPackage.eINSTANCE);
    Parameter_avPackageImpl theParameter_avPackage =
        (Parameter_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Parameter_avPackage.eNS_URI)
                    instanceof Parameter_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Parameter_avPackage.eNS_URI)
                : Parameter_avPackage.eINSTANCE);
    Reliability_avPackageImpl theReliability_avPackage =
        (Reliability_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Reliability_avPackage.eNS_URI)
                    instanceof Reliability_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Reliability_avPackage.eNS_URI)
                : Reliability_avPackage.eINSTANCE);
    Seff_avPackageImpl theSeff_avPackage =
        (Seff_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Seff_avPackage.eNS_URI)
                    instanceof Seff_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Seff_avPackage.eNS_URI)
                : Seff_avPackage.eINSTANCE);
    Seff_performance_avPackageImpl theSeff_performance_avPackage =
        (Seff_performance_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Seff_performance_avPackage.eNS_URI)
                    instanceof Seff_performance_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Seff_performance_avPackage.eNS_URI)
                : Seff_performance_avPackage.eINSTANCE);
    Seff_reliability_avPackageImpl theSeff_reliability_avPackage =
        (Seff_reliability_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Seff_reliability_avPackage.eNS_URI)
                    instanceof Seff_reliability_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Seff_reliability_avPackage.eNS_URI)
                : Seff_reliability_avPackage.eINSTANCE);
    Qosannotations_avPackageImpl theQosannotations_avPackage =
        (Qosannotations_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Qosannotations_avPackage.eNS_URI)
                    instanceof Qosannotations_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Qosannotations_avPackage.eNS_URI)
                : Qosannotations_avPackage.eINSTANCE);
    Qos_performance_avPackageImpl theQos_performance_avPackage =
        (Qos_performance_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Qos_performance_avPackage.eNS_URI)
                    instanceof Qos_performance_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Qos_performance_avPackage.eNS_URI)
                : Qos_performance_avPackage.eINSTANCE);
    Qos_reliability_avPackageImpl theQos_reliability_avPackage =
        (Qos_reliability_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Qos_reliability_avPackage.eNS_URI)
                    instanceof Qos_reliability_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Qos_reliability_avPackage.eNS_URI)
                : Qos_reliability_avPackage.eINSTANCE);
    System_avPackageImpl theSystem_avPackage =
        (System_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(System_avPackage.eNS_URI)
                    instanceof System_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(System_avPackage.eNS_URI)
                : System_avPackage.eINSTANCE);
    Resourceenvironment_avPackageImpl theResourceenvironment_avPackage =
        (Resourceenvironment_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Resourceenvironment_avPackage.eNS_URI)
                    instanceof Resourceenvironment_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Resourceenvironment_avPackage.eNS_URI)
                : Resourceenvironment_avPackage.eINSTANCE);
    Allocation_avPackageImpl theAllocation_avPackage =
        (Allocation_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Allocation_avPackage.eNS_URI)
                    instanceof Allocation_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Allocation_avPackage.eNS_URI)
                : Allocation_avPackage.eINSTANCE);
    Subsystem_avPackageImpl theSubsystem_avPackage =
        (Subsystem_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Subsystem_avPackage.eNS_URI)
                    instanceof Subsystem_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Subsystem_avPackage.eNS_URI)
                : Subsystem_avPackage.eINSTANCE);
    Completions_avPackageImpl theCompletions_avPackage =
        (Completions_avPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Completions_avPackage.eNS_URI)
                    instanceof Completions_avPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Completions_avPackage.eNS_URI)
                : Completions_avPackage.eINSTANCE);

    // Create package meta-data objects
    theCore_avPackage.createPackageContents();
    thePcm_avPackage.createPackageContents();
    theEntity_avPackage.createPackageContents();
    theComposition_avPackage.createPackageContents();
    theUsagemodel_avPackage.createPackageContents();
    theRepository_avPackage.createPackageContents();
    theResourcetype_avPackage.createPackageContents();
    theProtocol_avPackage.createPackageContents();
    theParameter_avPackage.createPackageContents();
    theReliability_avPackage.createPackageContents();
    theSeff_avPackage.createPackageContents();
    theSeff_performance_avPackage.createPackageContents();
    theSeff_reliability_avPackage.createPackageContents();
    theQosannotations_avPackage.createPackageContents();
    theQos_performance_avPackage.createPackageContents();
    theQos_reliability_avPackage.createPackageContents();
    theSystem_avPackage.createPackageContents();
    theResourceenvironment_avPackage.createPackageContents();
    theAllocation_avPackage.createPackageContents();
    theSubsystem_avPackage.createPackageContents();
    theCompletions_avPackage.createPackageContents();

    // Initialize created meta-data
    theCore_avPackage.initializePackageContents();
    thePcm_avPackage.initializePackageContents();
    theEntity_avPackage.initializePackageContents();
    theComposition_avPackage.initializePackageContents();
    theUsagemodel_avPackage.initializePackageContents();
    theRepository_avPackage.initializePackageContents();
    theResourcetype_avPackage.initializePackageContents();
    theProtocol_avPackage.initializePackageContents();
    theParameter_avPackage.initializePackageContents();
    theReliability_avPackage.initializePackageContents();
    theSeff_avPackage.initializePackageContents();
    theSeff_performance_avPackage.initializePackageContents();
    theSeff_reliability_avPackage.initializePackageContents();
    theQosannotations_avPackage.initializePackageContents();
    theQos_performance_avPackage.initializePackageContents();
    theQos_reliability_avPackage.initializePackageContents();
    theSystem_avPackage.initializePackageContents();
    theResourceenvironment_avPackage.initializePackageContents();
    theAllocation_avPackage.initializePackageContents();
    theSubsystem_avPackage.initializePackageContents();
    theCompletions_avPackage.initializePackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theCore_avPackage,
        new EValidator.Descriptor() {
          public EValidator getEValidator() {
            return Core_avValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theCore_avPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(Core_avPackage.eNS_URI, theCore_avPackage);
    return theCore_avPackage;
  }
コード例 #7
0
  // BEGIN COMPLEX CODE
  public boolean validateKeyAttributeDomainModelReference_resolveable(
      VKeyAttributeDomainModelReference keyAttributeDomainModelReference,
      DiagnosticChain diagnostics,
      Map<Object, Object> context) {

    if (keyAttributeDomainModelReference.getKeyDMR() == null) {
      if (keyAttributeDomainModelReference.eContainer() != null && diagnostics != null) {
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                "Missing key DMR.", //$NON-NLS-1$
                keyAttributeDomainModelReference.eContainer(),
                keyAttributeDomainModelReference.eContainingFeature()));
      }
      return false;
    }

    if (keyAttributeDomainModelReference.getKeyValue() == null) {
      if (keyAttributeDomainModelReference.eContainer() != null && diagnostics != null) {
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                "No key Value.", //$NON-NLS-1$
                keyAttributeDomainModelReference.eContainer(),
                keyAttributeDomainModelReference.eContainingFeature()));
      }
      return false;
    }

    // validate path to reference
    if (!ViewValidator.INSTANCE.validateFeaturePathDomainModelReference_resolveable(
        keyAttributeDomainModelReference, diagnostics, context)) {
      return false;
    }

    final EStructuralFeature feature = keyAttributeDomainModelReference.getDomainModelEFeature();
    if (!EReference.class.isInstance(feature) || !feature.isMany()) {
      if (diagnostics != null) {
        final String message =
            "Domain model reference does not end at a multi reference."; //$NON-NLS-1$
        if (keyAttributeDomainModelReference.eContainer() != null) {
          diagnostics.add(
              createDiagnostic(
                  Diagnostic.ERROR,
                  0,
                  message,
                  keyAttributeDomainModelReference.eContainer(),
                  keyAttributeDomainModelReference.eContainingFeature()));
        }
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                message,
                keyAttributeDomainModelReference,
                VViewPackage.eINSTANCE.getFeaturePathDomainModelReference_DomainModelEFeature()));
      }
      return false;
    }

    final EClass rootEClass = EReference.class.cast(feature).getEReferenceType();
    final VDomainModelReference targetDMR = keyAttributeDomainModelReference.getKeyDMR();
    EValidator validator =
        EValidator.Registry.INSTANCE.getEValidator(targetDMR.eClass().getEPackage());
    Map<Object, Object> newContext = new LinkedHashMap<Object, Object>(context);
    newContext.put(ViewValidator.ECLASS_KEY, rootEClass);
    if (!validator.validate(targetDMR, diagnostics, newContext)) {
      final String message = "Key DMR cannot be resolved"; // $NON-NLS-1$
      if (keyAttributeDomainModelReference.eContainer() != null && diagnostics != null) {
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                message,
                keyAttributeDomainModelReference.eContainer(),
                keyAttributeDomainModelReference.eContainingFeature()));
      }
      return false;
    }

    if (keyAttributeDomainModelReference.getValueDMR() == null) {
      if (keyAttributeDomainModelReference.eContainer() != null && diagnostics != null) {
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                "Missing value DMR", //$NON-NLS-1$
                keyAttributeDomainModelReference.eContainer(),
                keyAttributeDomainModelReference.eContainingFeature()));
      }
      return false;
    }
    final VDomainModelReference valueDMR = keyAttributeDomainModelReference.getValueDMR();
    validator = EValidator.Registry.INSTANCE.getEValidator(valueDMR.eClass().getEPackage());
    newContext = new LinkedHashMap<Object, Object>(context);
    newContext.put(ViewValidator.ECLASS_KEY, rootEClass);
    if (!validator.validate(valueDMR, diagnostics, newContext)) {
      final String message = "Value DMR cannot be resolved"; // $NON-NLS-1$
      if (keyAttributeDomainModelReference.eContainer() != null && diagnostics != null) {
        diagnostics.add(
            createDiagnostic(
                Diagnostic.ERROR,
                0,
                message,
                keyAttributeDomainModelReference.eContainer(),
                keyAttributeDomainModelReference.eContainingFeature()));
      }
      return false;
    }
    return true;
  }