将值value插入到列表key当中，位于值pivot之后。
@param $pivot mixed 支点
@param $value mixed 要插入的数据
@return int    如果命令执行成功，返回插入操作完成之后，列表的长度。如果没有找到pivot，返回-1。如果key不存在或为空列表，返回0。
481950
public function insertAfter($pivot, $value): int
    {
        return $this->handle->lInsert($this->name, \redis::AFTER, $pivot, $value);
    }
752146
public function insert(string $key, $value): int
    {
        return $this->handle->hSet($this->name, $key, $value) ?: 0;
    }
60542
protected function whenPivotLoaded($table, $value, $default = null)
    {
        if (func_num_args() === 2)
            $default = new MissingValue;

        return $this->when(
            $this->pivot && ($this->pivot instanceof $table || $this->pivot->getTable() === $table),
            ...[$value, $default]
        );
    }
930793
protected function toNumber($value)
    {
        if (is_numeric($value)) {
            return $value + 0; // cast to number
        }
        if (is_bool($value) || is_null($value)) {
            return (int) $value;
        }
        if ($this->getTypeCheck()->isArray($value) && count($value) === 1) {
            return $this->toNumber(reset($value));
        }

        return $value;
    }
704643
public function convertToDatabaseValue($value, AbstractPlatform $platform): int
    {
        \assert('is_int($value)');
        if (!isset($this->getValues()[$value])) {
            throw new \InvalidArgumentException('Invalid type.');
        }
        return $value;
    }
1333796
public function add( $value )
	{
		if( !isset( $this->value ) )
			return $this->value = $value;
		if( $value == $this->value)
			return -1;
		if( $value < $this->value )
		{
			if( $this->left )
				$this->left->add( $value );
			else
				$this->left = new ADT_Tree_BinaryNode( $value );
		}
		else if( $value > $this->value )
		{
			if( $this->right )
				$this->right->add( $value );
			else
				$this->right = new ADT_Tree_BinaryNode( $value );
		}
	}
188538
public function increment($key, $value = 1)
    {
        return $this->incrementOrDecrement($key, $value, function ($current, $value) {
            return $current + $value;
        });
    }
815352
public function lInsert($key, $relativePosition, $pivot, $value) {
        $relativePosition = strtolower($relativePosition);

        if ($relativePosition !== 'before' && $relativePosition !== 'after') {
            throw new \UnexpectedValueException(
                sprintf("relativePosition must be 'before' or 'after', was '%s'", $relativePosition)
            );
        }

        return $this->send(['linsert', $key, $relativePosition, $pivot, $value]);
    }
817408
public function attach($data, $pivot = [])
    {
        if (is_array($data)) {
            if (key($data) === 0) {
                $id = $data;
            } else {
                // 保存关联表数据
                $model = new $this->model;
                $id    = $model->insertGetId($data);
            }
        } elseif (is_numeric($data) || is_string($data)) {
            // 根据关联表主键直接写入中间表
            $id = $data;
        } elseif ($data instanceof Model) {
            // 根据关联表主键直接写入中间表
            $relationFk = $data->getPk();
            $id         = $data->$relationFk;
        }

        if ($id) {
            // 保存中间表数据
            $pk                     = $this->parent->getPk();
            $pivot[$this->localKey] = $this->parent->$pk;
            $ids                    = (array) $id;

            foreach ($ids as $id) {
                $pivot[$this->foreignKey] = $id;
                $this->pivot->replace()
                    ->exists(false)
                    ->save($pivot);
                $result[] = $this->newPivot($pivot, true);
            }

            if (count($result) == 1) {
                // 返回中间表模型对象
                $result = $result[0];
            }

            return $result;
        } else {
            throw new Exception('miss relation data');
        }
    }
562443
private function getValue($value)
    {
        if ($this->isBoolean($value)) {
            return (strtolower($value) === 'true');
        } elseif ($this->isInteger($value)) {
            return (int)$value;
        } elseif ($this->isNumber($value)) {
            return (float)$value;
        }
        return $value;
    }
244656
public function increment($key, $value = 1)
    {
        $raw = $this->getPayload($key);

        return tap(
            ((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) {
                $this->put($key, $newValue, $raw['time']);
            }
        );
    }
344561
private function prepareRow($value)
    {
        if (is_array($value) and count($value) === 1) {
            $value = array_shift($value);
        }

        return $value;
    }
150049
public function lastIndexOf($value) {
        $array = [];
        foreach ($this->array as $key => $val) {
            if (null === $val) {
                continue;
            }
            if (Comparator::equals($val, $value)) {
                $array[] = $key;
            }
        }
        return \count($array) === 0 ? null : $array;
    }
1361979
private IntIntPair totalPivotSearch(int k) {
    double max = 0;
    int i, j, pivotRow = k, pivotCol = k;
    double absValue;
    for(i = k; i < coeff.length; i++) {
      for(j = k; j < coeff[0].length; j++) {
        // compute absolute value of
        // current entry in absValue
        absValue = Math.abs(coeff[row[i]][col[j]]);

        // compare absValue with value max
        // found so far
        if(max < absValue) {
          // remember new value and position
          max = absValue;
          pivotRow = i;
          pivotCol = j;
        } // end if
      } // end for j
    } // end for k
    return new IntIntPair(pivotRow, pivotCol);
  }
415651
private List<Object> getValues(PivotField field, Map<Integer, Object> filter) {
//		long start = System.currentTimeMillis();
		List<Object> values = new ArrayList<Object>();
		int fieldIndex = field.getIndex();
		for (int i = 0; i < dataSource.getRowCount(); i++) {
			if (filter.isEmpty()) {
				values.add(dataSource.getValueAt(i, fieldIndex));
			} else {
				if (acceptValue(i, filter)) {
					values.add(dataSource.getValueAt(i, fieldIndex));
				}
			}
		}
//		long stop = System.currentTimeMillis();
//		System.out.println("getValues in " + (stop - start));
		
		return values;
	}
983071
protected function whenPivotLoadedAs($accessor, $table, $value, $default = null)
    {
        if (func_num_args() === 3) {
            $default = new MissingValue;
        }

        return $this->when(
            $this->resource->$accessor &&
            ($this->resource->$accessor instanceof $table ||
            $this->resource->$accessor->getTable() === $table),
            ...[$value, $default]
        );
    }
927898
private void pivotOperation(int k) {
    double pivot = coeff[row[k]][col[k]];

    // pivot row: set pivot to 1
    coeff[row[k]][col[k]] = 1;
    for(int i = k + 1; i < coeff[k].length; i++) {
      coeff[row[k]][col[i]] /= pivot;
    }
    rhs[row[k]] /= pivot;

    if(LOG.isDebugging()) {
      StringBuilder msg = new StringBuilder();
      msg.append("set pivot element to 1 ").append(equationsToString(4));
      LOG.debugFine(msg.toString());
    }

    // for (int i = k + 1; i < coeff.length; i++) {
    for(int i = 0; i < coeff.length; i++) {
      if(i == k) {
        continue;
      }

      // compute factor
      double q = coeff[row[i]][col[k]];

      // modify entry a[i,k], i <> k
      coeff[row[i]][col[k]] = 0;

      // modify entries a[i,j], i > k fixed, j = k+1...n-1
      for(int j = k + 1; j < coeff[0].length; j++) {
        coeff[row[i]][col[j]] = coeff[row[i]][col[j]] - coeff[row[k]][col[j]] * q;
      } // end for j

      // modify right-hand-side
      rhs[row[i]] = rhs[row[i]] - rhs[row[k]] * q;
    } // end for k

    if(LOG.isDebugging()) {
      StringBuilder msg = new StringBuilder();
      msg.append("after pivot operation ").append(equationsToString(4));
      LOG.debugFine(msg.toString());
    }
  }