/* file: tolerance_zone_form_name_constraint.swift 	 generated: Mon Jan  3 16:32:52 2022 */

/* This file was generated by the EXPRESS to Swift translator "exp2swift", 
    derived from STEPcode (formerly NIST's SCL).
 exp2swift version: v.1.0.1, derived from stepcode v0.8 as of 2019/11/23 
 WARNING: You probably don't want to edit it since your modifications 
    will be lost if exp2swift is used to regenerate it.
 */

 
import SwiftSDAIcore

extension AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF {
//MARK: -RULE DEFINITION in EXPRESS
/*

  RULE tolerance_zone_form_name_constraint FOR ( tolerance_zone_form );

    LOCAL
      names : SET OF STRING := [ 'within a circle', 'within a cylinder', 'within a cone', 
               'within a single complex surface' , 'within a sphere', 'between two coaxial cylinders', 
               'between two concentric circles' , 'between two equidistant curves', 
               'between two equidistant complex lines or two parallel straight lines' , 
               'between two equidistant complex surfaces or two parallel planes' , 
               'between two equidistant surfaces' , 
               'between two non-equidistant complex lines or two non-parallel straight lines' , 
               'between two non-equidistant complex surfaces or two non-parallel planes' , 
               'between two parallel circles on a conical surface' , 
               'between two parallel circles of the same diameter' , 'non uniform', 'cylindrical or circular', 
               'spherical' , 'unknown'];
      pass  : BOOLEAN := TRUE;
    END_LOCAL;
    REPEAT i := 1 TO SIZEOF( tolerance_zone_form ) BY 1 WHILE pass;
      pass := tolerance_zone_form[i].name IN names;
    END_REPEAT;

  WHERE
    wr1: pass;

  END_RULE; -- tolerance_zone_form_name_constraint (line:49889 file:ap242ed2_mim_lf_v1.101.TY.exp)

*/

  public static
  func TOLERANCE_ZONE_FORM_NAME_CONSTRAINT( 
    allComplexEntities: AnySequence<SDAI.ComplexEntity> ) -> [SDAI.WhereLabel:SDAI.LOGICAL] {

    //ENTITY REFERENCES
    let TOLERANCE_ZONE_FORM = SDAI.POPULATION(OF: eTOLERANCE_ZONE_FORM.self, FROM: allComplexEntities)

    //LOCAL
    var NAMES: SDAI.SET<SDAI.STRING>?  = SDAI.SET<SDAI.STRING>(([
                                         SDAI.AIE(SDAI.STRING("within a circle")), 
                                         SDAI.AIE(SDAI.STRING("within a cylinder")), 
                                         SDAI.AIE(SDAI.STRING("within a cone")), 
                                         SDAI.AIE(SDAI.STRING("within a single complex surface")), 
                                         SDAI.AIE(SDAI.STRING("within a sphere")), 
                                         SDAI.AIE(SDAI.STRING("between two coaxial cylinders")), 
                                         SDAI.AIE(SDAI.STRING("between two concentric circles")), 
                                         SDAI.AIE(SDAI.STRING("between two equidistant curves")), 
                                         SDAI.AIE(SDAI.STRING(
                                         "between two equidistant complex lines or two parallel straight lines")), 
                                         SDAI.AIE(SDAI.STRING(
                                         "between two equidistant complex surfaces or two parallel planes")), 
                                         SDAI.AIE(SDAI.STRING("between two equidistant surfaces")), 
                                         SDAI.AIE(SDAI.STRING("between two non-equidistant complex lines or two non-parallel straight lines")), 
                                         SDAI.AIE(SDAI.STRING("between two non-equidistant complex surfaces or two non-parallel planes")), 
                                         SDAI.AIE(SDAI.STRING(
                                         "between two parallel circles on a conical surface")), 
                                         SDAI.AIE(SDAI.STRING(
                                         "between two parallel circles of the same diameter")), 
                                         SDAI.AIE(SDAI.STRING("non uniform")), 
                                         SDAI.AIE(SDAI.STRING("cylindrical or circular")), 
                                         SDAI.AIE(SDAI.STRING("spherical")), 
                                         SDAI.AIE(SDAI.STRING("unknown"))] 
                                         as [SDAI.AggregationInitializerElement<SDAI.STRING>])); SDAI.TOUCH(var: &NAMES)
    var PASS: SDAI.BOOLEAN?  = SDAI.BOOLEAN(SDAI.TRUE); SDAI.TOUCH(var: &PASS)
    //END_LOCAL

    if let incrementControl/*SDAI.INTEGER*/ = SDAI.FROM(/*SDAI.INTEGER*/1, TO:/*SDAI.INTEGER*/SDAI.SIZEOF(
      TOLERANCE_ZONE_FORM)) {
      for I in incrementControl {
        if !SDAI.IS_TRUE(SDAI.LOGICAL(/*SDAI.BOOLEAN*/PASS)) { break }
        
        let _TEMP1 = TOLERANCE_ZONE_FORM[I]
        let _TEMP2 = _TEMP1?.NAME
        let _TEMP3 = SDAI.aggregate(NAMES, contains: SDAI.STRING(/*tLABEL*/_TEMP2))
        PASS = SDAI.BOOLEAN(/*SDAI.LOGICAL*/_TEMP3)
      }
    }

    //WHERE
    var _conformance: [SDAI.WhereLabel:SDAI.LOGICAL] = [:]
    let WHERE_wr1 = SDAI.LOGICAL(/*SDAI.BOOLEAN*/PASS)
    _conformance["WHERE_wr1"] = WHERE_wr1


    return _conformance
  }

}
