Example #1
0
 /**
  * @param $name string, unit name used in ontology and mapping configuration
  * @param $labels list of strings, unit labels used in template property values
  * @param $divisor toStandardUnit() divides its value by this divisor
  */
 public function __construct($name, $labels, $divisor)
 {
     parent::__construct($name, $labels);
     if (!is_float($divisor)) {
         throw new \Exception('divisor must be a float');
     }
     $this->divisor = $divisor;
 }
 /**
  * @param $name string, unit name used in ontology and mapping configuration
  * @param $labels list of strings, unit labels used in template property values
  * @param $offset
  * @param $factor
  */
 public function __construct($name, $labels, $offset, $factor)
 {
     parent::__construct($name, $labels);
     if (!is_float($offset)) {
         throw new \Exception('offset must be a float');
     }
     $this->offset = $offset;
     if (!is_float($factor)) {
         throw new \Exception('factor must be a float');
     }
     $this->factor = $factor;
 }
Example #3
0
 /**
  * Note: we could inherit parent::__construct, but we want to be explicit and Java-like.
  * @param $name string, unit name used in ontology and mapping configuration
  * @param $labels list of strings, unit labels used in template property values
  */
 public function __construct($name, $labels)
 {
     parent::__construct($name, $labels);
 }