77.. contents :: Table of Contents
88 :local:
99
10+
1011Domain interface
1112=======
1213
@@ -24,6 +25,7 @@ This simple interface declares basic methods to query the domain about variables
2425.. Note ::
2526 Returned arrays should never be modified!
2627
28+
2729SimpleDomain
2830============
2931
@@ -33,22 +35,24 @@ This class encapsulates two integer arrays. One with the variable labels and one
3335.. literalinclude :: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
3436 :start-after: [simple-domain]
3537 :end-before: [simple-domain]
36- :dedent: 8
38+ :dedent: 2
3739
3840.. Warning ::
3941 When creating a :code: `SimpleDomain ` the list of variables must be sorted!
4042 Crema will **not ** automatically sort them, but for some operations will assume they are.
4143
44+
4245DomainBuilder
4346=============
44- While creating a :code: `SimpleDomain ` by passing the arrays of variables and their sizes is possible and valid,
47+
48+ While creating a :code: `SimpleDomain ` by passing the arrays of variables and their sizes is possible and valid,
4549a slightly more friendly method is available using the :code: `DomainBuilder `.
4650Laveraging the ellipses of Java the :code: `DomainBuilder ` class avoids the explicit creation of the arrays as shown in the following example.
4751
4852.. literalinclude :: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
4953 :start-after: [domain-builder-1]
5054 :end-before: [domain-builder-1]
51- :dedent: 8
55+ :dedent: 2
5256
5357
5458Strides
@@ -71,27 +75,26 @@ We we first look at how :code:`Strides` instances can be created conveniently.
7175.. Note ::
7276 The variable's cardinalities are accumlated starting from the variable at index 0.
7377
74-
7578.. literalinclude :: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
7679 :start-after: [strides]
7780 :end-before: [strides]
78- :dedent: 8
81+ :dedent: 2
7982
8083Again, just as with the :code: `SimpleDomain `, creating the object specifying the arrays is valid, but not the most readable solution.
8184The following example shows an alternative way of creation where variables are added along with their cardinality.
8285
8386.. literalinclude :: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
8487 :start-after: [domain-builder-strides]
8588 :end-before: [domain-builder-strides]
86- :dedent: 8
89+ :dedent: 2
8790
8891
8992Alternative ways to create strides are based on operations on them. Generally Domains are considered unmutable objects and any alteration will result in a new instance.
9093
9194.. literalinclude :: ../../src/test/java/ch/idsia/crema/tutorial/DomainsTutorial.java
9295 :start-after: [strides-remove]
9396 :end-before: [strides-remove]
94- :dedent: 8
97+ :dedent: 2
9598
9699A number of common set operations are available:
97100
@@ -100,8 +103,6 @@ A number of common set operations are available:
100103- remove
101104
102105.. _Enhanced domain :
106+
103107Working with Strides
104108--------------------
105-
106-
107-
0 commit comments