home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Element.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  3.5 KB  |  129 lines

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net>                |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Element.php,v 1.3 2003/01/04 11:56:25 mj Exp $
  20. //
  21.  
  22. /**
  23.  * Utility class that defines a chemical element object
  24.  *
  25.  * @author  Jesus M. Castagnetto <jmcastagnetto@php.net>
  26.  * @version 1.0
  27.  * @access  public
  28.  * @package Science_Chemistry
  29.  */
  30. class Science_Chemistry_Element {
  31.  
  32.     /**
  33.      * Element's symbol, one or two characters, case sensitive
  34.      *
  35.      * @var     string
  36.      * @access  public
  37.      */
  38.     var $symbol;
  39.  
  40.     /**
  41.      * Element's name
  42.      *
  43.      * @var     string
  44.      * @access  public
  45.      */
  46.     var $name;
  47.  
  48.     /**
  49.      * Element's atomic number
  50.      *
  51.      * @var     integer
  52.      * @access  public
  53.      */
  54.     var $number;
  55.  
  56.     /**
  57.      * Element's atomic weight in a.m.u (atomic mass units)
  58.      *
  59.      * @var     float
  60.      * @access  public
  61.      */
  62.     var $weight;
  63.  
  64.     /**
  65.      * Element's melting point, with comments
  66.      *
  67.      * @var     string
  68.      * @access  public
  69.      */
  70.     var $melting_point;
  71.  
  72.     /**
  73.      * Element's boiling point, with comments
  74.      *
  75.      * @var     string
  76.      * @access  public
  77.      */
  78.     var $boiling_point;
  79.  
  80.     /**
  81.      * Element's family
  82.      *
  83.      * @var     string
  84.      * @access  public
  85.      */
  86.     var $family;
  87.  
  88.     /**
  89.      * Constructor for the class
  90.      *
  91.      * @param   string  $sym    element symbol
  92.      * @param   string  $name   element name
  93.      * @param   integer $num    atomic number
  94.      * @param   float   $wgt    atomic weight
  95.      * @param   string  $mp     melting point (with comments)
  96.      * @param   string  $bp     boiling point (with comments)
  97.      * @param   string  $fam    family
  98.      * @return  object  Science_Chemistry_Element
  99.      * @access  public
  100.      */
  101.     function Science_Chemistry_Element ($sym, $name, $num, $wgt, $mp, $bp, $fam) {
  102.         $this->symbol = $sym;
  103.         $this->name = $name;
  104.         $this->number = $num;
  105.         $this->weight = $wgt;
  106.         $this->melting_point = $mp;
  107.         $this->boiling_point = $b;
  108.         $this->family = $fam;
  109.     }
  110.  
  111.     /**
  112.      * Checks if an object is a Science_Chemistry_Element instance
  113.      *
  114.      * @param   object  Science_Chemistry_Element $obj
  115.      * @return  boolean 
  116.      * @access  public
  117.      */
  118.     function isElement($obj) {
  119.         return (is_object($obj) &&
  120.                 (get_class($obj) == "Science_Chemistry_Element" ||
  121.                  is_subclass_of($obj, "Science_Chemistry_Element"))
  122.                );
  123.     }
  124.  
  125. } // end of Science_Chemistry_Element
  126.  
  127. // vim: expandtab: ts=4: sw=4
  128. ?>
  129.