diff options
-rw-r--r-- | CHANGELOG.org | 2 | ||||
-rw-r--r-- | README.org | 2 | ||||
-rw-r--r-- | docs/data_spec.org | 2 | ||||
-rw-r--r-- | docs/data_spec.pdf | bin | 90256 -> 90604 bytes | |||
-rw-r--r-- | docs/data_spec.tex | 18 | ||||
-rw-r--r-- | docs/design.org | 4 | ||||
-rw-r--r-- | docs/design.pdf | bin | 352949 -> 352153 bytes | |||
-rw-r--r-- | docs/design.tex | 70 | ||||
-rw-r--r-- | docs/manual.org | 4 | ||||
-rw-r--r-- | docs/manual.pdf | bin | 185191 -> 185625 bytes | |||
-rw-r--r-- | docs/manual.tex | 36 | ||||
-rw-r--r-- | src/main/java/sevenUnits/ProgramInfo.java | 4 |
12 files changed, 71 insertions, 71 deletions
diff --git a/CHANGELOG.org b/CHANGELOG.org index f252799..9696497 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1,6 +1,6 @@ * Changelog All notable changes in this project will be shown in this file. -** Unreleased +** v0.5.0 - [2024-03-24 Sun] *** Added - *Added specifications for all types data files used by 7Units.* *** Changed @@ -1,4 +1,4 @@ -* 7Units Version 0.5.0-alpha.2 +* 7Units Version 0.5.0 (this project uses Semantic Versioning) ** What is it? This is a unit converter, which allows you to convert between different units, and includes a GUI which can read unit data from a file (using some unit math) and convert between units that you type in, and has a unit and prefix viewer to check the units that have been loaded in. diff --git a/docs/data_spec.org b/docs/data_spec.org index 54780e3..c75eaa7 100644 --- a/docs/data_spec.org +++ b/docs/data_spec.org @@ -1,6 +1,6 @@ #+TITLE: 7Units Datafile Specification #+SUBTITLE: For Version 0.5.0 -#+DATE: 2024 February 24 +#+DATE: 2024 March 23 #+LaTeX_HEADER: \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} #+LaTeX: \newpage diff --git a/docs/data_spec.pdf b/docs/data_spec.pdf Binary files differindex b192e51..35e01f8 100644 --- a/docs/data_spec.pdf +++ b/docs/data_spec.pdf diff --git a/docs/data_spec.tex b/docs/data_spec.tex index 82494c9..879d62c 100644 --- a/docs/data_spec.tex +++ b/docs/data_spec.tex @@ -1,4 +1,4 @@ -% Created 2024-03-23 Sat 16:01 +% Created 2024-03-24 Sun 13:16 % Intended LaTeX compiler: pdflatex \documentclass[11pt]{article} \usepackage[utf8]{inputenc} @@ -13,7 +13,7 @@ \usepackage{capt-of} \usepackage{hyperref} \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} -\date{2024 February 24} +\date{2024 March 23} \title{7Units Datafile Specification\\\medskip \large For Version 0.5.0} \hypersetup{ @@ -30,7 +30,7 @@ \newpage \section{Unit and Prefix Files} -\label{sec:org12eca56} +\label{sec:org3f0bfdf} Unit and prefix files specify the units and prefixes that are available to 7Units. Their format is intended to be compatible with 7Units's inspiration, \href{https://www.gnu.org/software/units/}{GNU Units}. Each unit or prefix is specified by a line in the following format: @@ -40,7 +40,7 @@ Each unit or prefix is specified by a line in the following format: The name may not contain whitespace, but the definition can and often will. Lines can be separated by either a line feed (0x0A) or a carriage return followed by a line feed (0x0D 0x0A). \subsection{Ignored Lines \& Comments} -\label{sec:org2f8286a} +\label{sec:org7396c6b} All of the following should be ignored: \begin{itemize} \item Any line containing only whitespace @@ -50,7 +50,7 @@ All of the following should be ignored: This allows unit and prefix files to be easily organized and divided. \subsection{Unit Expressions} -\label{sec:orga5cb10a} +\label{sec:orga56737c} The definition part of a unit's line is a unit expression - the same sort of expression you would use in the complex unit converter. Expressions should be a standard mathematical expression, which can operate on either numbers or units. The following operators are supported: addition (+), subtraction (-), multiplication (\texttt{*} or no operator), division (\texttt{/} or \texttt{|}), exponentation (\texttt{\textasciicircum{}}; exponent must be a number). Brackets (\texttt{(} and \texttt{)}) may be used to change order of operations, but otherwise standard BEDMAS order is followed (exponentation first, then multiplication and division, then addition and subtraction), with two exceptions: if a number is multiplied by a unit using spaces, the multiplication will have precedence over division, and division with \texttt{|} has higher precedence than any other operator. For example, "2 m / 1 m" is equal to the dimensionless value 2, not 2 m\textsuperscript{2}. An example of a line defining a unit is: @@ -60,15 +60,15 @@ yard 9 dm + 1.4 cm + 4 mm^2 / 10 mm If the definition is an exclamation mark (\texttt{!}), this defines a base unit, which is expected to already be stored in the system. \subsection{Prefixes \& Prefix Expressions} -\label{sec:orgac34dfb} +\label{sec:org28c98b9} If a line's name part ends in the ASCII dash (\texttt{-}, 0x2D), it defines a prefix instead of a unit (this dash is not included in the prefix's name). Prefix expressions are like unit expressions, but the operands are prefixes and numbers, not units and numbers. Because prefixes do not have a dimension, there are no base prefixes - the exclamation mark is forbidden in prefix expressions. \section{Dimension Files} -\label{sec:orgb96440f} +\label{sec:org9530301} Dimension files give names to unit dimensions, so they can be selected in the unit converter to determine which units are shown. Dimension files are similar to unit and prefix files, except that they use a different set of base \emph{dimensions} (defined with ! as usual), and that addition and subtraction are not supported in dimension expressions. \section{Metric Exception Files} -\label{sec:org727336c} +\label{sec:org79afe10} Metric exception files list exceptions to the One-Way Conversion rule. Units included in these files are always shown on both sides of the unit converter, even if One Way Conversion is enabled. They are just a list of units, one per line. Ignored lines and comments work the same way as in other data files. \section{Configuration Files} -\label{sec:orge440794} +\label{sec:orgf3f6b9a} A configuration file contains one line for each configuration setting, in the format \texttt{key=value}. Check the user manual for the list of configurable setting keys. Ignored lines and comments work the same way as in other data files. \end{document} diff --git a/docs/design.org b/docs/design.org index d813078..65ee651 100644 --- a/docs/design.org +++ b/docs/design.org @@ -1,6 +1,6 @@ #+TITLE: 7Units Design Document -#+SUBTITLE: For version 0.5.0-alpha.2 -#+DATE: 2022 July 8 +#+SUBTITLE: For version 0.5.0 +#+DATE: 2024 March 23 #+LaTeX_HEADER: \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} #+LaTeX_HEADER: \usepackage{xurl} #+LaTeX: \newpage diff --git a/docs/design.pdf b/docs/design.pdf Binary files differindex b41eb43..00703d8 100644 --- a/docs/design.pdf +++ b/docs/design.pdf diff --git a/docs/design.tex b/docs/design.tex index 3279502..c850412 100644 --- a/docs/design.tex +++ b/docs/design.tex @@ -1,4 +1,4 @@ -% Created 2024-03-23 Sat 15:34 +% Created 2024-03-24 Sun 13:15 % Intended LaTeX compiler: pdflatex \documentclass[11pt]{article} \usepackage[utf8]{inputenc} @@ -14,9 +14,9 @@ \usepackage{hyperref} \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} \usepackage{xurl} -\date{2022 July 8} +\date{2024 March 23} \title{7Units Design Document\\\medskip -\large For version 0.5.0-alpha.2} +\large For version 0.5.0} \hypersetup{ pdfauthor={}, pdftitle={7Units Design Document}, @@ -32,35 +32,35 @@ \newpage \section{Introduction} -\label{sec:org53c5489} +\label{sec:orgdac8c13} 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. \section{System Overview} -\label{sec:org4ceeed8} +\label{sec:org2a8e77a} \begin{figure}[htbp] \centering \includegraphics[height=144px]{./diagrams/overview-diagram.plantuml.png} \caption{A big-picture diagram of 7Units, containing all of the major classes.} \end{figure} \subsection{Packages of 7Units} -\label{sec:org3bf81fd} +\label{sec:org80ac84e} 7Units splits its code into three main packages: \begin{description} -\item[{\texttt{sevenUnits.unit}}] The \hyperref[sec:org2570e57]{unit system} +\item[{\texttt{sevenUnits.unit}}] The \hyperref[sec:orgc2400d6]{unit system} \item[{\texttt{sevenUnits.utils}}] Extra classes that aid the unit system. -\item[{\texttt{sevenUnitsGUI}}] The \hyperref[sec:org17cf04d]{front end} code +\item[{\texttt{sevenUnitsGUI}}] The \hyperref[sec:org261b06e]{front end} code \end{description} \texttt{sevenUnits.unit} depends on \texttt{sevenUnits.utils}, while \texttt{sevenUnitsGUI} depends on both \texttt{sevenUnits} packages. There is only one class that isn't in any of these packages, \texttt{sevenUnits.VersionInfo}. \subsection{Major Classes of 7Units} -\label{sec:orgbc77a46} +\label{sec:org5910307} \begin{description} -\item[{\hyperref[sec:org663fd06]{sevenUnits.unit.Unit}}] The class representing a unit -\item[{\hyperref[sec:org2d016f1]{sevenUnits.unit.UnitDatabase}}] A class that stores collections of units, prefixes and dimensions. -\item[{\hyperref[sec:orga158a6c]{sevenUnitsGUI.View}}] The class that handles interaction between the user and the program. -\item[{\hyperref[sec:orgcdf995a]{sevenUnitsGUI.Presenter}}] The class that handles communication between the \texttt{View} and the unit system. +\item[{\hyperref[sec:org946a4e5]{sevenUnits.unit.Unit}}] The class representing a unit +\item[{\hyperref[sec:orgac71770]{sevenUnits.unit.UnitDatabase}}] A class that stores collections of units, prefixes and dimensions. +\item[{\hyperref[sec:org57b8a42]{sevenUnitsGUI.View}}] The class that handles interaction between the user and the program. +\item[{\hyperref[sec:orga668171]{sevenUnitsGUI.Presenter}}] The class that handles communication between the \texttt{View} and the unit system. \end{description} \newpage \subsection{Process of Unit Conversion} -\label{sec:org93cb951} +\label{sec:orgbbad9d5} \begin{figure}[htbp] \centering \includegraphics[width=.9\linewidth]{./diagrams/convert-units.plantuml.png} @@ -75,7 +75,7 @@ \end{enumerate} \newpage \subsection{Process of Expression Conversion} -\label{sec:org6bfd6d2} +\label{sec:org52749d5} The process of expression conversion is similar to that of unit conversion. \begin{figure}[htbp] \centering @@ -91,7 +91,7 @@ The process of expression conversion is similar to that of unit conversion. \end{enumerate} \newpage \section{Unit System Design} -\label{sec:org2570e57} +\label{sec:orgc2400d6} Any code related to the backend unit system is stored in the \texttt{sevenUnits.unit} package. Here is a class diagram of the system. Unimportant methods, methods inherited from Object, getters and setters have been omitted. @@ -102,11 +102,11 @@ Here is a class diagram of the system. Unimportant methods, methods inherited f \end{figure} \newpage \subsection{Dimensions} -\label{sec:org2f56fc6} -Dimensions represent what a unit is measuring, such as length, time, or energy. Dimensions are represented as an \hyperref[sec:orgb8d47b5]{ObjectProduct}<BaseDimension>, where \texttt{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. +\label{sec:orgb21aaed} +Dimensions represent what a unit is measuring, such as length, time, or energy. Dimensions are represented as an \hyperref[sec:org16bc96f]{ObjectProduct}<BaseDimension>, where \texttt{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. \subsection{Unit Classes} -\label{sec:org663fd06} -Units are internally represented by the abstract class \texttt{Unit}. All units have an \hyperref[sec:orgb8d47b5]{ObjectProduct}<BaseUnit> (referred to as the base) that they are based on, a dimension (ObjectProduct<BaseDimension>), one or more names and a symbol (these last two bits of data are contained in the \texttt{NameSymbol} class). The dimension is calculated from the base unit when needed; the variable is just a cache. It has two constructors: a package-private one used to make \texttt{BaseUnit} instances, and a protected one used to make general units (for other subclasses of \texttt{Unit}). All unit classes are immutable. +\label{sec:org946a4e5} +Units are internally represented by the abstract class \texttt{Unit}. All units have an \hyperref[sec:org16bc96f]{ObjectProduct}<BaseUnit> (referred to as the base) that they are based on, a dimension (ObjectProduct<BaseDimension>), one or more names and a symbol (these last two bits of data are contained in the \texttt{NameSymbol} class). The dimension is calculated from the base unit when needed; the variable is just a cache. It has two constructors: a package-private one used to make \texttt{BaseUnit} instances, and a protected one used to make general units (for other subclasses of \texttt{Unit}). All unit classes are immutable. Units also have two conversion functions - one which converts from a value expressed in this unit to its base unit, and another which converts from a value expressed in the base unit to this unit. In \texttt{Unit}, they are defined as two abstract methods. This allows you to convert from any unit to any other (as long as they have the same base, i.e. you aren't converting metres to pounds). To convert from A to B, first convert from A to its base, then convert from the base to B. @@ -131,20 +131,20 @@ There are a few more classes which play small roles in the unit system: \item[{USCustomary}] A static utility class with instances of common units in the US Customary system (not to be confused with the British Imperial system; it has the same unit names but the values of a few units are different). \end{description} \subsection{Prefixes} -\label{sec:org0681c69} +\label{sec:orgede1b85} A \texttt{UnitPrefix} is a simple object that can multiply a \texttt{LinearUnit} by a value. It can calculate a new name for the unit by combining its name and the unit's name (symbols are done similarly). It can do multiplication, division and exponentation with a number, as well as multiplication and division with another prefix; all of these work by changing the prefix's multiplier. \subsection{The Unit Database} -\label{sec:org2d016f1} +\label{sec:orgac71770} The \texttt{UnitDatabase} class stores all of the unit, prefix and dimension data used by this program. It is not a representation of an actual database, just a class that stores lots of data. Units are stored using a custom \texttt{Map} implementation (\texttt{PrefixedUnitMap}) which maps unit names to units. It is backed by two maps: one for units (without prefixes) and one for prefixes. It is programmed to include prefixes (so if units includes "metre" and prefixes includes "kilo", this map will include "kilometre", mapping it to a unit representing a kilometre). It is immutable, but you can modify the underlying maps, which is reflected in the \texttt{PrefixedUnitMap}. Other than that, it is a normal map implementation. Prefixes and dimensions are stored in normal maps. \subsubsection{Parsing Expressions} -\label{sec:org0f9159a} -Each \texttt{UnitDatabase} instance has four \hyperref[sec:org19a2e90]{ExpressionParser} instances associated with it, for four types of expressions: unit, unit value, prefix and dimension. They are mostly similar, with operators corresponding to each operation of the corresponding class (\texttt{LinearUnit}, \texttt{LinearUnitValue}, \texttt{UnitPrefix}, \texttt{ObjectProduct<BaseDimension>}). Unit and unit value expressions use linear units; nonlinear units can be used with a special syntax (like "degC(20)") and are immediately converted to a linear unit representing their base (Kelvin in this case) before operating. +\label{sec:org02e3ff1} +Each \texttt{UnitDatabase} instance has four \hyperref[sec:org7296a14]{ExpressionParser} instances associated with it, for four types of expressions: unit, unit value, prefix and dimension. They are mostly similar, with operators corresponding to each operation of the corresponding class (\texttt{LinearUnit}, \texttt{LinearUnitValue}, \texttt{UnitPrefix}, \texttt{ObjectProduct<BaseDimension>}). Unit and unit value expressions use linear units; nonlinear units can be used with a special syntax (like "degC(20)") and are immediately converted to a linear unit representing their base (Kelvin in this case) before operating. \subsubsection{Parsing Files} -\label{sec:orgc216b19} +\label{sec:org676148d} There are two types of data files: unit and dimension. Unit files contain data about units and prefixes. Each line contains the name of a unit or prefix (prefixes end in a dash, units don't) followed by an expression which defines it, separated by one or more space characters (this behaviour is defined by the static regular expression \texttt{NAME\_EXPRESSION}). Unit files are parsed line by line, each line being run through the \texttt{addUnitOrPrefixFromLine} method, which splits a line into name and expression, determines whether it's a unit or a prefix, and parses the expression. Because all units are defined by others, base units need to be defined with a special expression "!"; \textbf{these units should be added to the database before parsing the file}. @@ -152,10 +152,10 @@ Unit files contain data about units and prefixes. Each line contains the name o Dimension files are similar, only for dimensions instead of units and prefixes. \newpage \section{Front-End Design} -\label{sec:org17cf04d} +\label{sec:org261b06e} The front-end of 7Units is based on an MVP model. There are two major frontend classes, the \textbf{View} and the \textbf{Presenter}. \subsection{The View} -\label{sec:orga158a6c} +\label{sec:org57b8a42} The \texttt{View} is the part of the frontend code that directly interacts with the user. It handles input and output, but does not do any processing. Processing is handled by the presenter and the backend code. The \texttt{View} is an interface, not a single class, so that I can easily create multiple views without having to rewrite any processing code. This allows me to easily prototype changes to the GUI without messing with existing code. @@ -169,10 +169,10 @@ There are currently two implementations of the \texttt{View}: \end{description} Both of these \texttt{View} implementations implement \texttt{UnitConversionView} and \texttt{ExpressionConversionView}. \subsection{The Presenter} -\label{sec:orgcdf995a} +\label{sec:orga668171} The \texttt{Presenter} is an intermediary between the \texttt{View} and the backend code. It accepts the user's input and passes it to the backend, then accepts the backend's output and passes it to the frontend for user viewing. Its main functions do not have arguments or return values; instead it takes input from and provides output to the \texttt{View} via its public methods. \subsubsection{Rules} -\label{sec:orgc67be96} +\label{sec:org81f6f8a} The \texttt{Presenter} has a set of function-object rules that determine some of its behaviours. Each corresponds to a setting in the \texttt{View}, but they can be set to other values via the \texttt{Presenter}'s setters (although nonstandard rules cannot be saved and loaded): \begin{description} \item[{numberDisplayRule}] A function that determines how numbers are displayed. This controls the rounding rules. @@ -182,7 +182,7 @@ The \texttt{Presenter} has a set of function-object rules that determine some of These rules have been made this way to enable an incredible level of customization of these behaviours. Because any function object with the correct arguments and return type is accepted, these rules (especially the number display rule) can do much more than the default behaviours. \subsection{Utility Classes} -\label{sec:org481c231} +\label{sec:orga5b57ce} The frontend has many miscellaneous utility classes. Many of them are package-private. Here is a list of them, with a brief description of what they do and where they are used: \begin{description} \item[{DefaultPrefixRepetitionRule}] An enum containing the available rules determining when you can repeat prefixes. Used by the \texttt{TabbedView} for selecting the rule and by the \texttt{Presenter} for loading it from a file. @@ -195,15 +195,15 @@ The frontend has many miscellaneous utility classes. Many of them are package-p \end{description} \newpage \section{Utility Classes} -\label{sec:org7f54b8b} +\label{sec:org3686e64} 7Units has a few general "utility" classes. They aren't directly related to units, but are used in the units system. \subsection{ObjectProduct} -\label{sec:orgb8d47b5} +\label{sec:org16bc96f} An \texttt{ObjectProduct} represents a "product" of elements of some type. The units system uses them to represent coherent units as a product of base units, and dimensions as a product of base dimensions. Internally, it is represented using a map mapping objects to their exponents in the product. For example, the unit "kg m\textsuperscript{2} / s\textsuperscript{2}" (i.e. a Joule) would be represented with a map like \texttt{[kg: 1, m: 2, s: -2]}. \subsection{ExpressionParser} -\label{sec:org19a2e90} +\label{sec:org7296a14} The \texttt{ExpressionParser} class is used to parse the unit, prefix and dimension expressions that are used throughout 7Units. An expression is something like "(2 m + 30 J / N) * 8 s)". Each instance represents a type of expression, containing a way to obtain values (such as numbers or units) from the text and operations that can be done on these values (such as addition, subtraction or multiplication). Each operation also has a priority, which controls the order of operations (i.e. multiplication gets a higher priority than addition). \texttt{ExpressionParser} has a parameterized type \texttt{T}, which represents the type of the value used in the expression. The expression parser currently only supports one type of value per expression; in the expressions used by 7Units numbers are treated as a kind of unit or prefix. Operators are represented by internal types; the system distinguishes between unary operators (those that take a single value, like negation) and binary operators (those that take 2 values, like +, -, * or /). @@ -224,13 +224,13 @@ Expressions are parsed in 2 steps: After evaluating the last token, there should be one value left in the stack - the answer. If there isn't, the original expression was malformed. \end{enumerate} \subsection{Math Classes} -\label{sec:org5c4eb00} +\label{sec:orgfd8c723} There are two simple math classes in 7Units: \begin{description} \item[{\texttt{UncertainDouble}}] Like a \texttt{double}, but with an uncertainty (e.g. \(2.0 \pm 0.4\)). The operations are like those of the regular Double, only they also calculate the uncertainty of the final value. They also have "exact" versions to help interoperation between \texttt{double} and \texttt{UncertainDouble}. It is used by the converter's Scientific Precision setting. \item[{\texttt{DecimalComparison}}] A static utility class that contains a few alternate equals() methods for \texttt{double} and \texttt{UncertainDouble}. These methods allow a slight (configurable) difference between values to still be considered equal, to fight roundoff error. \end{description} \subsection{Collection Classes} -\label{sec:orga9bfec2} +\label{sec:org32d7d09} The \texttt{ConditionalExistenceCollections} class contains wrapper implementations of \texttt{Collection}, \texttt{Iterator}, \texttt{Map} and \texttt{Set}. These implementations ignore elements that do not pass a certain condition - if an element fails the condition, \texttt{contains} will return false, the iterator will skip past it, it won't be counted in \texttt{size}, etc. even if it exists in the original collection. Effectively, any element of the original collection that fails the test does not exist. \end{document} diff --git a/docs/manual.org b/docs/manual.org index 5b36ba7..3c6de1c 100644 --- a/docs/manual.org +++ b/docs/manual.org @@ -1,6 +1,6 @@ #+TITLE: 7Units User Manual -#+SUBTITLE: For Version 0.4.0 -#+DATE: 2022 July 8 +#+SUBTITLE: For Version 0.5.0 +#+DATE: 2024 March 23 #+LaTeX_HEADER: \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} #+LaTeX: \newpage diff --git a/docs/manual.pdf b/docs/manual.pdf Binary files differindex 22ce98d..5fcc115 100644 --- a/docs/manual.pdf +++ b/docs/manual.pdf diff --git a/docs/manual.tex b/docs/manual.tex index d5ca426..e16198f 100644 --- a/docs/manual.tex +++ b/docs/manual.tex @@ -1,4 +1,4 @@ -% Created 2024-03-23 Sat 16:00 +% Created 2024-03-24 Sun 13:16 % Intended LaTeX compiler: pdflatex \documentclass[11pt]{article} \usepackage[utf8]{inputenc} @@ -13,9 +13,9 @@ \usepackage{capt-of} \usepackage{hyperref} \usepackage[a4paper, lmargin=25mm, rmargin=25mm, tmargin=25mm, bmargin=25mm]{geometry} -\date{2022 July 8} +\date{2024 March 23} \title{7Units User Manual\\\medskip -\large For Version 0.4.0} +\large For Version 0.5.0} \hypersetup{ pdfauthor={}, pdftitle={7Units User Manual}, @@ -30,10 +30,10 @@ \newpage \section{Introduction and Purpose} -\label{sec:org0dbe72d} +\label{sec:orgc09fcc7} 7Units is a program that can be used to convert units. This document outlines how to use the program. \section{System Requirements} -\label{sec:org2bf9298} +\label{sec:orga902335} \begin{itemize} \item Works on all major operating systems \\[0pt] \textbf{NOTE:} All screenshots in this document were taken on Windows 10. If you use a different operating system, the program will probably look different than what is shown. @@ -42,9 +42,9 @@ \newpage \section{How to Use 7Units} -\label{sec:orgf02f7d8} +\label{sec:orgdec078f} \subsection{Simple Unit Conversion} -\label{sec:org527dcdb} +\label{sec:org785ebcb} \begin{enumerate} \item Select the "Convert Units" tab if it is not already selected. You should see a screen like in figure \ref{main-interface-dimension}: \begin{figure}[htbp] @@ -69,7 +69,7 @@ \end{figure} \end{enumerate} \subsection{Complex Unit Conversion} -\label{sec:org99aaa43} +\label{sec:org75a0192} \begin{enumerate} \item Select the "Convert Unit Expressions" if it is not already selected. You should see a screen like in figure \ref{main-interface-expression}: \begin{figure}[htbp] @@ -77,7 +77,7 @@ \includegraphics[height=250px]{../screenshots/main-interface-expression-converter.png} \caption{\label{main-interface-expression}Taken in version 0.3.0} \end{figure} -\item Enter a \hyperref[sec:orgc3e5dc3]{unit expression} in the From box. This can be something like "\texttt{7 km}" or "\texttt{6 ft - 2 in}" or "\texttt{3 kg m + 9 lb ft + (35 mm)\textasciicircum{}2 * (85 oz) / (20 in)}". +\item Enter a \hyperref[sec:org3724d84]{unit expression} in the From box. This can be something like "\texttt{7 km}" or "\texttt{6 ft - 2 in}" or "\texttt{3 kg m + 9 lb ft + (35 mm)\textasciicircum{}2 * (85 oz) / (20 in)}". \item Enter a unit name (or another unit expression) in the To box. \item Press the Convert button. This will calculate the value of the first expression, and convert it to a multiple of the second unit (or expression). \begin{figure}[htbp] @@ -87,7 +87,7 @@ \end{figure} \end{enumerate} \section{7Units Settings} -\label{sec:org73b708e} +\label{sec:orgae2806f} All settings can be accessed in the tab with the gear icon. \begin{figure}[htbp] \centering @@ -95,7 +95,7 @@ All settings can be accessed in the tab with the gear icon. \caption{The settings menu, as of version 0.4.0} \end{figure} \subsection{Rounding Settings} -\label{sec:orgbf8cfcd} +\label{sec:org6d3e49c} These settings control how the output of a unit conversion is rounded. \begin{description} \item[{Fixed Precision}] Round to a fixed number of \href{https://en.wikipedia.org/wiki/Significant\_figures}{significant digits}. The number of significant digits is controlled by the precision slider below. @@ -103,7 +103,7 @@ These settings control how the output of a unit conversion is rounded. \item[{Scientific Precision}] Intelligent rounding which uses the precision of the input value(s) to determine the output precision. Not affected by the precision slider. \end{description} \subsection{Prefix Repetition Settings} -\label{sec:org7936321} +\label{sec:org9aa98f8} These settings control when you are allowed to repeat unit prefixes (e.g. kilokilometre) \begin{description} \item[{No Repetition}] Units may only have one prefix. @@ -118,7 +118,7 @@ These settings control when you are allowed to repeat unit prefixes (e.g. kiloki \end{itemize} \end{description} \subsection{Search Settings} -\label{sec:orgc26929c} +\label{sec:org2745ba0} These settings control which prefixes are shown in the "Convert Units" tab. Only coherent SI units (e.g. metre, second, newton, joule) will get prefixes. Some prefixed units are created in the unitfile, and will stay regardless of this setting (though they can be removed from the unitfile). \begin{description} \item[{Never Include Prefixed Units}] Prefixed units will only be shown if they are explicitly added to the unitfile. @@ -126,13 +126,13 @@ These settings control which prefixes are shown in the "Convert Units" tab. Onl \item[{Include All Single Prefixes}] Every coherent unit will have every prefixed version of it included in the list. \end{description} \subsection{Miscellaneous Settings} -\label{sec:orgf44fa1a} +\label{sec:orgeabb2df} \begin{description} \item[{Convert One Way Only}] In the simple conversion tab, only imperial/customary units will be shown on the left, and only metric units\footnote{7Units's definition of "metric" is stricter than the SI, but all of the common units that are commonly considered metric but not included in 7Units's definition are included in the exceptions file.} will be shown on the right. Units listed in the exceptions file (\texttt{src/main/resources/metric\_exceptions.txt}) will be shown on both sides. This is a way to reduce the number of options you must search through if you only convert one way. The expressions tab is unaffected. \item[{Show Duplicates in "Convert Units"}] If unchecked, any unit that has multiple names will only have one included in the Convert Units lists. The selected name will be the longest; if there are multiple longest names one is selected arbitrarily. You will still be able to use these alternate names in the expressions tab. \end{description} \subsection{Configuration File} -\label{sec:org9810db1} +\label{sec:org4cc2874} The settings are saved in a configuration file. On Windows, this is located at \\[0pt] \texttt{\%USERPROFILE\%/AppData/Local/SevenUnits/config.txt}. On other operating systems, this is located at \texttt{\$HOME/.config/SevenUnits/config.txt}. The directory containing the \texttt{SevenUnits} directory can be overridden with the environment variables \texttt{\$LOCALAPPDATA} on Windows or \texttt{\$XDG\_CONFIG\_HOME} elsewhere. @@ -151,9 +151,9 @@ or \texttt{ALL\_METRIC\_PREFIXES}. You can also use the special setting names \texttt{custom\_unit\_file}, \texttt{custom\_dimension\_file} and \texttt{custom\_exception\_file} to add custom units, dimensions and metric exceptions to the system. These files use the same format as the standard files. These setting names can be used more than once to include multiple unit, dimension or exception files. \section{Appendices} -\label{sec:orgaed9ee0} +\label{sec:org60385a7} \subsection{Unit Expressions} -\label{sec:orgc3e5dc3} +\label{sec:org3724d84} A unit expression is simply a math expression where the values being operated on are units or numbers. The operations that can be used are (in order of precedence): \begin{itemize} \item Exponentiation (\^{}); the exponent must be an integer. Both units and numbers can be raised to an exponent @@ -164,6 +164,6 @@ You can also divide with \texttt{|} to create fractions. Using \texttt{|} inste Brackets can be used to manipulate the order of operations, and nonlinear units like Celsius and Fahrenheit cannot be used in expressions. You can use a value in a nonlinear unit by putting brackets after it - for example, degC(12) represents the value 12 \textdegree{} C \subsection{Other Expressions} -\label{sec:org03a3659} +\label{sec:orgc72a672} There are also a simplified version of expressions for prefixes and dimensions. Only multiplication, division and exponentation are supported. Currently, exponentation is not supported for dimensions, but that may be fixed in the future. \end{document} diff --git a/src/main/java/sevenUnits/ProgramInfo.java b/src/main/java/sevenUnits/ProgramInfo.java index 017fce9..9c23c49 100644 --- a/src/main/java/sevenUnits/ProgramInfo.java +++ b/src/main/java/sevenUnits/ProgramInfo.java @@ -26,9 +26,9 @@ import sevenUnits.utils.SemanticVersionNumber; */ public final class ProgramInfo { - /** The version number (0.5.0-alpha.2) */ + /** The version number (0.5.0) */ public static final SemanticVersionNumber VERSION = SemanticVersionNumber - .preRelease(0, 5, 0, "alpha", 2); + .stableVersion(0, 5, 0); private ProgramInfo() { // this class is only for static variables, you shouldn't be able to |