public function makeBackRef(ValueCommand $x)
 {
     $toReturn = $this->valueBackRefs->get($x);
     if (is_null($toReturn)) {
         if (empty($this->freeBackRefs)) {
             $idx = $this->valueBackRefs->size();
             $toReturn = CommandClientSerializationStreamReader::BACKREF_IDENT . '._' . Integer::toString($idx, Character::MAX_RADIX);
         } else {
             $toReturn = array_pop($this->freeBackRefs);
         }
         $this->valueBackRefs->put($x, $toReturn);
     }
     return $toReturn;
 }
Пример #2
0
 /**
  * Returns the string representation of the <code>double</code> argument.
  * <p>
  * The representation is exactly the one returned by the
  * <code>Double.toString</code> method of one argument.
  *
  * @param   d   a <code>double</code>.
  * @return blaze\lang\String a  string representation of the <code>double</code> argument.
  * @see     java.lang.Double#toString(double)
  */
 public static function valueOf($value)
 {
     if ($value === null) {
         return 'null';
     } else {
         if (is_object($value) && $value instanceof Object) {
             return $value->toString();
         } else {
             if (is_bool($value)) {
                 return $value ? 'true' : 'false';
             } else {
                 if (is_float($value)) {
                     return Float::toString($value);
                 } else {
                     if (is_double($value)) {
                         return Double::toString($value);
                     } else {
                         if (is_int($value)) {
                             return Integer::toString($value);
                         } else {
                             if (is_string($value)) {
                                 return $value;
                             } else {
                                 throw new IllegalArgumentException($value);
                             }
                         }
                     }
                 }
             }
         }
     }
 }