web/enmi/Zend/Measure/Flow/Mass.php
changeset 19 1c2f13fd785c
parent 0 4eba9c11703f
equal deleted inserted replaced
18:bd595ad770fc 19:1c2f13fd785c
       
     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-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license   http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version   $Id: Mass.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  */
       
    21 
       
    22 /**
       
    23  * Implement needed classes
       
    24  */
       
    25 require_once 'Zend/Measure/Abstract.php';
       
    26 require_once 'Zend/Locale.php';
       
    27 
       
    28 /**
       
    29  * Class for handling flow mass conversions
       
    30  *
       
    31  * @category   Zend
       
    32  * @package    Zend_Measure
       
    33  * @subpackage Zend_Measure_Flow_Mass
       
    34  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    36  */
       
    37 class Zend_Measure_Flow_Mass extends Zend_Measure_Abstract
       
    38 {
       
    39     const STANDARD = 'KILOGRAM_PER_SECOND';
       
    40 
       
    41     const CENTIGRAM_PER_DAY    = 'CENTIGRAM_PER_DAY';
       
    42     const CENTIGRAM_PER_HOUR   = 'CENTIGRAM_PER_HOUR';
       
    43     const CENTIGRAM_PER_MINUTE = 'CENTIGRAM_PER_MINUTE';
       
    44     const CENTIGRAM_PER_SECOND = 'CENTIGRAM_PER_SECOND';
       
    45     const GRAM_PER_DAY         = 'GRAM_PER_DAY';
       
    46     const GRAM_PER_HOUR        = 'GRAM_PER_HOUR';
       
    47     const GRAM_PER_MINUTE      = 'GRAM_PER_MINUTE';
       
    48     const GRAM_PER_SECOND      = 'GRAM_PER_SECOND';
       
    49     const KILOGRAM_PER_DAY     = 'KILOGRAM_PER_DAY';
       
    50     const KILOGRAM_PER_HOUR    = 'KILOGRAM_PER_HOUR';
       
    51     const KILOGRAM_PER_MINUTE  = 'KILOGRAM_PER_MINUTE';
       
    52     const KILOGRAM_PER_SECOND  = 'KILOGRAM_PER_SECOND';
       
    53     const MILLIGRAM_PER_DAY    = 'MILLIGRAM_PER_DAY';
       
    54     const MILLIGRAM_PER_HOUR   = 'MILLIGRAM_PER_HOUR';
       
    55     const MILLIGRAM_PER_MINUTE = 'MILLIGRAM_PER_MINUTE';
       
    56     const MILLIGRAM_PER_SECOND = 'MILLIGRAM_PER_SECOND';
       
    57     const OUNCE_PER_DAY        = 'OUNCE_PER_DAY';
       
    58     const OUNCE_PER_HOUR       = 'OUNCE_PER_HOUR';
       
    59     const OUNCE_PER_MINUTE     = 'OUNCE_PER_MINUTE';
       
    60     const OUNCE_PER_SECOND     = 'OUNCE_PER_SECOND';
       
    61     const POUND_PER_DAY        = 'POUND_PER_DAY';
       
    62     const POUND_PER_HOUR       = 'POUND_PER_HOUR';
       
    63     const POUND_PER_MINUTE     = 'POUND_PER_MINUTE';
       
    64     const POUND_PER_SECOND     = 'POUND_PER_SECOND';
       
    65     const TON_LONG_PER_DAY     = 'TON_LONG_PER_DAY';
       
    66     const TON_LONG_PER_HOUR    = 'TON_LONG_PER_HOUR';
       
    67     const TON_LONG_PER_MINUTE  = 'TON_LONG_PER_MINUTE';
       
    68     const TON_LONG_PER_SECOND  = 'TON_LONG_PER_SECOND';
       
    69     const TON_PER_DAY          = 'TON_PER_DAY';
       
    70     const TON_PER_HOUR         = 'TON_PER_HOUR';
       
    71     const TON_PER_MINUTE       = 'TON_PER_MINUTE';
       
    72     const TON_PER_SECOND       = 'TON_PER_SECOND';
       
    73     const TON_SHORT_PER_DAY    = 'TON_SHORT_PER_DAY';
       
    74     const TON_SHORT_PER_HOUR   = 'TON_SHORT_PER_HOUR';
       
    75     const TON_SHORT_PER_MINUTE = 'TON_SHORT_PER_MINUTE';
       
    76     const TON_SHORT_PER_SECOND = 'TON_SHORT_PER_SECOND';
       
    77 
       
    78     /**
       
    79      * Calculations for all flow mass units
       
    80      *
       
    81      * @var array
       
    82      */
       
    83     protected $_units = array(
       
    84         'CENTIGRAM_PER_DAY'    => array(array('' => '0.00001', '/' => '86400'),    'cg/day'),
       
    85         'CENTIGRAM_PER_HOUR'   => array(array('' => '0.00001', '/' => '3600'),     'cg/h'),
       
    86         'CENTIGRAM_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'),       'cg/m'),
       
    87         'CENTIGRAM_PER_SECOND' => array('0.00001',                               'cg/s'),
       
    88         'GRAM_PER_DAY'         => array(array('' => '0.001', '/' => '86400'),      'g/day'),
       
    89         'GRAM_PER_HOUR'        => array(array('' => '0.001', '/' => '3600'),       'g/h'),
       
    90         'GRAM_PER_MINUTE'      => array(array('' => '0.001', '/' => '60'),         'g/m'),
       
    91         'GRAM_PER_SECOND'      => array('0.001',                                 'g/s'),
       
    92         'KILOGRAM_PER_DAY'     => array(array('' => '1', '/' => '86400'),          'kg/day'),
       
    93         'KILOGRAM_PER_HOUR'    => array(array('' => '1', '/' => '3600'),           'kg/h'),
       
    94         'KILOGRAM_PER_MINUTE'  => array(array('' => '1', '/' => '60'),             'kg/m'),
       
    95         'KILOGRAM_PER_SECOND'  => array('1',                                     'kg/s'),
       
    96         'MILLIGRAM_PER_DAY'    => array(array('' => '0.000001', '/' => '86400'),   'mg/day'),
       
    97         'MILLIGRAM_PER_HOUR'   => array(array('' => '0.000001', '/' => '3600'),    'mg/h'),
       
    98         'MILLIGRAM_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'),      'mg/m'),
       
    99         'MILLIGRAM_PER_SECOND' => array('0.000001',                              'mg/s'),
       
   100         'OUNCE_PER_DAY'        => array(array('' => '0.0283495', '/' => '86400'),  'oz/day'),
       
   101         'OUNCE_PER_HOUR'       => array(array('' => '0.0283495', '/' => '3600'),   'oz/h'),
       
   102         'OUNCE_PER_MINUTE'     => array(array('' => '0.0283495', '/' => '60'),     'oz/m'),
       
   103         'OUNCE_PER_SECOND'     => array('0.0283495',                             'oz/s'),
       
   104         'POUND_PER_DAY'        => array(array('' => '0.453592', '/' => '86400'),   'lb/day'),
       
   105         'POUND_PER_HOUR'       => array(array('' => '0.453592', '/' => '3600'),    'lb/h'),
       
   106         'POUND_PER_MINUTE'     => array(array('' => '0.453592', '/' => '60'),      'lb/m'),
       
   107         'POUND_PER_SECOND'     => array('0.453592',                              'lb/s'),
       
   108         'TON_LONG_PER_DAY'     => array(array('' => '1016.04608', '/' => '86400'), 't/day'),
       
   109         'TON_LONG_PER_HOUR'    => array(array('' => '1016.04608', '/' => '3600'),  't/h'),
       
   110         'TON_LONG_PER_MINUTE'  => array(array('' => '1016.04608', '/' => '60'),    't/m'),
       
   111         'TON_LONG_PER_SECOND'  => array('1016.04608',                            't/s'),
       
   112         'TON_PER_DAY'          => array(array('' => '1000', '/' => '86400'),       't/day'),
       
   113         'TON_PER_HOUR'         => array(array('' => '1000', '/' => '3600'),        't/h'),
       
   114         'TON_PER_MINUTE'       => array(array('' => '1000', '/' => '60'),          't/m'),
       
   115         'TON_PER_SECOND'       => array('1000',                                  't/s'),
       
   116         'TON_SHORT_PER_DAY'    => array(array('' => '907.184', '/' => '86400'),    't/day'),
       
   117         'TON_SHORT_PER_HOUR'   => array(array('' => '907.184', '/' => '3600'),     't/h'),
       
   118         'TON_SHORT_PER_MINUTE' => array(array('' => '907.184', '/' => '60'),       't/m'),
       
   119         'TON_SHORT_PER_SECOND' => array('907.184',                               't/s'),
       
   120         'STANDARD'             => 'KILOGRAM_PER_SECOND'
       
   121     );
       
   122 }