Calculates all the sublists of the list supplied, and returns these sublists as a list of lists.
For a list containing n elements, there are 2 n sublists, including the empty list and the original list.
The order of the list items in each of the sublists will be identical to the ordering in the original list.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_sublists" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <Class name="Household"> <Attribute name="members"> <type> <javaclass name="List"> <ruleclass name="Person"/> </javaclass> </type> <derivation> <fixedlist> <listof> <ruleclass name="Person"/> </listof> <members> <create ruleclass="Person"> <String value="Mother"/> </create> <create ruleclass="Person"> <String value="Father"/> </create> <create ruleclass="Person"> <String value="Child"/> </create> </members> </fixedlist> </derivation> </Attribute> <!-- All the different combinations of members of the household --> <Attribute name="memberCombinations"> <!-- Note that the type is list of lists of Persons --> <type> <javaclass name="List"> <javaclass name="List"> <ruleclass name="Person"/> </javaclass> </javaclass> </type> <derivation> <sublists> <reference attribute="members"/> </sublists> </derivation> </Attribute> </Class> <Class name="Person"> <Initialization> <Attribute name="name"> <type> <javaclass name="String"/> </type> </Attribute> </Initialization> </Class> </RuleSet>
In this example rule set, the value of memberCombinations is calculated as list of these 8 lists: