all

모든 목록 값이 true인지를 판별하기 위해 부울 값 목록에 대해 작동합니다.

목록에서 첫 번째 false 값이 발견되면 계산이 중지됩니다. 목록이 비어 있으면 이 표현식이 true를 리턴합니다.

일반적으로 fixedlist 또는 dynamiclist에 부울 값 목록이 제공됩니다.

팁: 목록에서 항목의 순서는 이 표현식 값에 영향을 주지 않습니다. 그러나 성능상의 이유로 "가장 빨리 실패"하는 값을 목록의 맨 위 부근에 배치하고 계산하는 데 자원이 더 많이 소요되는 값은 목록의 맨 아래 근처에 배치하도록 fixedlist를 구성할 수 있습니다.
참고: Cúram V6부터 CER은 오류가 전체 결과에 영향을 미치지 않는 경우 더 이상 하위 표현식의 오류를 보고하지 않습니다.

예를 들어, 세 개의 부울 속성이 있는 고정 목록에 다음과 같은 값이 있습니다.

  • true
  • <계산 중 오류 발생>
  • false

그러면 두 번째 항목이 오류를 리턴해도 항목 중 하나 이상이 false(즉, 목록의 세 번째)이므로 이러한 값에 대한 all 값을 계산하면 false가 리턴됩니다.

반대로 세 개의 부울 속성이 있는 다른 고정 목록에 다음과 같은 세 개의 값이 있습니다.

  • true
  • <계산 중 오류 발생>
  • true

그러면 목록의 두 번째 항목이 보고한 오류로 인해 모든 항목의 값이 true인지가 판별되지 않으므로 이러한 값에 대한 all 값을 계산하면 두 번째 항목이 보고한 이 오류가 리턴됩니다.

<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_all"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Class name="Person">

    <Attribute name="isLoneParent">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <!-- <fixedlist>에서 작동하는 <all>의 예  -->
        <!-- 개인이 "편부모"로 고려되려면
             미혼인 상태에 자녀가 하나 이상 있어야 합니다. -->
        <all>
          <fixedlist>
            <listof>
              <javaclass name="Boolean"/>
            </listof>
            <members>
              <!-- 데이터베이스에 있는 대부분의  사람들이
                   결혼했다는 사실을 알게 되었으므로 이 조건을 먼저 테스트합니다.

                   개인에 대해 isMarried 값이 지정되지 않으면
                   이 개인에게 자녀가 없는 경우
                   <all>이 false를 리턴합니다.
                   그렇지 않으면 isMarried의 값이 지정되지 않았음을
                   표시하는 오류가 리턴됩니다.
                   -->
              <not>
                <reference attribute="isMarried"/>
              </not>
              <not>
                <property name="isEmpty">
                  <object>
                    <reference attribute="children"/>
                  </object>
                </property>
              </not>
            </members>
          </fixedlist>
        </all>
      </derivation>
    </Attribute>

    <Attribute name="hasNoYoungChildren">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <!-- <dynamiclist>에서 작동하는 <all>의 예입니다.

             한 아동의 나이를 계산할 수 없는 경우가 발생하고
             5세 미만의 아동이 한 명 이상인 경우
             <all>이 false를 리턴합니다. 그렇지 않으면
             오류가 리턴되어 아동의 나이를 계산할 수 없는
             이유가 표시됩니다.
        -->

        <!-- 자녀의 나이가 모두 5세가 넘는지를 검사합니다.
 -->
        <all>
          <dynamiclist>
            <list>
              <reference attribute="children"/>
            </list>
            <listitemexpression>
              <compare comparison="&gt;">
                <reference attribute="age">
                  <current/>
                </reference>
                <Number value="5"/>
              </compare>
            </listitemexpression>
          </dynamiclist>
        </all>
      </derivation>
    </Attribute>

    <!-- 이 개인의 자녀 - 각 자녀도 개인입니다.
 -->
    <Attribute name="children">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="isMarried">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="age">
      <type>
        <javaclass name="Number"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

  </Class>

</RuleSet>