Ejemplo n.º 1
0
 public static function compare(\blaze\lang\Object $o1, \blaze\lang\Object $o2)
 {
     if ($o1 !== null && $o1 instanceof \blaze\lang\Comparable) {
         return $o1->compareTo($o2);
     }
     throw new \blaze\lang\ClassCastException($o1 . ' is not Comparable');
 }
Ejemplo n.º 2
0
 public function finalize()
 {
     parent::finalize();
     try {
         if ($this->out != null) {
             $this->out->close();
         }
     } catch (\blaze\lang\Exception $e) {
     }
     try {
         if ($this->err != null) {
             $this->err->close();
         }
     } catch (\blaze\lang\Exception $e) {
     }
 }
Ejemplo n.º 3
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.º 4
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.º 5
0
 public function compareTo(Object $that)
 {
     if (!$that instanceof URI) {
         throw new \blaze\lang\IllegalArgumentException('Parameters must be of the type blaze\\net\\URI');
     }
     $c = 0;
     if (($c = self::compareIgnoringCase($this->scheme, $that->scheme)) != 0) {
         return $c;
     }
     if ($this->isOpaque()) {
         if ($that->isOpaque()) {
             // Both opaque
             if (($c = self::compare($this->schemeSpecificPart, $that->schemeSpecificPart)) != 0) {
                 return $c;
             }
             return self::compare($this->fragment, $that->fragment);
         }
         return +1;
         // Opaque > hierarchical
     } else {
         if ($that->isOpaque()) {
             return -1;
             // Hierarchical < opaque
         }
     }
     return $this->url->compareTo($that);
 }
Ejemplo n.º 6
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.');
 }