Create PROXIMITY expressions
@param string $operator the operator which is used for Create Match expressions
@param array $operands the Match expressions
@param array &$params the expression parameters to be populated
@return string the MATCH expression
161538
public function buildProximityMatch($operator, $operands, &$params)
    {
        if (!isset($operands[0], $operands[1], $operands[2])) {
            throw new InvalidParamException("Operator '$operator' requires three operands.");
        }

        list($column, $value, $proximity) = $operands;

        return $this->buildMatchColumn($column) . ' ' . $this->buildMatchValue($value, $params) . '~' . (int) $proximity;
    }
1094551
private function validateOperator(string $operator)
    {
        if (!in_array($operator, self::VALID_OPERATORS)) {
            throw new \InvalidArgumentException(sprintf(
                '%s is not a valid operator'
            ), $operator);
        }
    }
553208
protected function applyOperation($value, $operator, $operand)
    {
        $processedValue = $value;

        switch ($operator) {
            case "div":
                if ($operand !== 0) {
                    $processedValue = $processedValue / $operand;
                }
                break;
            case "mul":
                $processedValue = $processedValue * $operand;
                break;
            case "add":
                $processedValue = $processedValue + $operand;
                break;
            case "sub":
                $processedValue = $processedValue - $operand;
                break;
            default:
                throw new UnknownOperatorException();
        }

        return $processedValue;
    }
394097
public function addWhere($where, $params = [], $operator = 'AND')
    {
        if ($where instanceof Criteria) {
            return $this->addCriteria($where);
        }
        if (null === $where) {
            return $this;
        }
        if (isset($this->query['where']) && !empty($this->query['where'])) {
            $operator = strtoupper($operator);
            $where = "({$this->query['where']}) {$operator} ({$where})";
        }
        $this->query['where'] = $where;
        $this->addParams($params);
        return $this;
    }
1189315
public function getInlineOperator(string $operator): callable
    {
        if (!$this->hasInlineOperator($operator)) {
            throw new OperatorNotFoundException($operator, sprintf('Inline operator "%s" does not exist.', $operator));
        }

        return $this->inlineOperators[$operator];
    }
806920
public function batch($operator, $files)
    {
        $data = '';
        foreach ($files as $file) {
            if (!is_array($file)) {
                $encodedEntryURI = self::urlBase64Encode($file);
                $data .= "op=/{$operator}/{$encodedEntryURI}&";
            } else {
                $encodedEntryURI = self::urlBase64Encode($file[0]);
                $encodedEntryURIDest = self::urlBase64Encode($file[1]);
                $data .= "op=/{$operator}/{$encodedEntryURI}/{$encodedEntryURIDest}&";
            }
        }
        return $this->fileHandle('/batch', $data);
    }
1089107
function (operator) {
            var name = operator.operator,
                ret = {},
                field;
            if (name === "and" || name === "or" || name === "not") {
                ret["$" + name] = this.translateExpressions(operator.expressions);
            } else if (name === "eql") {
                field = operator.field;
                ret[field] = operator.value;
            } else if (QuerytoMongoMap.hasOwnProperty(name)) {
                field = operator.field;

                ret[field] = {};
                ret[field][QuerytoMongoMap[name]] = operator.value;
            } else if (name === "between") {
                field = operator.field;
                ret[field].$gt = operator.value[0];
                ret[field].$lt = operator.value[1];
            } else if (name === "like") {
                field = operator.field;
                ret[field] = {};
                ret[field].$regex = new RegExp(".*" + operator.value + ".*", "i");
            } else {
                throw new Error("Query Operator '" + name + "' is not supported!");
            }

            return ret;
        }
203519
private static function prependOperator($value, $operator = null)
    {

        if ($operator) {
            $operator = StringHelper::toLowerCase($operator);

            if (in_array($operator, static::$operators) || $operator === 'not') {
                if (is_array($value)) {
                    $values = [];

                    foreach ($value as $v) {
                        $values[] = $operator . ($operator === 'not' ? ' ' : '') . $v;
                    }

                    return $values;
                }

                return $operator . ($operator === 'not' ? ' ' : '') . $value;
            }
        }

        return $value;
    }
700719
protected function _operator($operator, $conditions, &$states)
    {
        if (isset($this->_operators[$operator])) {
            $config = $this->_operators[$operator];
        } elseif (substr($operator, -2) === '()') {
            $op = substr($operator, 0, -2);
            if (isset($this->_operators[$op])) {
                return '(' . $this->_operator($op, $conditions, $states) . ')';
            }
            $config = ['builder' => 'function'];
        } else {
            throw new SqlException("Unexisting operator `'{$operator}'`.");
        }
        $parts = $this->_conditions($conditions, $states);

        $operator = (is_array($parts) && next($parts) === 'NULL' && isset($config['null'])) ? $config['null'] : $operator;
        $operator = $operator[0] === ':' ? strtoupper(substr($operator, 1)) : $operator;

        if (isset($config['builder'])) {
            $builder = $this->_builders[$config['builder']];
            return $builder($operator, $parts);
        }
        if (isset($config['format'])) {
            return sprintf($config['format'], join(", ", $parts));
        }
        return join(" {$operator} ", $parts);
    }
217733
@Override
    protected String naryOperator(final NAryOperator operator, final String opString) {
        final List<Formula> operands = new ArrayList<>();
        for (final Formula op : operator) {
            operands.add(op);
        }
        final int size = operator.numberOfOperands();
        Collections.sort(operands, this.comparator);
        final StringBuilder sb = new StringBuilder();
        int count = 0;
        Formula last = null;
        for (final Formula op : operands) {
            if (++count == size) {
                last = op;
            } else {
                sb.append(operator.type().precedence() < op.type().precedence() ? toString(op) : bracket(op));
                sb.append(opString);
            }
        }
        if (last != null) {
            sb.append(operator.type().precedence() < last.type().precedence() ? toString(last) : bracket(last));
        }
        return sb.toString();
    }
76617
public function defineInlineOperator(string $operator, callable $transformer)
    {
        unset($this->operators[$operator]);
        $this->inlineOperators[$operator] = $transformer;
    }
668724
private function _prepareUnaryExpression($operator, $child) {
        return $this->_iterName.$operator.self::OPEN_BRAKET.$child.self::CLOSE_BRACKET;
    }
1341035
public static function getComparator($operator)
    {
        if (!isset(self::$operators[$operator])) {
            if (count(self::$operatorsMap)) {
                self::initMap();
            }

            if (!isset(self::$operators[$operator])) {
                throw new \Exception(sprintf('"%s" operator not found', $operator));
            }
        }

        return self::$operators[$operator];
    }
603746
public function logicalOperator($operator = null)
    {
        if (is_null($operator)) {
            return $this->logicalOperator;
        }

        Helpers::ensureValidLogicalOperator($operator);

        $this->logicalOperator = $operator;

        return $this;
    }
909753
private LinkedHashSet<Formula> gatherAppliedOperands(final NAryOperator operator) {
    final LinkedHashSet<Formula> applied = new LinkedHashSet<>();
    for (final Formula operand : operator) {
      applied.add(apply(operand, false));
    }
    return applied;
  }
996181
public Operator createOperator(int op, Selector operand)
  {
	Operator operator = new OperatorImpl(op, operand);

	return operator; 
  }
256150
public static Parser<Token> adjacent(String operator) {
    List<Parser<Token>> parsers = new ArrayList<Parser<Token>>(operator.length());
    for (int i = 0; i < operator.length(); i++) {
      parsers.add(TERMS.token(Character.toString(operator.charAt(i))));
    }
    return adjacent(Parsers.list(parsers), Parsers.expect(operator));
  }