removeduplicates

기존 목록에서 중복된 항목을 제거하여 새 목록을 작성합니다.

원래 목록에 항목이 두 번 이상 표시되는 경우 첫 번째 인스턴스만 보존됩니다. 그렇지 않으면 항목의 순서가 유지됩니다.

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

    <!-- 이 개인이 "fromPerson"인 경우
         관계 목록입니다. -->
    <Attribute name="relationships">
      <type>
        <javaclass name="List">
          <ruleclass name="Relationship"/>
        </javaclass>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <!-- 이 개인과 관련된 사람입니다.

         한 개인이 다른 사람과 한 가지 이상의
         방식으로 관련될 수 있지만(예:
         나의 조부모가 나의 법적 후견인이기도 함)
         모든 친척은 이 목록에 한 번만 표시됩니다.-->
    <Attribute name="uniqueRelatives">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <removeduplicates>
          <reference attribute="allRelatives"/>
        </removeduplicates>
      </derivation>
    </Attribute>

    <Attribute name="allRelatives">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <!-- 각 관계의 다른 쪽 끝에
             목록을 작성하여 이 개인의 친척을
             가져옵니다. -->
        <dynamiclist>
          <list>
            <reference attribute="relationships"/>
          </list>
          <listitemexpression>
            <reference attribute="toPerson">
              <current/>
            </reference>
          </listitemexpression>
        </dynamiclist>
      </derivation>
    </Attribute>

  </Class>

  <!-- 한 개인과 다른 개인 사이의 관계입니다. -->
  <Class name="Relationship">

    <Attribute name="fromPerson">
      <type>
        <ruleclass name="Person"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="relationshipType">
      <type>
        <javaclass name="String"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>


    <Attribute name="toPerson">
      <type>
        <ruleclass name="Person"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

  </Class>

</RuleSet>