From 2eee97c9e64dca79fc6b1614b304b398d25a7f4b Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sat, 27 Mar 2021 16:36:39 -0500 Subject: Added automatic building with Gradle --- doc/org/unitConverter/unit/UnitDatabase.html | 789 --------------------------- 1 file changed, 789 deletions(-) delete mode 100644 doc/org/unitConverter/unit/UnitDatabase.html (limited to 'doc/org/unitConverter/unit/UnitDatabase.html') diff --git a/doc/org/unitConverter/unit/UnitDatabase.html b/doc/org/unitConverter/unit/UnitDatabase.html deleted file mode 100644 index d62f73a..0000000 --- a/doc/org/unitConverter/unit/UnitDatabase.html +++ /dev/null @@ -1,789 +0,0 @@ - - - - - -UnitDatabase - - - - - - - - -
- - - - - - - -
- - - -
-
org.unitConverter.unit
-

Class UnitDatabase

-
-
- -
-
    -
  • -
    -
    -
    public final class UnitDatabase
    -extends java.lang.Object
    -
    A database of units, prefixes and dimensions, and their names.
    -
    -
    Since:
    -
    2019-01-07, v0.1.0
    -
    Author:
    -
    Adrien Hopkins
    -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Summary

      - - - - - - - - -
      Constructors 
      Constructor and Description
      UnitDatabase() -
      Creates the UnitsDatabase.
      -
      -
    • -
    - -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethod and Description
      voidaddDimension(java.lang.String name, - ObjectProduct<BaseDimension> dimension) -
      Adds a unit dimension to the database.
      -
      voidaddPrefix(java.lang.String name, - UnitPrefix prefix) -
      Adds a unit prefix to the database.
      -
      voidaddUnit(java.lang.String name, - Unit unit) -
      Adds a unit to the database.
      -
      booleancontainsDimensionName(java.lang.String name) -
      Tests if the database has a unit dimension with this name.
      -
      booleancontainsPrefixName(java.lang.String name) -
      Tests if the database has a unit prefix with this name.
      -
      booleancontainsUnitName(java.lang.String name) -
      Tests if the database has a unit with this name, taking prefixes into consideration
      -
      java.util.Map<java.lang.String,ObjectProduct<BaseDimension>>dimensionMap() 
      ObjectProduct<BaseDimension>getDimension(java.lang.String name) -
      Gets a unit dimension from the database using its name.
      -
      ObjectProduct<BaseDimension>getDimensionFromExpression(java.lang.String expression) -
      Uses the database's data to parse an expression into a unit dimension
      -
      UnitPrefixgetPrefix(java.lang.String name) -
      Gets a unit prefix from the database from its name
      -
      UnitPrefixgetPrefixFromExpression(java.lang.String expression) -
      Gets a unit prefix from a prefix expression
      -
      UnitgetUnit(java.lang.String name) -
      Gets a unit from the database from its name, looking for prefixes.
      -
      UnitgetUnitFromExpression(java.lang.String expression) -
      Uses the database's unit data to parse an expression into a unit
      -
      voidloadDimensionFile(java.io.File file) -
      Adds all dimensions from a file, using data from the database to parse them.
      -
      voidloadUnitsFile(java.io.File file) -
      Adds all units from a file, using data from the database to parse them.
      -
      java.util.Map<java.lang.String,UnitPrefix>prefixMap() 
      java.lang.StringtoString() 
      java.util.Map<java.lang.String,Unit>unitMap() -
      Returns a map mapping unit names to units, including units with prefixes.
      -
      java.util.Map<java.lang.String,Unit>unitMapPrefixless() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
  • -
-
-
-
    -
  • - -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        UnitDatabase

        -
        public UnitDatabase()
        -
        Creates the UnitsDatabase.
        -
        -
        Since:
        -
        2019-01-10, v0.1.0
        -
        -
      • -
      -
    • -
    - -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        addDimension

        -
        public void addDimension(java.lang.String name,
        -                         ObjectProduct<BaseDimension> dimension)
        -
        Adds a unit dimension to the database.
        -
        -
        Parameters:
        -
        name - dimension's name
        -
        dimension - dimension to add
        -
        Throws:
        -
        java.lang.NullPointerException - if name or dimension is null
        -
        Since:
        -
        2019-03-14, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        addPrefix

        -
        public void addPrefix(java.lang.String name,
        -                      UnitPrefix prefix)
        -
        Adds a unit prefix to the database.
        -
        -
        Parameters:
        -
        name - prefix's name
        -
        prefix - prefix to add
        -
        Throws:
        -
        java.lang.NullPointerException - if name or prefix is null
        -
        Since:
        -
        2019-01-14, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        addUnit

        -
        public void addUnit(java.lang.String name,
        -                    Unit unit)
        -
        Adds a unit to the database.
        -
        -
        Parameters:
        -
        name - unit's name
        -
        unit - unit to add
        -
        Throws:
        -
        java.lang.NullPointerException - if unit is null
        -
        Since:
        -
        2019-01-10, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        containsDimensionName

        -
        public boolean containsDimensionName(java.lang.String name)
        -
        Tests if the database has a unit dimension with this name.
        -
        -
        Parameters:
        -
        name - name to test
        -
        Returns:
        -
        if database contains name
        -
        Since:
        -
        2019-03-14, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        containsPrefixName

        -
        public boolean containsPrefixName(java.lang.String name)
        -
        Tests if the database has a unit prefix with this name.
        -
        -
        Parameters:
        -
        name - name to test
        -
        Returns:
        -
        if database contains name
        -
        Since:
        -
        2019-01-13, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        containsUnitName

        -
        public boolean containsUnitName(java.lang.String name)
        -
        Tests if the database has a unit with this name, taking prefixes into consideration
        -
        -
        Parameters:
        -
        name - name to test
        -
        Returns:
        -
        if database contains name
        -
        Since:
        -
        2019-01-13, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        dimensionMap

        -
        public java.util.Map<java.lang.String,ObjectProduct<BaseDimension>> dimensionMap()
        -
        -
        Returns:
        -
        a map mapping dimension names to dimensions
        -
        Since:
        -
        2019-04-13, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        getDimension

        -
        public ObjectProduct<BaseDimension> getDimension(java.lang.String name)
        -
        Gets a unit dimension from the database using its name. - -

        - This method accepts exponents, like "L^3" -

        -
        -
        Parameters:
        -
        name - dimension's name
        -
        Returns:
        -
        dimension
        -
        Since:
        -
        2019-03-14, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        getDimensionFromExpression

        -
        public ObjectProduct<BaseDimension> getDimensionFromExpression(java.lang.String expression)
        -
        Uses the database's data to parse an expression into a unit dimension -

        - The expression is a series of any of the following: -

          -
        • The name of a unit dimension, which multiplies or divides the result based on preceding operators
        • -
        • The operators '*' and '/', which multiply and divide (note that just putting two unit dimensions next to each - other is equivalent to multiplication)
        • -
        • The operator '^' which exponentiates. Exponents must be integers.
        • -
        -
        -
        Parameters:
        -
        expression - expression to parse
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if the expression cannot be parsed
        -
        java.lang.NullPointerException - if expression is null
        -
        Since:
        -
        2019-04-13, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        getPrefix

        -
        public UnitPrefix getPrefix(java.lang.String name)
        -
        Gets a unit prefix from the database from its name
        -
        -
        Parameters:
        -
        name - prefix's name
        -
        Returns:
        -
        prefix
        -
        Since:
        -
        2019-01-10, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        getPrefixFromExpression

        -
        public UnitPrefix getPrefixFromExpression(java.lang.String expression)
        -
        Gets a unit prefix from a prefix expression -

        - Currently, prefix expressions are much simpler than unit expressions: They are either a number or the name of - another prefix -

        -
        -
        Parameters:
        -
        expression - expression to input
        -
        Returns:
        -
        prefix
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if expression cannot be parsed
        -
        java.lang.NullPointerException - if any argument is null
        -
        Since:
        -
        2019-01-14, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        getUnit

        -
        public Unit getUnit(java.lang.String name)
        -
        Gets a unit from the database from its name, looking for prefixes.
        -
        -
        Parameters:
        -
        name - unit's name
        -
        Returns:
        -
        unit
        -
        Since:
        -
        2019-01-10, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        getUnitFromExpression

        -
        public Unit getUnitFromExpression(java.lang.String expression)
        -
        Uses the database's unit data to parse an expression into a unit -

        - The expression is a series of any of the following: -

          -
        • The name of a unit, which multiplies or divides the result based on preceding operators
        • -
        • The operators '*' and '/', which multiply and divide (note that just putting two units or values next to each - other is equivalent to multiplication)
        • -
        • The operator '^' which exponentiates. Exponents must be integers.
        • -
        • A number which is multiplied or divided
        • -
        - This method only works with linear units.
        -
        -
        Parameters:
        -
        expression - expression to parse
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if the expression cannot be parsed
        -
        java.lang.NullPointerException - if expression is null
        -
        Since:
        -
        2019-01-07, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        loadDimensionFile

        -
        public void loadDimensionFile(java.io.File file)
        -
        Adds all dimensions from a file, using data from the database to parse them. -

        - Each line in the file should consist of a name and an expression (parsed by getDimensionFromExpression) separated - by any number of tab characters. -

        -

        - Allowed exceptions: -

          -
        • Anything after a '#' character is considered a comment and ignored.
        • -
        • Blank lines are also ignored
        • -
        • If an expression consists of a single exclamation point, instead of parsing it, this method will search the - database for an existing unit. If no unit is found, an IllegalArgumentException is thrown. This is used to define - initial units and ensure that the database contains them.
        • -
        -
        -
        Parameters:
        -
        file - file to read
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if the file cannot be parsed, found or read
        -
        java.lang.NullPointerException - if file is null
        -
        Since:
        -
        2019-01-13, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        loadUnitsFile

        -
        public void loadUnitsFile(java.io.File file)
        -
        Adds all units from a file, using data from the database to parse them. -

        - Each line in the file should consist of a name and an expression (parsed by getUnitFromExpression) separated by - any number of tab characters. -

        -

        - Allowed exceptions: -

          -
        • Anything after a '#' character is considered a comment and ignored.
        • -
        • Blank lines are also ignored
        • -
        • If an expression consists of a single exclamation point, instead of parsing it, this method will search the - database for an existing unit. If no unit is found, an IllegalArgumentException is thrown. This is used to define - initial units and ensure that the database contains them.
        • -
        -
        -
        Parameters:
        -
        file - file to read
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if the file cannot be parsed, found or read
        -
        java.lang.NullPointerException - if file is null
        -
        Since:
        -
        2019-01-13, v0.1.0
        -
        -
      • -
      - - - -
        -
      • -

        prefixMap

        -
        public java.util.Map<java.lang.String,UnitPrefix> prefixMap()
        -
        -
        Returns:
        -
        a map mapping prefix names to prefixes
        -
        Since:
        -
        2019-04-13, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a string stating the number of units, prefixes and dimensions in the database
        -
        -
      • -
      - - - -
        -
      • -

        unitMap

        -
        public java.util.Map<java.lang.String,Unit> unitMap()
        -
        Returns a map mapping unit names to units, including units with prefixes. -

        - The returned map is infinite in size if there is at least one unit and at least one prefix. If it is infinite, - some operations that only work with finite collections, like converting name/entry sets to arrays, will throw an - IllegalStateException. -

        -

        - Specifically, the operations that will throw an IllegalStateException if the map is infinite in size are: -

          -
        • unitMap.entrySet().toArray() (either overloading)
        • -
        • unitMap.keySet().toArray() (either overloading)
        • -
        -

        -

        - Because of ambiguities between prefixes (i.e. kilokilo = mega), the map's containsValue and values() methods currently ignore prefixes. -

        -
        -
        Returns:
        -
        a map mapping unit names to units, including prefixed names
        -
        Since:
        -
        2019-04-13, v0.2.0
        -
        -
      • -
      - - - -
        -
      • -

        unitMapPrefixless

        -
        public java.util.Map<java.lang.String,Unit> unitMapPrefixless()
        -
        -
        Returns:
        -
        a map mapping unit names to units, ignoring prefixes
        -
        Since:
        -
        2019-04-13, v0.2.0
        -
        -
      • -
      -
    • -
    -
  • -
-
-
- - -
- - - - - - - -
- - - - -- cgit v1.2.3