Creates a single-value condition with the provided value and operator.
545633
def _CreateSingleValueCondition(self, value, operator):
    """"""
    if isinstance(value, str) or isinstance(value, unicode):
      value = '"%s"' % value
    return '%s %s %s' % (self._field, operator, value)
535087
def _make_condition(self, arg):
        
        def prep_value(v):
            return str(v) if isinstance(v, (datetime.date, datetime.datetime, datetime.time, decimal.Decimal)) else v

        negate = False
        while isinstance(arg, Not):
            negate = not negate
            arg = arg.restriction
        template = "NOT (%s)" if negate else "%s"

        # restrict by string
        if isinstance(arg, str):
            return template % arg.strip().replace("%", "%%")  # escape % in strings, see issue #376

        # restrict by AndList
        if isinstance(arg, AndList):
            # omit all conditions that evaluate to True
            items = [item for item in (self._make_condition(i) for i in arg) if item is not True]
            if any(item is False for item in items):
                return negate  # if any item is False, the whole thing is False
            if not items:
                return not negate   # and empty AndList is True
            return template % ('(' + ') AND ('.join(items) + ')')

        # restriction by dj.U evaluates to True
        if isinstance(arg, U):
            return not negate

        # restrict by boolean
        if isinstance(arg, bool):
            return negate != arg

        # restrict by a mapping such as a dict -- convert to an AndList of string equality conditions
        if isinstance(arg, collections.abc.Mapping):
            return template % self._make_condition(
                AndList('`%s`=%r' % (k, prep_value(v)) for k, v in arg.items() if k in self.heading))

        # restrict by a numpy record -- convert to an AndList of string equality conditions
        if isinstance(arg, np.void):
            return template % self._make_condition(
                AndList(('`%s`=%r' % (k, prep_value(arg[k])) for k in arg.dtype.fields if k in self.heading)))

        # restrict by a QueryExpression subclass -- triggers instantiation
        if inspect.isclass(arg) and issubclass(arg, QueryExpression):
            arg = arg()

        # restrict by another expression (aka semijoin and antijoin)
        if isinstance(arg, QueryExpression):
            assert_join_compatibility(self, arg)
            common_attributes = [q for q in arg.heading.names if q in self.heading.names]
            return (
                # without common attributes, any non-empty set matches everything
                (not negate if arg else negate) if not common_attributes
                else '({fields}) {not_}in ({subquery})'.format(
                    fields='`' + '`,`'.join(common_attributes) + '`',
                    not_="not " if negate else "",
                    subquery=arg.make_sql(common_attributes)))

        # restrict by pandas.DataFrames
        if isinstance(arg, pandas.DataFrame):
            arg = arg.to_records()   # convert to np.recarray

        # if iterable (but not a string, a QueryExpression, or an AndList), treat as an OrList
        try:
            or_list = [self._make_condition(q) for q in arg]
        except TypeError:
            raise DataJointError('Invalid restriction type %r' % arg)
        else:
            or_list = [item for item in or_list if item is not False]  # ignore all False conditions
            if any(item is True for item in or_list):  # if any item is True, the whole thing is True
                return not negate
            return template % ('(%s)' % ' OR '.join(or_list)) if or_list else negate
1240034
public Expression<Float> neq(float value) {
		String valueString = "'" + value + "'";
		return new Expression<Float>(this, Operation.neq, valueString);
	}
857456
@Override
    public ElementOperator<PlainDate> newValue(V value) {

        return new DateOperator(this, ElementOperator.OP_NEW_VALUE, value);

    }
129808
public Expression<Double> neq(double value) {
		String valueString = "'" + value + "'";
		return new Expression<Double>(this, Operation.neq, valueString);
	}
109739
def set_condition_expression(self, value):
        
        if value is None:
            self.__condition_expression = value
        if not isinstance(value, condition_expression.ConditionExpression):
            raise TypeError("ConditionExpression must be set to an instance of class ConditionExpression")
        else:
            self.__condition_expression = value
3864
protected ConditionOperator setupConditionOperator(final ConditionFormatter formatter, final Token.Condition token) {

        final Matcher matcher = PATTERN_CONDITION_OPERATOR.matcher(token.getValue());
        if(!matcher.matches()) {
            throw new IllegalArgumentException("not match condition:" + token.getValue());
        }

        final String operator = matcher.group(1);
        final String number = matcher.group(2);
        final double condition = Double.valueOf(number);

        final ConditionOperator conditionOperator;
        switch(operator) {
            case "=":
                conditionOperator = new ConditionOperator.Equal(condition);
                break;
            case "<>":
                conditionOperator = new ConditionOperator.NotEqual(condition);
                break;
            case ">":
                conditionOperator = new ConditionOperator.GreaterThan(condition);
                break;
            case "<":
                conditionOperator = new ConditionOperator.LessThan(condition);
                break;
            case ">=":
                conditionOperator = new ConditionOperator.GreaterEqual(condition);
                break;
            case "<=":
                conditionOperator = new ConditionOperator.LessEqual(condition);
                break;
            default:
                logger.warn("unknown operator : {}", operator);
                conditionOperator = ConditionOperator.ALL;
                break;

        }

        formatter.setOperator(conditionOperator);
        return conditionOperator;
    }
201248
def register_condition(self, *args, **kwds):
    
    if len(args) == 1 and len(kwds) == 0 and callable(args[0]):
      return self._add_condition(args[0])
    else:
      return partial(self._add_condition, *args, **kwds)
1123213
public final Condition eq(final V value) {
        return new Condition().withComparisonOperator(EQ).withAttributeValueList(convert(value));
    }
1042239
@Override
    public boolean condition(Object input) {
        Number d = (Number) input;
        return op.apply(d.doubleValue(), (value == null ? Double.NaN : value), set);
    }
921502
private function addCondition($key, $value = true, $operator = '=', $part)
    {
        if (is_object($key)) {
            if ($key instanceof Raw) {
                $sql = $key->buildSQL();
                $this->{$part}->push($sql);
                if ($binds = $key->buildBinds()) {
                    if (!is_array($binds)) {
                        $binds = [$binds];
                    }
                    foreach ($binds as $bind) {
                        $this->bind($bind, $part);
                    }
                }

                return $this;
            } elseif ($key instanceof Parenthesis) {
                $sql = $key->build();
                if ($sql) {
                    $sql = '(' . $sql . ')';
                }
                $this->{$part}->push($sql);

                if ($binds = $key->getBinds()) {
                    foreach ($binds as $bind) {
                        $this->bind($bind, $part);
                    }
                }

                return $this;
            }
        }
        if (is_object($value) && object_implements($value, ArrayAccess::class)) {
            $value = $value->__toArray();
        }

        if (is_array($value)) {
            if (count($value) == 0) {
                $value = null;
            } else if (count($value) == 1) {
                $value = end($value);
            }
        }

        if (in_array($operator, ['IS NULL', 'IS NOT NULL'])) {
            $value = null;
        }

        $hasValue = $value || (is_scalar($value) && strlen($value)) || (is_array($value) && count($value));

        if (!is_array($value) && !is_object($value) && in_array($operator, ['IN', 'NOT IN'])) {
            $value = [$value];
        }

        if (is_array($value) && $operator == '=') {
            $operator = 'IN';
        } else if (is_object($value) && $value instanceof Raw && $operator == '=') {
            $operator = 'IN';
        } else if (is_object($value) && $value instanceof Entity && !in_array($operator, ['IN', 'NOT IN'])) {
            $operator = 'IN';
        }

        if (is_only_callable($key)) {
            $key($this->{$part});
        } else if ($operator == 'IN' || $operator == 'NOT IN') {
            if (is_array($value)) {
                if (!$hasValue) {
                    /**
                     * This is probable not needed.
                     */
                    // $this->where->push($this->makeKey($key));
                    $this->{$part}->push($operator == 'IN' ? '0 = 1' : '1 = 1');
                } else {
                    $this->{$part}->push(
                        $this->makeKey($key) . ' ' . $operator . '(' . str_repeat('?, ', count($value) - 1) . '?)'
                    );
                    foreach ($value as $val) {
                        $this->bind($val, $part);
                    }
                }
            } else if ($value instanceof Query) {
                $this->{$part}->push($this->makeKey($key) . ' ' . $operator . '(' . $value->buildSQL() . ')');
                if ($binds = $value->buildBinds()) {
                    if (!is_array($binds)) {
                        $binds = [$binds];
                    }
                    foreach ($binds as $bind) {
                        $this->bind($bind, $part);
                    }
                }
            } else if ($value instanceof Entity) {
                $this->{$part}->push(
                    $this->makeKey($key) . ' ' . $operator . '(' . $value->getQuery()->buildSQL() . ')'
                );
                if ($binds = $value->getQuery()->buildBinds()) {
                    $this->bind($binds, $part);
                }
            }
        } elseif ($operator == 'IS' || $operator == 'IS NOT') {
            $this->{$part}->push(
                $this->makeKey(
                    $key
                ) . ($hasValue ? ($value === true ? '' : ' ' . $operator . ' ?') : ' ' . $operator . ' NULL')
            );
            if ($hasValue && $value !== true) {
                $this->bind($value, 'where');
            }
        } elseif ($operator == 'LIKE' || $operator == 'NOT LIKE') {
            $this->{$part}->push($this->makeKey($key) . ' ' . $operator . ' ?');
            $this->bind($value, $part);
        } elseif ($operator == 'BETWEEN') {
            $this->{$part}->push($this->makeKey($key) . ' ' . $operator . ' ? AND ?');
            $this->bind($value, $part);
        } else {
            $valuePrefix = $value === true ? '' : ' ';
            $valueSuffix = !$hasValue && $operator
                ? (in_array($operator, ['IS NULL', 'IS NOT NULL'])
                    ? ' ' . $operator
                    : ' IS NULL')
                : '';
            $operatorSql = $operator && (($value || strlen($value)) && $value !== true)
                ? $operator . ' ?'
                : '';
            $suffix = $hasValue
                ? $valuePrefix . $operatorSql
                : $valueSuffix;
            $this->{$part}->push($this->makeKey($key) . $suffix);
            if ($hasValue && $value !== true) {
                $this->bind($value, $part);
            }
        }

        return $this;
    }
299349
public AndCondition and(Condition that) {
        return new AndCondition(this, that.atomic() ? that : _(that));
    }
505921
protected final CALC operator(Class<? extends Operator> operator, String value, char decimalSeparator) {
        return operator(operator, new Num(value, decimalSeparator));
    }
98203
public static ValueFilter createValueFilter(String operation, String value) {
        checkArgument(STRING_SUPPORTED_OPERATION.contains(operation), "String value only support operations in "
                + STRING_SUPPORTED_OPERATION.toString());
        ValueFilter valueFilter = new ValueFilter(operation, SINGLE_QUOTATION + value + SINGLE_QUOTATION);
        return valueFilter;
    }
1042104
public AVQuery<T> whereLessThanOrEqualTo(String key, Object value) {
    conditions.whereLessThanOrEqualTo(key, value);
    return this;
  }
736807
public function and($column, $value = '', $operator = Criterion::EQUALS, $variable = null, $additional = null, $special = null): self
        {
            if ($this->mode == query::MODE_OR) {
                throw new Exception('Cannot combine two selection types (AND/OR) in the same Criteria. Use multiple sub-criteria instead');
            }

            $this->where($column, $value, $operator, $variable, $additional, $special);

            $this->mode = query::MODE_AND;

            return $this;
        }
771474
private FieldConstraint makeSingleFieldConstraint(ConditionCol52 c,
                                                      String cell) {

        SingleFieldConstraint sfc = new SingleFieldConstraint(c.getFactField());

        //Condition columns can be defined as having no operator, in which case the operator
        //is taken from the cell's value. Pretty yucky really if we're to be able to perform
        //expansion and contraction of decision table columns.... this might have to go.
        if (no(c.getOperator())) {

            String[] a = cell.split("\\s");
            if (a.length > 1) {
                //Operator might be 1 part (e.g. "==") or two parts (e.g. "not in")
                StringBuilder operator = new StringBuilder(a[0]);
                for (int i = 1; i < a.length - 1; i++) {
                    operator.append(a[i]);
                }
                sfc.setOperator(operator.toString());
                sfc.setValue(a[a.length - 1]);
            } else {
                sfc.setValue(cell);
            }
        } else {

            sfc.setOperator(c.getOperator());
            if (OperatorsOracle.operatorRequiresList(c.getOperator())) {
                sfc.setValue(makeInList(cell));
            } else {
                if (!c.getOperator().equals("== null") && !c.getOperator().equals("!= null")) {
                    sfc.setValue(cell);
                }
            }
        }
        final int constraintValueType = c.getConstraintValueType();
        if ((constraintValueType == BaseSingleFieldConstraint.TYPE_LITERAL || constraintValueType == BaseSingleFieldConstraint.TYPE_RET_VALUE) && c.isBound()) {
            sfc.setFieldBinding(c.getBinding());
        }
        sfc.setParameters(c.getParameters());
        sfc.setConstraintValueType(c.getConstraintValueType());
        sfc.setFieldType(c.getFieldType());
        return sfc;
    }