Swaps two values.
@access		protected
@static
@param		array   	$array		Array of numeric values passed by reference
@param		int			$pos1		First index
@param		int			$pos2 		Second index
@return		void
975136
protected static function swap( &$array, $pos1, $pos2 )
	{
		if( isset( $array[$pos1] ) && isset( $array[$pos2] ) )
		{
			$memory	= $array[$pos1];
			$array[$pos1] = $array[$pos2];
			$array[$pos2] = $memory;
		}
	}
83362
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setSportId($value);
                break;
            case 2:
                $this->setName($value);
                break;
            case 3:
                $this->setAlternativeName($value);
                break;
            case 4:
                $this->setSlug($value);
                break;
            case 5:
                $this->setDescription($value);
                break;
            case 6:
                $this->setHistory($value);
                break;
            case 7:
                $this->setIsTranslation($value);
                break;
            case 8:
                $this->setIsRotation($value);
                break;
            case 9:
                $this->setIsAcyclic($value);
                break;
            case 10:
                $this->setIsCyclic($value);
                break;
            case 11:
                $this->setLongitudinalFlags($value);
                break;
            case 12:
                $this->setLatitudinalFlags($value);
                break;
            case 13:
                $this->setTransversalFlags($value);
                break;
            case 14:
                $this->setMovementDescription($value);
                break;
            case 15:
                $this->setSequencePictureUrl($value);
                break;
            case 16:
                $this->setVariationOfId($value);
                break;
            case 17:
                $this->setStartPositionId($value);
                break;
            case 18:
                $this->setEndPositionId($value);
                break;
            case 19:
                $this->setIsComposite($value);
                break;
            case 20:
                $this->setIsMultiple($value);
                break;
            case 21:
                $this->setMultipleOfId($value);
                break;
            case 22:
                $this->setMultiplier($value);
                break;
            case 23:
                $this->setGeneration($value);
                break;
            case 24:
                $this->setImportance($value);
                break;
            case 25:
                $this->setPictureId($value);
                break;
            case 26:
                $this->setVideoId($value);
                break;
            case 27:
                $this->setTutorialId($value);
                break;
            case 28:
                $this->setKstrukturId($value);
                break;
            case 29:
                $this->setFunctionPhaseId($value);
                break;
            case 30:
                $this->setObjectId($value);
                break;
            case 31:
                $this->setVersion($value);
                break;
            case 32:
                $this->setVersionCreatedAt($value);
                break;
            case 33:
                $this->setVersionComment($value);
                break;
        } // switch()

        return $this;
    }
604192
public function exchangeArray(array $data): void
    {
        foreach ($data as $key => $value) {
            $this->{$key} = (!empty($value)) ? $value : null;
        }
    }
799318
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setDealerId($value);
                break;
            case 2:
                $this->setAdminId($value);
                break;
            case 3:
                $this->setCreatedAt($value);
                break;
            case 4:
                $this->setUpdatedAt($value);
                break;
            case 5:
                $this->setVersion($value);
                break;
            case 6:
                $this->setVersionCreatedAt($value);
                break;
            case 7:
                $this->setVersionCreatedBy($value);
                break;
        } // switch()
    }
904613
public function flip($pos = null){
		
		if(\is_int($pos)){
			$this->_List[$pos] = !$this->_List[$pos];
		}
		else{
			$this->_List = $this->_List->map(function($v){
				return !$v;
			});
		}
		
	}
744761
public static function recurse( $array, $array1 ) {
		foreach ( $array1 as $key => $value ) {

			// Create new key in $array, if it is empty or not an array.
			if ( ! isset( $array[ $key ] ) || ( isset( $array[ $key ] ) && ! is_array( $array[ $key ] ) ) ) {
				$array[ $key ] = [];
			}

			// Overwrite the value in the base array.
			if ( is_array( $value ) ) {
				$value = self::recurse( $array[ $key ], $value );
			}
			$array[ $key ] = $value;
		}
		return $array;
	}
728522
public static void swap(int[] intArray, int index1, int index2) {
        TrivialSwap.swap(intArray, index1, intArray, index2);
    }
424074
public static void swap(Array array, int left, int right) throws ExpressionException {
	int len = array.size();

	if (len == 0) throw new ExpressionException("array is empty");
	if (left < 1 || left > len) throw new ExpressionException("invalid index [" + left + "]", "valid indexes are from 1 to " + len);
	if (right < 1 || right > len) throw new ExpressionException("invalid index [" + right + "]", "valid indexes are from 1 to " + len);

	try {
	    Object leftValue = array.get(left, null);
	    Object rightValue = array.get(right, null);

	    array.setE(left, rightValue);
	    array.setE(right, leftValue);
	}
	catch (PageException e) {
	    throw new ExpressionException("can't swap values of array", e.getMessage());
	}

    }
318346
public function setPosition( $pos )
	{
		if ( $pos == $this->getPosition() ) { return; }

		$this->_values['pos'] = (int) $pos;
		$this->setModified();
	}
890945
public function fromArray(array $array)
    {
        $this->removeAll();
        foreach ($array as $name => $values) {
            if (\is_array($values)) {
                foreach ($values as $value) {
                    $this->add($name, $value);
                }
            } else {
                $this->add($name, $values);
            }
        }
    }
424526
public static void swapC(double[] array, int i, int j)
    {
        
        double tmp_i= array[i];
        double tmp_j = array[j];
        if(tmp_i > tmp_j)
        {
            array[i] = tmp_j;
            array[j] = tmp_i;
        }
    }
1162492
public function fromArray(array $array) {
        $rows = count($array);
        for ($i=$rows;$i-->0;) {
            $this[$i]->fromArray($array[$i]);
        }
    }
1372055
private static function array_shuffle(array &$array)
    {
        for($i = count($array) - 1; $i > 0; $i--)
        {
            $j = mt_rand(0,$i);
            $temp = $array[$i];
            $array[$i] = $array[$j];
            $array[$j] = $temp;
        }
    }
460671
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setCode($value);
                break;
            case 2:
                $this->setEn($value);
                break;
            case 3:
                $this->setDe($value);
                break;
        } // switch()
    }
1123098
protected function shuffle_assoc(&$array) {
        if (count($array) > 1) {
            // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
            $keys = array_keys($array);
            shuffle($keys);
            foreach($keys as $key) {
                $new[$key] = $array[$key];
            }
            $array = $new;
        }
        return true; // because this behaves like in-built shuffle(), which returns true
    }
520897
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setFile($value);
                break;
            case 2:
                $this->setPersonId($value);
                break;
            case 3:
                $this->setVisible($value);
                break;
            case 4:
                $this->setPosition($value);
                break;
            case 5:
                $this->setCreatedAt($value);
                break;
            case 6:
                $this->setUpdatedAt($value);
                break;
            case 7:
                $this->setVersion($value);
                break;
            case 8:
                $this->setVersionCreatedAt($value);
                break;
            case 9:
                $this->setVersionCreatedBy($value);
                break;
            case 10:
                $this->setPersonIdVersion($value);
                break;
        } // switch()
    }
1281462
public static function ksortRecursive(&$array)
    {
        if (!is_array($array)) {
            return false;
        }

        ksort($array);
        foreach ($array as $key => $value) {
            static::ksortRecursive($array[$key]);
        }

        return true;
    }