-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocument_hierarchy.txt
112 lines (86 loc) · 4.59 KB
/
document_hierarchy.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// document hiearchy and responsibilities for documents, classes, subclasses, functions
1. main.m
responsibilities:
locate image
ask user how many digits exist in the image
call the FindingCharacters class and pass the digits and the image location to the constructor of the class
take the return information of the getproperties function in FindingCharacters and pass that to the next class
take the information and pass it to the constructor of the SolvingOperation class
call the solve_AO_operation function of the class which will print the result of the arithmetic operation
2. FindingCharacters
responsibilities
produce matrix of pixels
call the respective FindingOperationOneDigit or FindingOperationTwoDigit class in a function called findingoperation with the return values of the num_1, operator and num_2
have a function called getproperties() which returns the properties and their values of the class
properties:
location of image
matrix_of_pixels
number_of_digits
number_1
number_2
operator
memberfunctions / behaviours
default constructor
initialises the matrix of pixels to a matrix of zeros(544, 900)
initialises number_1 to be 1, number_2 to be 1 and operator to be "plus"
parameterized constructor
takes location of image, _number_of_digits
initialises matrix of pixels using the function pixeltomatrix
initialises number_1 to be 0, number_2 to be 0, and operator to be ""
initialises number_of_digits to be _number_of_digits
findingoperation(matrix_of_pixels, number_of_digits)
checks if digits is 1 or 2 and then depending on which it is initialises
and calls the classes:
FindingOperationOneDigit or FindingOperationTwoDigit
it will call the function in either that is called "returningoperation"
returningoperation() will return the properties of FindingOperationTwoDigit or FindingOperationOneDigit which are num_1, operation, num_2
and it will assign the output to the three variables of this class (number_1, operation, number_2)
getproperties()
will return the properties, number_1, operator, and number_2
3. SolvingOperations
responsibilities
produce the output from the given input
properties
number_1,
number_2,
operation
result
memberfunctions / behaviours
default constructor which initialises all to zero
parameterized constructor
takes number_1, operation, number_2
initialises those variables in the property list
solving_AO_operation()
checks what it must do based upon the operator and returns the result in printed form
FindingOperationOneDigit
responsibilities
take the pixel matrix and produce three sub matrices
iterate over each sub matrix and find the number within it
return this number in the property list
properties
first_matrix_of_pixels
middle_matrix_of_pixels
final_matrix_of_pixels
num_1
operator
num_2
memberfunctions / behaviours
default constructor
parameterized constructor
takes the original pixel matrix
creatingsubmatrices
takes the original matrix and produces three sub matrices which is assigned to its respective matrix in the properties of the class
findingfirstnumber
takes the first_matrix_of_pixels and iterates over every findingnumbers function
assigns the value found to num_1 in the property list
findingoperator
takes the middle_matrix_of_pixels and iterates over every findingoperators function
assigns the value found to operator in the property list as a string. i.e "plus", "minus", "divide", "multiply"
findingfinalnumber
takes the final_matrix_of_pixels and iterates over every findingnumbers function
assigns the value found to the num_2 in the property list
returningoperation / getoperation (TBC)
takes the num_1, operator, num_2 and returns it
FindingOperationTwoDigit
|| same as one digit except it will produce 5 matrices and will iterate over the first two and the last two with the findingnumbers functions and the middle with the
findingoperator functions