Swaps the nodes at two indices of the heap.

@param int $a
@param int $b
544782
private function swap(int $a, int $b)
    {
        $temp           = $this->heap[$a];
        $this->heap[$a] = $this->heap[$b];
        $this->heap[$b] = $temp;
    }
1012255
private final function sortIntervals( $a, $b )
    {
        if( 0 !== $lowerCompare = $this->sort( $a[0], $b[0], self::NULL_IS_LOW ) ) {
            return $lowerCompare;
        }
        return -$this->sort( $a[1], $b[1], self::NULL_IS_HIGH );
    }
383644
public static function exchange(array &$elements, $indexA, $indexB)
    {
        $count = count($elements);

        if (($indexA < 0 || $indexA > ($count - 1))
            || $indexB < 0
            || $indexB > ($count - 1)
        ) {
            throw new IndexOutOfBoundsException();
        }

        $temp = $elements[$indexA];

        $elements[$indexA] = $elements[$indexB];

        $elements[$indexB] = $temp;
    }
619565
public static void swapCol(Matrix A, int j, int k)
    {
        swapCol(A, j, k, 0, A.rows());
    }
557603
private function compare(int $a, int $b)
    {
        $x = $this->heap[$a];
        $y = $this->heap[$b];

        // Compare priority, using insertion stamp as fallback.
        return ($x->priority <=> $y->priority) ?: ($y->stamp <=> $x->stamp);
    }
975246
final void swapPointers(int indexA, int indexB) {
    assert indexA >= 0 && indexA < valuesHeld;
    assert indexB >= 0 && indexB < valuesHeld;

    ByteBuffer a = copyPointer(indexA);
    ByteBuffer b = readPointer(indexB);
    writePointer(indexA, b);
    writePointer(indexB, a);
  }
852627
public function coprime($a, $b)
    {
        list($a, $b) = array($this->bcNormalize($a), $this->bcNormalize($b));

        try {

            while ($this->coCompare($a, $b)) {
                list($a, $b) = $this->coSwitch($a, $b);
            }

        } catch (\Exception $e) {
            throw $e;
        }

        return (bccomp($a, '1') == 0) ? true : false;
    }
809487
public void swap(Tree<T> node) {
    Tree<T> thisParent = this.parent;
    List<Tree<T>> thisChildren = new ArrayList<>(this.children);

    this.removeFromParent();
    if (node.parent != null) {
      node.parent.add(this);
    }
    node.children.forEach(this::add);

    node.removeFromParent();
    if (thisParent != null) {
      thisParent.add(node);
    }
    thisChildren.forEach(node::add);
  }
898518
protected function sort($a, $b)
    {
        $complexityA = $a->complexity();
        $complexityB = $b->complexity();

        return $complexityB - $complexityA;
    }
404446
private void swap(Node n, Node p, Node pp) {
        if (pp == null) {
            swap(n, p);
            return;
        }

        Node nLeftChild = n.o_c;
        if (pp.o_c == p) {
            // p left child of pp
            if (p.o_c == n) {
                if (n.y_s == p) {
                    // n left child of p and no sibling
                    pp.o_c = n;
                    n.y_s = p.y_s;
                    n.o_c = p;
                    p.y_s = n;
                } else {
                    // n left child or p and sibling
                    n.y_s.y_s = n;
                    Node tmp = n.y_s;
                    n.y_s = p.y_s;
                    p.y_s = tmp;
                    pp.o_c = n;
                    n.o_c = p;
                }
            } else {
                // n right child of p
                Node tmp = p.o_c;
                n.y_s = p.y_s;
                pp.o_c = n;
                n.o_c = tmp;
                tmp.y_s = p;
                p.y_s = n;
            }
        } else {
            // p right child of pp
            if (p.o_c == n) {
                if (n.y_s == p) {
                    // n left child of p and no sibling
                    n.y_s = pp;
                    pp.o_c.y_s = n;
                    n.o_c = p;
                    p.y_s = n;
                } else {
                    // n left child of p and sibling
                    pp.o_c.y_s = n;
                    p.y_s = n.y_s;
                    n.y_s = pp;
                    n.o_c = p;
                    p.y_s.y_s = n;
                }
            } else {
                // n right child of p
                pp.o_c.y_s = n;
                n.y_s = pp;
                n.o_c = p.o_c;
                n.o_c.y_s = p;
                p.y_s = n;
            }
        }

        // hang children
        p.o_c = nLeftChild;
        if (nLeftChild != null) {
            if (nLeftChild.y_s == n) {
                nLeftChild.y_s = p;
            } else {
                nLeftChild.y_s.y_s = p;
            }
        }
    }
668267
public static int[] swap(int[] array, int index1, int index2) {
		if (isEmpty(array)) {
			throw new IllegalArgumentException("Number array must not empty !");
		}
		int tmp = array[index1];
		array[index1] = array[index2];
		array[index2] = tmp;
		return array;
	}
1024289
public function call($a, $b)
    {
        return $a * ($b / $this->gcdMath->call($a, $b));
    }
700572
private function siftDown(int $node)
    {
        $last = floor(count($this->heap) / 2);

        for ($parent = $node; $parent < $last; $parent = $leaf) {

            // Determine the largest leaf to potentially swap with the parent.
            $leaf = $this->getLargestLeaf($parent);

            // Done if the parent is not greater than its largest leaf
            if ($this->compare($parent, $leaf) > 0) {
                break;
            }

            $this->swap($parent, $leaf);
        }
    }
352217
public static void swap(long[] longArray, int index1, int index2) {
        TrivialSwap.swap(longArray, index1, longArray, index2);
    }
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;
		}
	}
791193
public function reorderContent($type, $a, $b = null, $father = null)
    {
        $a = $this->getNode($type, $a, $father);
        $a->detach();

        if ($b) {
            $b = $this->getNode($type, $b, $father);
            $a->setBack($b->getBack());
            $a->setNext($b);

            if ($b->getBack()) {
                $b->getBack()->setNext($a);
            }

            $b->setBack($a);
        } else {
            $b = $this->getnode($type, null, $father);
            $a->setNext($b->getNext());
            $a->setBack($b);
            $b->setNext($a);
        }

        $this->manager->persist($a);
        $this->manager->persist($b);
        $this->manager->flush();
    }
1112224
public function swap($a, $b)
    {
        $oldA = $this->get($a);
        $oldB = $this->get($b);

        $this->set($a, $oldB);
        $this->set($b, $oldA);

        return $this;
    }