Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  * In addition, the value gets type checked.
  * @throws \blaze\lang\IllegalArgumentException If the offset is not a number.
  * @throws \blaze\lang\IndexOutOfBoundsException If the offset is not within the range of the array.
  * @throws \blaze\lang\ClassCastException When the type of the value does not fit.
  */
 public function offsetSet($offset, $value)
 {
     if (!\blaze\lang\Integer::isNativeType($offset)) {
         throw new \blaze\lang\IllegalArgumentException('The index must be a number');
     }
     if ($offset < 0 || $offset > $this->size) {
         throw new \blaze\lang\IndexOutOfBoundsException($offset);
     }
     if (!$this->typeChecker->isType($value)) {
         throw new \blaze\lang\ClassCastException('This array may only contain objects of the given type ' . $this->typeChecker->getType());
     }
     $this->objects[$offset] = $value;
 }
Ejemplo n.º 2
0
 protected function resolveSubParts(\blaze\web\application\BlazeContext $context, $subExpressions, $subBrackets, $expressionString)
 {
     if (\blaze\lang\String::isNativeType($expressionString)) {
         while (preg_match('/\\{([0-9]*)\\}/', $expressionString, $matches) != 0) {
             $val = $subExpressions[\blaze\lang\Integer::asNative($matches[1])]->getValue($context);
             $expressionString = str_replace($matches[0], $val, $expressionString);
         }
         while (preg_match('/\\(([0-9]*)\\)/', $expressionString, $matches) != 0) {
             $val = $subBrackets[\blaze\lang\Integer::asNative($matches[1])]->getValue($context);
             $expressionString = str_replace($matches[0], $val, $expressionString);
         }
     }
     return $expressionString;
 }
Ejemplo n.º 3
0
 /**
  *
  * @param blaze\lang\Integer|int $value
  * @return blaze\lang\ClassWrapper
  */
 public static function getNumberClass($value)
 {
     if (self::$numberClasses == null) {
         self::lazyInit();
     }
     if (Byte::isType($value)) {
         return self::$numberClasses[0];
     } else {
         if (Short::isType($value)) {
             return self::$numberClasses[1];
         } else {
             if (Integer::isType($value)) {
                 return self::$numberClasses[4];
             } else {
                 if (Long::isType($value)) {
                     return self::$numberClasses[5];
                 } else {
                     if (Float::isType($value)) {
                         return self::$numberClasses[3];
                     } else {
                         if (Double::isType($value)) {
                             return self::$numberClasses[2];
                         } else {
                             if (BigInteger::isType($value)) {
                                 return self::$numberClasses[6];
                             } else {
                                 if (BigDecimal::isType($value)) {
                                     return self::$numberClasses[7];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
 public function setInt($identifier, $value)
 {
     $this->set($identifier, \blaze\lang\Integer::asNative($value), \PDO::PARAM_INT);
     return $this;
 }
Ejemplo n.º 5
0
 public function setFetchSize($fetchSize)
 {
     $this->checkClosed();
     $this->stmt->setAttribute(\PDO::ATTR_PREFETCH, \blaze\lang\Integer::asNative($fetchSize));
 }
Ejemplo n.º 6
0
 /**
  *
  * @param int $millisecond
  * @return blaze\util\Date
  */
 public function setMillisecond($millisecond)
 {
     $this->millisecond = Integer::asNative($millisecond);
     if ($this->millisecond < 0) {
         $this->millisecond = 0;
     }
     $this->newTime = true;
     return $this;
 }
 /**
  * @return blaze\ds\meta\ColumnMetaData
  * @param int $identifier
  */
 public function getColumn($identifier)
 {
     $meta = $this->pdoStmt->getColumnMeta(\blaze\lang\Integer::asNative($identifier));
     return new ColumnMetaDataImpl($this->schema->getTable($meta['table']), $meta['name']);
 }
Ejemplo n.º 8
0
 public function hashCode()
 {
     if ($this->key instanceof Object) {
         return String::asNative($this->key->hashCode());
     } else {
         return String::asNative(Integer::hexStringToInt(md5($this->key)));
     }
 }
Ejemplo n.º 9
0
 /**
  * Unsets the object at the offset in the array.
  * @throws \blaze\lang\IllegalArgumentException If the offset is not a number.
  */
 public function offsetUnset($offset)
 {
     if (!\blaze\lang\Integer::isNativeType($offset)) {
         throw new \blaze\lang\IllegalArgumentException('The index must be a number');
     }
     // Not needed?
 }
Ejemplo n.º 10
0
 public function intValue()
 {
     \blaze\lang\Integer::asNative($this->getIntVal());
 }
Ejemplo n.º 11
0
 public function validate(\blaze\web\application\BlazeContext $context, $obj)
 {
     if (!Integer::isNativeType($obj)) {
         throw new ValidatorException('No valid int.');
     }
 }
Ejemplo n.º 12
0
 public function toObject(\blaze\web\application\BlazeContext $context, $string)
 {
     return Integer::asNative($string);
 }
Ejemplo n.º 13
0
 public function getInt($identifier)
 {
     $this->checkClosed();
     $val = $this->get($identifier);
     if ($val == null) {
         return null;
     }
     return Integer::asNative($val);
 }
Ejemplo n.º 14
0
 /**
  *
  * @param blaze\lang\String|string $scheme
  * @param blaze\lang\String|string $user
  * @param blaze\lang\String|string $password
  * @param blaze\lang\String|string $host
  * @param int $port
  * @param blaze\lang\String|string $path
  * @param blaze\lang\String|string $query
  * @param blaze\lang\String|string $fragment
  */
 public function __construct($scheme, $user = null, $password = null, $host = null, $port = null, $path = null, $query = null, $fragment = null)
 {
     $this->scheme = $scheme !== null ? \blaze\lang\String::asWrapper($scheme) : null;
     $this->user = $user !== null ? \blaze\lang\String::asWrapper($user) : null;
     $this->password = $password !== null ? \blaze\lang\String::asWrapper($password) : null;
     $this->host = $host !== null ? \blaze\lang\String::asWrapper($host) : null;
     $this->port = $port !== null ? \blaze\lang\Integer::asNative($port) : -1;
     $this->path = $path !== null ? \blaze\lang\String::asWrapper($path) : null;
     $this->query = $query !== null ? \blaze\lang\String::asWrapper($query) : null;
     $this->fragment = $fragment !== null ? \blaze\lang\String::asWrapper($fragment) : null;
     $this->buildUrl();
 }
Ejemplo n.º 15
0
 public function readInt()
 {
     $result = unserialize($this->getNext());
     if (!\blaze\lang\Integer::isType($result)) {
         throw new \blaze\lang\ClassCastException('The next token is not a integer');
     }
     return $result;
 }
Ejemplo n.º 16
0
 public function intValue()
 {
     return Integer::asNative($this->value);
 }
Ejemplo n.º 17
0
 public function writeInt(\int $int)
 {
     $int = \blaze\lang\Integer::asNative($int);
     return $this->out->write(serialize($int));
 }