Berechnete Attribute

Berechnete Attribute werden in der Regelklasse direkt aufgelistet.

Tipp: Innerhalb einer Regelklasse ist die Reihenfolge, in der berechnete Attribute angegeben sind, ohne Bedeutung. Sie können berechnete Attribute in einer Regelklasse ganz nach Bedarf umordnen, ohne dass dies das Verhalten der Regelklasse beeinflusst.
<?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>
      <!-- Initialized attributes each contain a type
           but no derivation.

           You should NOT arbitrarily reorder
           initialized attributes. -->
      <Attribute name="firstName">
        <type>
          <javaclass name="String"/>
        </type>
      </Attribute>
      <Attribute name="age">
        <type>
          <javaclass name="Number"/>
        </type>
      </Attribute>
    </Initialization>

    <!-- Each calculated attribute specifies both
         a type and a derivation.

         You are free to arbitrarily reorder
         calculated attributes. -->
    <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>