diff options
author | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-06-18 16:43:29 -0500 |
---|---|---|
committer | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-06-18 16:43:29 -0500 |
commit | 768468b303627c215046cd10cf9e8ba62151ac65 (patch) | |
tree | 34a83b85b67580ce0eff20c98bc32e87e579c50d /docs/design.org | |
parent | 58481a9a61843b1e1c12695d22d6375369a2f63f (diff) |
Added diagrams to the new design document sections
Diffstat (limited to 'docs/design.org')
-rw-r--r-- | docs/design.org | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/docs/design.org b/docs/design.org index e1f3a88..42fad74 100644 --- a/docs/design.org +++ b/docs/design.org @@ -8,6 +8,9 @@ * Introduction 7Units is a program that can convert between units. This document details the internal design of 7Units, intended to be used by current and future developers. * System Overview + #+CAPTION: A big-picture diagram of 7Units, containing all of the major classes. + #+attr_latex: :height 144px + [[./diagrams/overview-diagram.plantuml.png]] ** Packages of 7Units 7Units splits its code into three main packages: - ~sevenUnits.unit~ :: The [[*Unit System Design][unit system]] @@ -19,24 +22,32 @@ - [[*The Unit Database][sevenUnits.unit.UnitDatabase]] :: A class that stores collections of units, prefixes and dimensions. - [[*The View][sevenUnitsGUI.View]] :: The class that handles interaction between the user and the program. - [[*The Presenter][sevenUnitsGUI.Presenter]] :: The class that handles communication between the ~View~ and the unit system. +#+LaTeX: \newpage ** Process of Unit Conversion + #+CAPTION: The process of converting units + [[./diagrams/convert-units.plantuml.png]] 1. The ~View~ triggers a unit conversion method from the ~Presenter~. 2. The ~Presenter~ gets raw input data from the ~View~'s public methods (from unit, to unit, from value). 3. The ~Presenter~ uses the ~UnitDatabase~'s methods to convert the raw data from the ~View~ into actual units. 4. The ~Presenter~ performs the unit conversion using the provided unit objects. 5. The ~Presenter~ calls the ~View~'s methods to show the result of the conversion. +#+LaTeX: \newpage ** Process of Expression Conversion + The process of expression conversion is similar to that of unit conversion. + #+CAPTION: The process of converting expressions + [[./diagrams/convert-expressions.plantuml.png]] 1. The ~View~ triggers a unit conversion method from the ~Presenter~. 2. The ~Presenter~ gets raw input data from the ~View~'s public methods (unit conversion: from unit, to unit, from value; expression conversion: input expression, output expression). 3. The ~Presenter~ uses the ~UnitDatabase~'s methods to parse the expressions, converting the input into a ~LinearUnitValue~ and the output into a ~Unit~. 4. The ~Presenter~ converts the provided value into the provided unit. 5. The ~Presenter~ calls the ~View~'s methods to show the result of the conversion. +#+LaTeX: \newpage * Unit System Design Any code related to the backend unit system is stored in the ~sevenUnits.unit~ package. Here is a class diagram of the system. Unimportant methods, methods inherited from Object, getters and setters have been omitted. - [[./diagrams/units-class-diagram.plantuml.png]] #+CAPTION: Class diagram of sevenUnits.unit + [[./diagrams/units-class-diagram.plantuml.png]] #+LaTeX: \newpage ** Dimensions Dimensions represent what a unit is measuring, such as length, time, or energy. Dimensions are represented as an [[*ObjectProduct][ObjectProduct]]<BaseDimension>, where ~BaseDimension~ is a very simple class (its only properties are a name and a symbol) which represents the dimension of a base unit; these base dimensions can be multiplied to create all other Dimensions. |