Return the opposite direction from the currently sorted column's direction.
@return string
357706
public function OppositeDirection()
    {
        // If direction is set, then just reverse it.
        $direction = $this->request->getVar('Dir');
        if ($direction) {
            if ($direction == 'ASC') {
                return 'DESC';
            }
            return 'ASC';
        }

        // If the sort column is set, then we're sorting by ASC (default is omitted)
        if ($this->request->getVar('Sort')) {
            return 'DESC';
        }

        // Otherwise we're not sorting at all so default to ASC.
        return 'ASC';
    }
399757
private function rotateLeft()
    {
        $right = $this->right;

        if ($right->information & 2) {
            $this->right = $right->left;
            $right->left = $this;
        } else {
            $right->information |= 2;
            $this->information &= ~ 1;
        }

        $this->information -= 4;

        if ($right->information >= 4) {
            $this->information -= $right->information & ~3;
        }

        $right->information -= 4;

        if ($this->information < 0) {
            $right->information += $this->information & ~3;
        }

        return $right;
    }
1064891
public function getSortNext()
	{
		$defaultSort = $this->grid->getColumnDefaultSort($this->key);

		if ($this->sort == 'ASC') {
			return [$this->key => $defaultSort === 'DESC' ? FALSE : 'DESC'];
		} else if ($this->sort == 'DESC') {
			return [$this->key => $defaultSort === 'DESC' ? 'ASC' : FALSE];
		}

		return [$this->key => 'ASC'];
	}
803924
protected function get_logical_direction($not) {
        switch ($this->direction) {
            case self::DIRECTION_FROM:
                return $not ? self::DIRECTION_UNTIL : self::DIRECTION_FROM;
            case self::DIRECTION_UNTIL:
                return $not ? self::DIRECTION_FROM : self::DIRECTION_UNTIL;
            default:
                throw new \coding_exception('Unexpected direction');
        }
    }
88292
public function moveRight() //#777C
    {
        $sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aid');
        if ($sArticleId && ($aItems = $this->getCompareItems())) {
            $sNextArticleId = 0;

            $blFound = false;
            foreach ($aItems as $sOxid => $sVal) {
                if ($blFound) {
                    $sNextArticleId = $sOxid;
                    $blFound = false;
                }
                if ($sOxid == $sArticleId) {
                    $blFound = true;
                }
            }

            if ($sNextArticleId) {
                $aNewItems = [];
                foreach ($aItems as $sOxid => $sVal) {
                    if ($sOxid == $sArticleId) {
                        $aNewItems[$sNextArticleId] = true;
                    } elseif ($sOxid == $sNextArticleId) {
                        $aNewItems[$sArticleId] = true;
                    } else {
                        $aNewItems[$sOxid] = true;
                    }
                }
                $this->setCompareItems($aNewItems);
            }
        }
    }
1064018
public function getSortString() {
    $sort = $this->getSort();
    $sortString = array();
    if (is_array($sort) && !empty($sort)) {
      foreach ($sort as $k => $v) {
        $sortString[] = $v . $k;
      }
    }
    return implode(";", $sortString);
  }
1156253
public function reverse()
    {
        return static::of(
            ArrayList::of($this->split())->reverse()->join(),
            $this->encoding
        );
    }
62766
protected function getDirection($direction): int
    {
        if (\is_string($direction)) {
            $direction = \strtolower($direction);

            if ($direction === 'desc') {
                $direction = \SORT_DESC;
            } else {
                $direction = \SORT_ASC;
            }
        }

        if (
            $direction !== \SORT_DESC
            &&
            $direction !== \SORT_ASC
        ) {
            $direction = \SORT_ASC;
        }

        return $direction;
    }
980710
public function getReverseDiff()
    {
        $diff = new self();

        // columns
        $diff->setFromColumn($this->toColumn);
        $diff->setToColumn($this->fromColumn);

        // properties
        $changedProperties = [];
        foreach ($this->changedProperties as $name => $propertyChange) {
            $changedProperties[$name] = array_reverse($propertyChange);
        }
        $diff->setChangedProperties($changedProperties);

        return $diff;
    }
511472
protected function parseSorting(){
		$order = array();
		foreach($this->stmt->getSorting() as $rule){
			list($field, $type) = $rule;
			$order[] = $this->tryDelimite($field) . ($type !== null ? ' ' . $type : '');
		}
		return "\nORDER BY " . implode(', ', $order);
	}
112064
private function _sortDirection()
    {
        $collection = ResourceTable::collection();
        $sort = $collection->getSort();

        return $sort['dir'] ? $sort['dir'] : ResourceTable::DEFAULT_SORT_DIR;
    }
1108976
public function changeOrdering($direction)
    {
        $allowedDirections = array('asc', 'desc');
        $direction = strtolower($direction);
        $isInArray = in_array($direction, $allowedDirections, true);
        if (!empty($direction) && $isInArray) {
            if ($direction == 'asc') {
                $direction = 'desc';
            } else {
                $direction = 'asc';
            }
        }
        return $direction;
    }
270096
public function getEOL()
    {
        $pos = $this->pos();

        $this->rewind();
        $pos2 = $this->search("\n", false, false);
        if ($pos2) {
            $this->seek(-1);
            $eol = ($this->getChar() == "\r")
                ? "\r\n"
                : "\n";
        } else {
            $eol = is_null($pos2)
                ? null
                : "\n";
        }

        $this->seek($pos, false);

        return $eol;
    }
174911
public function reversed(): Map
    {
        $reversed = new self();
        $reversed->pairs = array_reverse($this->pairs);

        return $reversed;
    }
239052
public function getSortDirection(array $query = [])
    {
        $sort_direction = isset($query['sort_direction']) ? $query['sort_direction'] : null;

        return $this->searcher->getValidSortDirection($sort_direction);
    }
304784
private function sort()
    {
        // sort by reverse key length
        uksort($this->tokens, function ($first, $second) {
            return strlen($second) - strlen($first);
        });
    }
700929
public function getPrevChar()
	{
		if( $this->direction == ">" )
			$this->pointer--;
		if( $this->pointer <= $this->count() &&  $this->pointer > 0 )
		{
			$this->direction = "<";
			$this->pointer--;
			$character = $this->buffer[$this->pointer];
		}
		return $character;
	}