Skip to content

Commit b3eaa4d

Browse files
committed
Added docs for notation classes.
1 parent 612b862 commit b3eaa4d

6 files changed

Lines changed: 153 additions & 1 deletion

File tree

dice_notation/parser/notation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __repr__(self):
134134

135135
class BinaryOperation(Rollable):
136136
"""
137-
Exprssion for a binary operation.
137+
Expression for a binary operation.
138138
139139
Acquiring its value will execute a function with two parameters.
140140
"""
4.51 KB
Loading
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<diagram program="umlet" version="14.2">
3+
<zoom_level>10</zoom_level>
4+
<element>
5+
<id>UMLClass</id>
6+
<coordinates>
7+
<x>430</x>
8+
<y>170</y>
9+
<w>100</w>
10+
<h>30</h>
11+
</coordinates>
12+
<panel_attributes>bg=orange
13+
/Rollable/</panel_attributes>
14+
<additional_attributes/>
15+
</element>
16+
<element>
17+
<id>Relation</id>
18+
<coordinates>
19+
<x>470</x>
20+
<y>190</y>
21+
<w>30</w>
22+
<h>80</h>
23+
</coordinates>
24+
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
25+
<additional_attributes>10.0;10.0;10.0;60.0</additional_attributes>
26+
</element>
27+
<element>
28+
<id>UMLClass</id>
29+
<coordinates>
30+
<x>410</x>
31+
<y>250</y>
32+
<w>140</w>
33+
<h>100</h>
34+
</coordinates>
35+
<panel_attributes>bg=yellow
36+
BinaryOperation
37+
-
38+
+function: object
39+
+left: object
40+
+right: object
41+
-
42+
+operate(): object</panel_attributes>
43+
<additional_attributes/>
44+
</element>
45+
</diagram>
5.01 KB
Loading
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<diagram program="umlet" version="14.2">
3+
<zoom_level>10</zoom_level>
4+
<element>
5+
<id>UMLClass</id>
6+
<coordinates>
7+
<x>290</x>
8+
<y>220</y>
9+
<w>140</w>
10+
<h>70</h>
11+
</coordinates>
12+
<panel_attributes>bg=yellow
13+
ConstantOperand
14+
-
15+
+constant: object
16+
-</panel_attributes>
17+
<additional_attributes/>
18+
</element>
19+
<element>
20+
<id>UMLClass</id>
21+
<coordinates>
22+
<x>490</x>
23+
<y>220</y>
24+
<w>140</w>
25+
<h>70</h>
26+
</coordinates>
27+
<panel_attributes>bg=yellow
28+
DiceOperand
29+
-
30+
31+
-</panel_attributes>
32+
<additional_attributes/>
33+
</element>
34+
<element>
35+
<id>UMLClass</id>
36+
<coordinates>
37+
<x>310</x>
38+
<y>140</y>
39+
<w>100</w>
40+
<h>30</h>
41+
</coordinates>
42+
<panel_attributes>bg=orange
43+
/Rollable/</panel_attributes>
44+
<additional_attributes/>
45+
</element>
46+
<element>
47+
<id>Relation</id>
48+
<coordinates>
49+
<x>350</x>
50+
<y>160</y>
51+
<w>30</w>
52+
<h>80</h>
53+
</coordinates>
54+
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
55+
<additional_attributes>10.0;10.0;10.0;60.0</additional_attributes>
56+
</element>
57+
<element>
58+
<id>Relation</id>
59+
<coordinates>
60+
<x>550</x>
61+
<y>160</y>
62+
<w>30</w>
63+
<h>80</h>
64+
</coordinates>
65+
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
66+
<additional_attributes>10.0;10.0;10.0;60.0</additional_attributes>
67+
</element>
68+
<element>
69+
<id>UMLClass</id>
70+
<coordinates>
71+
<x>510</x>
72+
<y>140</y>
73+
<w>100</w>
74+
<h>30</h>
75+
</coordinates>
76+
<panel_attributes>bg=yellow
77+
RollableDice</panel_attributes>
78+
<additional_attributes/>
79+
</element>
80+
</diagram>

docs/source/docs/notation.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,30 @@ For example, the expression “2d6+1d20+5” would become something like this:
1313

1414
.. image:: ../_static/diagram/dice_notation_tree_example.png
1515
:alt: Dice notation tree example
16+
17+
-------
18+
Operand
19+
-------
20+
21+
.. image:: ../_static/diagram/dice_notation_operands_class_diagram.png
22+
:alt: Dice notation operands class diagram
23+
24+
The leaf nodes are composed by operands, these just store a value which will be
25+
used by other components of the model.
26+
27+
They are all instances of the Rollable abstract class, and currently only two
28+
exist, the ConstantOperand and the DiceOperand.
29+
30+
---------
31+
Operation
32+
---------
33+
34+
.. image:: ../_static/diagram/binary_operation_class_diagram.png
35+
:alt: Binary operation class diagram
36+
37+
A single operation, the BinaryOperation, is given. This just takes the left and
38+
right sided arguments of the operation and passes them to a function.
39+
40+
As the function is, just like the arguments, a field in the class it is
41+
possible to set the function dynamically, supporting this way functional
42+
programming.

0 commit comments

Comments
 (0)