Changeset 24
- Timestamp:
- 08/30/06 14:48:27 (2 years ago)
- Files:
-
- trunk/examples/ColorPrimitives.php (modified) (5 diffs)
- trunk/examples/ColorPrimitivesFactory.php (added)
- trunk/examples/TestPrimitivesFactory.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/ColorPrimitives.php
r22 r24 1 1 <?php 2 2 /** 3 * @author sschmidt4 * 5 * TODO To change the template for this generated type comment go to6 * Window - Preferences - Java - Code Style - Code Templates3 * example class 4 * 5 * @author Stephan Schmidt <stephan.schmidt@schlund.de> 6 * @author Frank Kleine <frank.kleine@schlund.de> 7 7 */ 8 class ColorPrimitivesFactory 9 { 10 public static function create($name) 11 { 12 $colorPrimities = new ColorPrimitives($name); 13 return $colorPrimities; 14 } 15 } 16 8 /** 9 * example class 10 * 11 * @package XJConf 12 * @subpackage examples 13 */ 17 14 class ColorPrimitives 18 15 { 16 /** 17 * the red part of the color 18 * 19 * @var int 20 */ 19 21 private $red; 22 /** 23 * the green part of the color 24 * 25 * @var int 26 */ 20 27 private $green; 28 /** 29 * the blue part of the color 30 * 31 * @var int 32 */ 21 33 private $blue; 22 private $name = null; 34 /** 35 * the name of the color 36 * 37 * @var int 38 */ 39 private $name = null; 40 /** 41 * the title of the color 42 * 43 * @var int 44 */ 23 45 private $colorTitle = null; 24 46 47 /** 48 * constructor 49 * 50 * @var string $name name of the color 51 */ 25 52 public function __construct($name) 26 53 { 27 54 $this->name = $name; 28 55 } 29 56 57 /** 58 * set the red part 59 * 60 * @param int $val 61 */ 30 62 public function setRed($val) 31 63 { … … 33 65 } 34 66 67 /** 68 * set the green part 69 * 70 * @param int $val 71 */ 35 72 public function setGreen($val) { 36 73 $this->green = $val; 37 74 } 38 75 76 /** 77 * set the blue part 78 * 79 * @param int $val 80 */ 39 81 public function setBlue($val) { 40 82 $this->blue = $val; 41 83 } 42 84 85 /** 86 * set the title of the color 87 * 88 * @param string $title 89 */ 43 90 public function setColorTitle($title) 44 91 { … … 46 93 } 47 94 95 /** 96 * get the rgb value as hex 97 * 98 * @return string 99 */ 48 100 public function getRGB() 49 101 { … … 51 103 } 52 104 105 /** 106 * return the name of the color 107 * 108 * @return string 109 */ 53 110 public function getName() 54 111 { 55 112 return $this->name; 56 113 } 57 114 115 /** 116 * return the title of the color 117 * 118 * @return string 119 */ 58 120 public function getColorTitle() 59 121 { … … 61 123 } 62 124 125 /** 126 * returns string representation 127 * 128 * @return string 129 */ 63 130 public function __toString() 64 131 { trunk/examples/TestPrimitivesFactory.php
r22 r24 7 7 8 8 require 'ColorPrimitives.php'; 9 require 'ColorPrimitivesFactory.php'; 9 10 /** 10 11 * @author Stephan Schmidt <stephan.schmidt@schlund.de>
