/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   * The trigger event must be a CallEvent. trigger.event.oclIsKindOf(CallEvent)
   *
   * @param acceptCallAction The receiving '<em><b>Accept Call Action</b></em>' model object.
   * @param diagnostics The chain of diagnostics to which problems are to be appended.
   * @param context The cache of context-specific information.
   *     <!-- end-model-doc -->
   * @generated NOT
   */
  public static boolean validateTriggerCallEvent(
      AcceptCallAction acceptCallAction, DiagnosticChain diagnostics, Map<Object, Object> context) {
    boolean result = true;

    for (Trigger trigger : acceptCallAction.getTriggers()) {

      if (!(trigger.getEvent() instanceof CallEvent)) {
        result = false;
        break;
      }
    }

    if (!result && diagnostics != null) {
      diagnostics.add(
          new BasicDiagnostic(
              Diagnostic.WARNING,
              UMLValidator.DIAGNOSTIC_SOURCE,
              UMLValidator.ACCEPT_CALL_ACTION__TRIGGER_CALL_EVENT,
              UMLPlugin.INSTANCE.getString(
                  "_UI_AcceptCallAction_TriggerCallEvent_diagnostic",
                  getMessageSubstitutions(context, acceptCallAction)), // $NON-NLS-1$
              new Object[] {acceptCallAction}));
    }

    return result;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   * isUnmrashall must be true for an AcceptCallAction. isUnmarshall = true
   *
   * @param acceptCallAction The receiving '<em><b>Accept Call Action</b></em>' model object.
   * @param diagnostics The chain of diagnostics to which problems are to be appended.
   * @param context The cache of context-specific information.
   *     <!-- end-model-doc -->
   * @generated NOT
   */
  public static boolean validateUnmarshall(
      AcceptCallAction acceptCallAction, DiagnosticChain diagnostics, Map<Object, Object> context) {
    boolean result = acceptCallAction.isUnmarshall();

    if (!result && diagnostics != null) {
      diagnostics.add(
          new BasicDiagnostic(
              Diagnostic.WARNING,
              UMLValidator.DIAGNOSTIC_SOURCE,
              UMLValidator.ACCEPT_CALL_ACTION__UNMARSHALL,
              UMLPlugin.INSTANCE.getString(
                  "_UI_AcceptCallAction_Unmarshall_diagnostic",
                  getMessageSubstitutions(context, acceptCallAction)), // $NON-NLS-1$
              new Object[] {acceptCallAction}));
    }

    return result;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   * A value input pin is required. self.value -> notEmpty()
   *
   * @param addStructuralFeatureValueAction The receiving '<em><b>Add Structural Feature Value
   *     Action</b></em>' model object.
   * @param diagnostics The chain of diagnostics to which problems are to be appended.
   * @param context The cache of context-specific information.
   *     <!-- end-model-doc -->
   * @generated NOT
   */
  public static boolean validateRequiredValue(
      AddStructuralFeatureValueAction addStructuralFeatureValueAction,
      DiagnosticChain diagnostics,
      Map<Object, Object> context) {
    boolean result = addStructuralFeatureValueAction.getValue() != null;

    if (!result && diagnostics != null) {
      diagnostics.add(
          new BasicDiagnostic(
              Diagnostic.WARNING,
              UMLValidator.DIAGNOSTIC_SOURCE,
              UMLValidator.ADD_STRUCTURAL_FEATURE_VALUE_ACTION__REQUIRED_VALUE,
              UMLPlugin.INSTANCE.getString(
                  "_UI_AddStructuralFeatureValueAction_RequiredValue_diagnostic",
                  getMessageSubstitutions(context, addStructuralFeatureValueAction)), // $NON-NLS-1$
              new Object[] {addStructuralFeatureValueAction}));
    }

    return result;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   * Actions adding a value to ordered structural features must have a single input pin for the
   * insertion point with type UnlimitedNatural and multiplicity of 1..1, otherwise the action has
   * no input pin for the insertion point. let insertAtPins : Collection = self.insertAt in if
   * self.structuralFeature.isOrdered = #false then insertAtPins->size() = 0 else let insertAtPin :
   * InputPin= insertAt->asSequence()->first() in insertAtPins->size() = 1 and insertAtPin.type =
   * UnlimitedNatural and insertAtPin.multiplicity.is(1,1)) endif
   *
   * @param addStructuralFeatureValueAction The receiving '<em><b>Add Structural Feature Value
   *     Action</b></em>' model object.
   * @param diagnostics The chain of diagnostics to which problems are to be appended.
   * @param context The cache of context-specific information.
   *     <!-- end-model-doc -->
   * @generated NOT
   */
  public static boolean validateUnlimitedNaturalAndMultiplicity(
      AddStructuralFeatureValueAction addStructuralFeatureValueAction,
      DiagnosticChain diagnostics,
      Map<Object, Object> context) {
    boolean result = true;

    StructuralFeature structuralFeature = addStructuralFeatureValueAction.getStructuralFeature();

    if (structuralFeature != null) {
      InputPin insertAt = addStructuralFeatureValueAction.getInsertAt();

      if (structuralFeature.isOrdered()) {
        Type insertAtType = insertAt == null ? null : insertAt.getType();

        result =
            insertAtType instanceof PrimitiveType
                && safeEquals(
                    "PrimitiveTypes::UnlimitedNatural", //$NON-NLS-1$
                    insertAtType.getQualifiedName())
                && insertAt.is(1, 1);
      } else {
        result = insertAt == null;
      }

      if (!result && diagnostics != null) {
        diagnostics.add(
            new BasicDiagnostic(
                Diagnostic.WARNING,
                UMLValidator.DIAGNOSTIC_SOURCE,
                UMLValidator
                    .ADD_STRUCTURAL_FEATURE_VALUE_ACTION__UNLIMITED_NATURAL_AND_MULTIPLICITY,
                UMLPlugin.INSTANCE.getString(
                    "_UI_AddStructuralFeatureValueAction_UnlimitedNaturalAndMultiplicity_diagnostic",
                    getMessageSubstitutions(
                        context, addStructuralFeatureValueAction)), // $NON-NLS-1$
                new Object[] {addStructuralFeatureValueAction}));
      }
    }

    return result;
  }