/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   *
   * @param infantTransfer The receiving '<em><b>Infant Transfer</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
   */
  public static boolean validateInfantTransferParticipant(
      InfantTransfer infantTransfer, DiagnosticChain diagnostics, Map<Object, Object> context) {

    if (VALIDATE_INFANT_TRANSFER_PARTICIPANT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
      OCL.Helper helper = EOCL_ENV.createOCLHelper();
      helper.setContext(VsbrPackage.Literals.INFANT_TRANSFER);
      try {
        VALIDATE_INFANT_TRANSFER_PARTICIPANT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
            helper.createInvariant(
                VALIDATE_INFANT_TRANSFER_PARTICIPANT__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
      } catch (ParserException pe) {
        throw new UnsupportedOperationException(pe.getLocalizedMessage());
      }
    }
    if (!EOCL_ENV
        .createQuery(VALIDATE_INFANT_TRANSFER_PARTICIPANT__DIAGNOSTIC_CHAIN_MAP__EOCL_INV)
        .check(infantTransfer)) {
      if (diagnostics != null) {
        diagnostics.add(
            new BasicDiagnostic(
                Diagnostic.INFO,
                VsbrValidator.DIAGNOSTIC_SOURCE,
                VsbrValidator.INFANT_TRANSFER__INFANT_TRANSFER_PARTICIPANT,
                VsbrPlugin.INSTANCE.getString("InfantTransferParticipant"),
                new Object[] {infantTransfer}));
      }

      return false;
    }
    return true;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   *
   * @param infantTransfer The receiving '<em><b>Infant Transfer</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
   */
  public static boolean validateInfantTransferCodeP(
      InfantTransfer infantTransfer, DiagnosticChain diagnostics, Map<Object, Object> context) {

    if (VALIDATE_INFANT_TRANSFER_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
      OCL.Helper helper = EOCL_ENV.createOCLHelper();
      helper.setContext(VsbrPackage.Literals.INFANT_TRANSFER);
      try {
        VALIDATE_INFANT_TRANSFER_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
            helper.createInvariant(VALIDATE_INFANT_TRANSFER_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
      } catch (ParserException pe) {
        throw new UnsupportedOperationException(pe.getLocalizedMessage());
      }
    }
    if (!EOCL_ENV
        .createQuery(VALIDATE_INFANT_TRANSFER_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV)
        .check(infantTransfer)) {
      if (diagnostics != null) {
        diagnostics.add(
            new BasicDiagnostic(
                Diagnostic.ERROR,
                VsbrValidator.DIAGNOSTIC_SOURCE,
                VsbrValidator.INFANT_TRANSFER__INFANT_TRANSFER_CODE_P,
                VsbrPlugin.INSTANCE.getString("InfantTransferCodeP"),
                new Object[] {infantTransfer}));
      }

      if (context != null) {
        // generate a pass token for my dependent constraints to short-circuit or filter results
        @SuppressWarnings("unchecked")
        Collection<Object> passToken =
            (Collection<Object>)
                context.get("org.openhealthtools.mdht.uml.cda.vsbr.InfantTransferCodeP");
        if (passToken == null) {
          // anticipate a reasonably healthy model
          passToken = new java.util.ArrayList<Object>(3);
          context.put("org.openhealthtools.mdht.uml.cda.vsbr.InfantTransferCodeP", passToken);
        }
        passToken.add(infantTransfer);
      }

      return false;
    }
    return true;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * <!-- begin-model-doc -->
   *
   * @param infantTransfer The receiving '<em><b>Infant Transfer</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
   */
  public static boolean validateInfantTransferCode(
      InfantTransfer infantTransfer, DiagnosticChain diagnostics, Map<Object, Object> context) {

    Object passToken =
        (context == null)
            ? null
            : context.get("org.openhealthtools.mdht.uml.cda.vsbr.InfantTransferCodeP");
    if ((passToken instanceof Collection<?>)
        && ((Collection<?>) passToken).contains(infantTransfer)) {
      // I have a free pass to short-circuit
      return true;
    }

    if (VALIDATE_INFANT_TRANSFER_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
      OCL.Helper helper = EOCL_ENV.createOCLHelper();
      helper.setContext(VsbrPackage.Literals.INFANT_TRANSFER);
      try {
        VALIDATE_INFANT_TRANSFER_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV =
            helper.createInvariant(VALIDATE_INFANT_TRANSFER_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
      } catch (ParserException pe) {
        throw new UnsupportedOperationException(pe.getLocalizedMessage());
      }
    }
    if (!EOCL_ENV
        .createQuery(VALIDATE_INFANT_TRANSFER_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV)
        .check(infantTransfer)) {
      if (diagnostics != null) {
        diagnostics.add(
            new BasicDiagnostic(
                Diagnostic.ERROR,
                VsbrValidator.DIAGNOSTIC_SOURCE,
                VsbrValidator.INFANT_TRANSFER__INFANT_TRANSFER_CODE,
                VsbrPlugin.INSTANCE.getString("InfantTransferCode"),
                new Object[] {infantTransfer}));
      }

      return false;
    }
    return true;
  }