Ejemplo n.º 1
0
 public function compareTo(Object $obj)
 {
     if ($obj === null) {
         throw new NullPointerException();
     }
     if ($obj instanceof BigDecimal) {
         return bccomp($this->value, $obj->value);
     }
     throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to BigDecimal.');
 }
Ejemplo n.º 2
0
 public function compareTo(Object $obj)
 {
     if ($obj === null) {
         throw new NullPointerException();
     }
     if ($obj instanceof Float) {
         return $this->value - $obj->value < 0 ? -1 : ($this->value - $obj->value > 0 ? 1 : 0);
     }
     throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to Float.');
 }
Ejemplo n.º 3
0
 public function compareTo(Object $obj)
 {
     if ($obj instanceof Byte) {
         return $this->value - $obj->value;
     }
     throw new ClassCastException('Could not cast ' . $obj->getClass()->getName() . ' to Byte.');
 }