001/* 002 * Units of Measurement Systems 003 * Copyright (c) 2005-2021, Jean-Marie Dautelle, Werner Keil and others. 004 * 005 * All rights reserved. 006 * 007 * Redistribution and use in source and binary forms, with or without modification, 008 * are permitted provided that the following conditions are met: 009 * 010 * 1. Redistributions of source code must retain the above copyright notice, 011 * this list of conditions and the following disclaimer. 012 * 013 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions 014 * and the following disclaimer in the documentation and/or other materials provided with the distribution. 015 * 016 * 3. Neither the name of JSR-385, Units of Measurement nor the names of their contributors may be used to 017 * endorse or promote products derived from this software without specific prior written permission. 018 * 019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 021 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 023 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 026 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 028 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 */ 030package systems.uom.common; 031 032import javax.measure.Prefix; 033import javax.measure.Quantity; 034import javax.measure.Unit; 035 036/** 037 * Utility class holding Tamil-System prefixes used today in parts of India and Sri Lanka; 038 * based on grouping by two decimal places, rather than the 039 * three decimal places common in most parts of the world.<br> 040 * <code>import static systems.uom.common.TamilPrefix.*; // Static import.<br> 041 * {@literal Unit<Pressure>} KOTI_PASCAL = KOTI(PASCAL);<br> 042 * {@literal Unit<Length>} PATTUK_KOTI_METER = METER.prefix(PATTUK_KOTI);</code> 043 * 044 * @author <a href="mailto:werner@uom.systems">Werner Keil</a> 045 * @version 1.6, $Date: 2021-03-29 $ 046 * @see <a 047 * href="https://en.wikipedia.org/wiki/Tamil_numerals#Tamil-System">Wikipedia: 048 * Tamil numerals - Tamil-System</a> 049 */ 050public enum TamilPrefix implements Prefix { 051 /** Prefix for 10<sup>5</sup>. */ 052 ILATCAM("௱௲", "ilaṭcam", 10, 5), 053 /** Prefix for 10<sup>6</sup>. */ 054 PATTU_ILATCAM("௲௲", "pattu ilaṭcam", 10, 6), 055 /** Prefix for 10<sup>7</sup>. */ 056 KOTI("௰௲௲", "kōṭi", 10, 7), 057 /** Prefix for 10<sup>8</sup>. */ 058 PATTUK_KOTI("௱௲௲", "pattuk kōṭi", 10, 8), 059 /** Prefix for 10<sup>9</sup>. */ 060 ARPUTAM("௲௲௲", "aṟputam", 10, 9), 061 /** Prefix for 10<sup>11</sup>. */ 062 NIKARPPUTAM("௲௲௲", "nikarpputam", 10, 11), 063 /** Prefix for 10<sup>13</sup>. */ 064 KARVAM("௲௲௲௲", "karvam", 10, 13), 065 /** Prefix for 10<sup>15</sup>. */ 066 SANKAM("௲௲௲௲௲", "śaṅkam", 10, 15), 067 /** Prefix for 10<sup>17</sup>. */ 068 ARTTAM("௲௲௲௲௲௲", "arttam", 10, 17), 069 /** Prefix for 10<sup>19</sup>. */ 070 PURIYAM("௱௲௲௲௲௲௲", "pūriyam", 10, 19), 071 /** Prefix for 10<sup>21</sup>. */ 072 MUKKOTI("௲௲௲௲௲௲௲", "mukkoṭi", 10, 21), 073 /** Prefix for 10<sup>25</sup>. */ 074 MAYUKAM("௰௲௲௲௲௲௲௲", "māyukam", 10, 25); 075 076 /** 077 * The symbol of this prefix, as returned by {@link #getSymbol}. 078 * 079 * @serial 080 * @see #getSymbol() 081 */ 082 private final String symbol; 083 084 /** 085 * The name of this prefix, as returned by {@link #getName}. 086 * 087 * @serial 088 * @see #getName() 089 */ 090 private final String name; 091 092 /** 093 * Base part of the associated factor in base^exponent representation. 094 */ 095 private final int base; 096 097 /** 098 * Exponent part of the associated factor in base^exponent representation. 099 */ 100 private final int exponent; 101 102 /** 103 * Creates a new prefix. 104 * 105 * @param symbol 106 * the symbol of this prefix. 107 * @param name 108 * the (display) name of this prefix. 109 * @param exponent 110 * part of the associated factor in base^exponent representation. 111 */ 112 private TamilPrefix(String symbol, String name, int base, int exponent) { 113 this.symbol = symbol; 114 this.name= name; 115 this.base = base; 116 this.exponent = exponent; 117 } 118 119 /** 120 * Base part of the associated factor in {@code base^exponent} representation. 121 */ 122 @Override 123 public Integer getValue() { 124 return base; 125 } 126 127 /** 128 * Exponent part of the associated factor in base^exponent representation. 129 */ 130 @Override 131 public int getExponent() { 132 return exponent; 133 } 134 135 /** 136 * Returns the name of this prefix. 137 * 138 * @return this prefix name, not {@code null}. 139 */ 140 @Override 141 public String getName() { 142 return name; 143 } 144 145 /** 146 * Returns the symbol of this prefix. 147 * 148 * @return this prefix symbol, not {@code null}. 149 */ 150 @Override 151 public String getSymbol() { 152 return symbol; 153 } 154 155 /** 156 * <p> 157 * ௱௲ (ilaṭcam) 158 * </p> 159 * Returns the specified unit multiplied by the factor 160 * <code>10<sup>5</sup></code> 161 * 162 * @param unit 163 * any unit. 164 * @return <code>unit.times(1e5)</code>. 165 */ 166 public static final <Q extends Quantity<Q>> Unit<Q> ILATCAM(Unit<Q> unit) { 167 return unit.prefix(ILATCAM); 168 } 169 170 /** 171 * <p> 172 * ௲௲ (pattu ilaṭcam) 173 * </p> 174 * Returns the specified unit multiplied by the factor 175 * <code>10<sup>6</sup></code> 176 * 177 * @param unit 178 * any unit. 179 * @return <code>unit.times(1e6)</code>. 180 */ 181 public static final <Q extends Quantity<Q>> Unit<Q> PATTU_ILATCAM(Unit<Q> unit) { 182 return unit.prefix(PATTU_ILATCAM); 183 } 184 185 /** 186 * <p> 187 * ௰௲௲, (kōṭi) 188 * </p> 189 * Returns the specified unit multiplied by the factor 190 * <code>10<sup>7</sup></code> 191 * 192 * @param unit 193 * any unit. 194 * @return <code>unit.times(1e7)</code>. 195 */ 196 public static final <Q extends Quantity<Q>> Unit<Q> KOTI(Unit<Q> unit) { 197 return unit.prefix(KOTI); 198 } 199 200 /** 201 * <p> 202 * பத்து கோடி (pathu kōdi) 203 * </p> 204 * Returns the specified unit multiplied by the factor 205 * <code>10<sup>8</sup></code> 206 * 207 * @param unit 208 * any unit. 209 * @return <code>unit.times(1e8)</code>. 210 */ 211 public static final <Q extends Quantity<Q>> Unit<Q> PATTUK_KOTI(Unit<Q> unit) { 212 return unit.prefix(PATTUK_KOTI); 213 } 214 215 /** 216 * <p> 217 * ௲௲௲ (aṟputam) 218 * </p> 219 * Returns the specified unit multiplied by the factor 220 * <code>10<sup>9</sup></code> 221 * 222 * @param unit 223 * any unit. 224 * @return <code>unit.times(1e9)</code>. 225 */ 226 public static final <Q extends Quantity<Q>> Unit<Q> ARPUTAM(Unit<Q> unit) { 227 return unit.prefix(ARPUTAM); 228 } 229 230 /** 231 * <p> 232 * ௲௲௲ (nikarpputam) 233 * </p> 234 * Returns the specified unit multiplied by the factor 235 * <code>10<sup>11</sup></code> 236 * 237 * @param unit 238 * any unit. 239 * @return <code>unit.times(1e11)</code>. 240 */ 241 public static final <Q extends Quantity<Q>> Unit<Q> NIKARPPUTAM(Unit<Q> unit) { 242 return unit.prefix(NIKARPPUTAM); 243 } 244 245 /** 246 * <p> 247 * ௲௲௲௲ (karvam) 248 * </p> 249 * Returns the specified unit multiplied by the factor 250 * <code>10<sup>13</sup></code> 251 * 252 * @param unit 253 * any unit. 254 * @return <code>unit.times(1e13)</code>. 255 */ 256 public static final <Q extends Quantity<Q>> Unit<Q> KARVAM(Unit<Q> unit) { 257 return unit.prefix(KARVAM); 258 } 259 260 /** 261 * <p> 262 * ௲௲௲௲௲ (śaṅkam) 263 * </p> 264 * Returns the specified unit multiplied by the factor 265 * <code>10<sup>15</sup></code> 266 * 267 * @param unit 268 * any unit. 269 * @return <code>unit.times(1e15)</code>. 270 */ 271 public static final <Q extends Quantity<Q>> Unit<Q> SANKAM(Unit<Q> unit) { 272 return unit.prefix(SANKAM); 273 } 274 275 /** 276 * <p> 277 * ௲௲௲௲௲௲ (arttam) 278 * </p> 279 * Returns the specified unit multiplied by the factor 280 * <code>10<sup>17</sup></code> 281 * 282 * @param unit 283 * any unit. 284 * @return <code>unit.times(1e17)</code>. 285 */ 286 public static final <Q extends Quantity<Q>> Unit<Q> ARTTAM(Unit<Q> unit) { 287 return unit.prefix(ARTTAM); 288 } 289 290 /** 291 * <p> 292 * ௱௲௲௲௲௲௲ (pūriyam) 293 * </p> 294 * Returns the specified unit multiplied by the factor 295 * <code>10<sup>19</sup></code> 296 * 297 * @param unit 298 * any unit. 299 * @return <code>unit.times(1e19)</code>. 300 */ 301 public static final <Q extends Quantity<Q>> Unit<Q> PURIYAM(Unit<Q> unit) { 302 return unit.prefix(PURIYAM); 303 } 304 305 /** 306 * <p> 307 * ௲௲௲௲௲௲௲ (mukkoṭi) 308 * </p> 309 * Returns the specified unit multiplied by the factor 310 * <code>10<sup>21</sup></code> 311 * 312 * @param unit 313 * any unit. 314 * @return <code>unit.times(1e21)</code>. 315 */ 316 public static final <Q extends Quantity<Q>> Unit<Q> MUKKOTI(Unit<Q> unit) { 317 return unit.prefix(MUKKOTI); 318 } 319 320 /** 321 * <p> 322 * ௰௲௲௲௲௲௲௲ (māyukam) 323 * </p> 324 * Returns the specified unit multiplied by the factor 325 * <code>10<sup>25</sup></code> 326 * 327 * @param unit 328 * any unit. 329 * @return <code>unit.times(1e25)</code>. 330 */ 331 public static final <Q extends Quantity<Q>> Unit<Q> MAYUKAM(Unit<Q> unit) { 332 return unit.prefix(MAYUKAM); 333 } 334}