계산된 속성

계산된 속성은 규칙 클래스에 직접 나열됩니다.

팁: 규칙 클래스에서 계산된 속성이 지정된 순서는 아무 의미가 없습니다. 규칙 클래스에서 계산된 속성을 다시 정렬해도 규칙 클래스의 동작에는 영향을 주지 않습니다.
<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_RuleClass"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Class name="Person">

    <Initialization>
      <!-- 초기화된 속성 각각에 유형이 포함되어 있지만
           파생 사항은 없습니다.

           초기화된 속성을 임의로
           다시 정렬하지 않아야 합니다. -->
      <Attribute name="firstName">
        <type>
          <javaclass name="String"/>
        </type>
      </Attribute>
      <Attribute name="age">
        <type>
          <javaclass name="Number"/>
        </type>
      </Attribute>
    </Initialization>

    <!-- 계산된 각 속성이 유형과 파생
         둘 다를 지정합니다.

         계산된 속성을 다시 정렬할 수
         있습니다. -->
    <Attribute name="isAdult">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <compare comparison=">=">
          <reference attribute="age"/>
          <Number value="18"/>
        </compare>
      </derivation>
    </Attribute>

    <Attribute name="isSeniorCitizen">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <compare comparison=">=">
          <reference attribute="age"/>
          <Number value="65"/>
        </compare>
      </derivation>
    </Attribute>

  </Class>

</RuleSet>