Mass.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Measure
  17. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /**
  22. * Implement needed classes
  23. */
  24. #require_once 'Zend/Measure/Abstract.php';
  25. #require_once 'Zend/Locale.php';
  26. /**
  27. * Class for handling flow mass conversions
  28. *
  29. * @category Zend
  30. * @package Zend_Measure
  31. * @subpackage Zend_Measure_Flow_Mass
  32. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Measure_Flow_Mass extends Zend_Measure_Abstract
  36. {
  37. const STANDARD = 'KILOGRAM_PER_SECOND';
  38. const CENTIGRAM_PER_DAY = 'CENTIGRAM_PER_DAY';
  39. const CENTIGRAM_PER_HOUR = 'CENTIGRAM_PER_HOUR';
  40. const CENTIGRAM_PER_MINUTE = 'CENTIGRAM_PER_MINUTE';
  41. const CENTIGRAM_PER_SECOND = 'CENTIGRAM_PER_SECOND';
  42. const GRAM_PER_DAY = 'GRAM_PER_DAY';
  43. const GRAM_PER_HOUR = 'GRAM_PER_HOUR';
  44. const GRAM_PER_MINUTE = 'GRAM_PER_MINUTE';
  45. const GRAM_PER_SECOND = 'GRAM_PER_SECOND';
  46. const KILOGRAM_PER_DAY = 'KILOGRAM_PER_DAY';
  47. const KILOGRAM_PER_HOUR = 'KILOGRAM_PER_HOUR';
  48. const KILOGRAM_PER_MINUTE = 'KILOGRAM_PER_MINUTE';
  49. const KILOGRAM_PER_SECOND = 'KILOGRAM_PER_SECOND';
  50. const MILLIGRAM_PER_DAY = 'MILLIGRAM_PER_DAY';
  51. const MILLIGRAM_PER_HOUR = 'MILLIGRAM_PER_HOUR';
  52. const MILLIGRAM_PER_MINUTE = 'MILLIGRAM_PER_MINUTE';
  53. const MILLIGRAM_PER_SECOND = 'MILLIGRAM_PER_SECOND';
  54. const OUNCE_PER_DAY = 'OUNCE_PER_DAY';
  55. const OUNCE_PER_HOUR = 'OUNCE_PER_HOUR';
  56. const OUNCE_PER_MINUTE = 'OUNCE_PER_MINUTE';
  57. const OUNCE_PER_SECOND = 'OUNCE_PER_SECOND';
  58. const POUND_PER_DAY = 'POUND_PER_DAY';
  59. const POUND_PER_HOUR = 'POUND_PER_HOUR';
  60. const POUND_PER_MINUTE = 'POUND_PER_MINUTE';
  61. const POUND_PER_SECOND = 'POUND_PER_SECOND';
  62. const TON_LONG_PER_DAY = 'TON_LONG_PER_DAY';
  63. const TON_LONG_PER_HOUR = 'TON_LONG_PER_HOUR';
  64. const TON_LONG_PER_MINUTE = 'TON_LONG_PER_MINUTE';
  65. const TON_LONG_PER_SECOND = 'TON_LONG_PER_SECOND';
  66. const TON_PER_DAY = 'TON_PER_DAY';
  67. const TON_PER_HOUR = 'TON_PER_HOUR';
  68. const TON_PER_MINUTE = 'TON_PER_MINUTE';
  69. const TON_PER_SECOND = 'TON_PER_SECOND';
  70. const TON_SHORT_PER_DAY = 'TON_SHORT_PER_DAY';
  71. const TON_SHORT_PER_HOUR = 'TON_SHORT_PER_HOUR';
  72. const TON_SHORT_PER_MINUTE = 'TON_SHORT_PER_MINUTE';
  73. const TON_SHORT_PER_SECOND = 'TON_SHORT_PER_SECOND';
  74. /**
  75. * Calculations for all flow mass units
  76. *
  77. * @var array
  78. */
  79. protected $_units = array(
  80. 'CENTIGRAM_PER_DAY' => array(array('' => '0.00001', '/' => '86400'), 'cg/day'),
  81. 'CENTIGRAM_PER_HOUR' => array(array('' => '0.00001', '/' => '3600'), 'cg/h'),
  82. 'CENTIGRAM_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'), 'cg/m'),
  83. 'CENTIGRAM_PER_SECOND' => array('0.00001', 'cg/s'),
  84. 'GRAM_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'g/day'),
  85. 'GRAM_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'g/h'),
  86. 'GRAM_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'g/m'),
  87. 'GRAM_PER_SECOND' => array('0.001', 'g/s'),
  88. 'KILOGRAM_PER_DAY' => array(array('' => '1', '/' => '86400'), 'kg/day'),
  89. 'KILOGRAM_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'kg/h'),
  90. 'KILOGRAM_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'kg/m'),
  91. 'KILOGRAM_PER_SECOND' => array('1', 'kg/s'),
  92. 'MILLIGRAM_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'mg/day'),
  93. 'MILLIGRAM_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'mg/h'),
  94. 'MILLIGRAM_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'mg/m'),
  95. 'MILLIGRAM_PER_SECOND' => array('0.000001', 'mg/s'),
  96. 'OUNCE_PER_DAY' => array(array('' => '0.0283495', '/' => '86400'), 'oz/day'),
  97. 'OUNCE_PER_HOUR' => array(array('' => '0.0283495', '/' => '3600'), 'oz/h'),
  98. 'OUNCE_PER_MINUTE' => array(array('' => '0.0283495', '/' => '60'), 'oz/m'),
  99. 'OUNCE_PER_SECOND' => array('0.0283495', 'oz/s'),
  100. 'POUND_PER_DAY' => array(array('' => '0.453592', '/' => '86400'), 'lb/day'),
  101. 'POUND_PER_HOUR' => array(array('' => '0.453592', '/' => '3600'), 'lb/h'),
  102. 'POUND_PER_MINUTE' => array(array('' => '0.453592', '/' => '60'), 'lb/m'),
  103. 'POUND_PER_SECOND' => array('0.453592', 'lb/s'),
  104. 'TON_LONG_PER_DAY' => array(array('' => '1016.04608', '/' => '86400'), 't/day'),
  105. 'TON_LONG_PER_HOUR' => array(array('' => '1016.04608', '/' => '3600'), 't/h'),
  106. 'TON_LONG_PER_MINUTE' => array(array('' => '1016.04608', '/' => '60'), 't/m'),
  107. 'TON_LONG_PER_SECOND' => array('1016.04608', 't/s'),
  108. 'TON_PER_DAY' => array(array('' => '1000', '/' => '86400'), 't/day'),
  109. 'TON_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 't/h'),
  110. 'TON_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 't/m'),
  111. 'TON_PER_SECOND' => array('1000', 't/s'),
  112. 'TON_SHORT_PER_DAY' => array(array('' => '907.184', '/' => '86400'), 't/day'),
  113. 'TON_SHORT_PER_HOUR' => array(array('' => '907.184', '/' => '3600'), 't/h'),
  114. 'TON_SHORT_PER_MINUTE' => array(array('' => '907.184', '/' => '60'), 't/m'),
  115. 'TON_SHORT_PER_SECOND' => array('907.184', 't/s'),
  116. 'STANDARD' => 'KILOGRAM_PER_SECOND'
  117. );
  118. }