<commit_before>//
// $Id$
//
// samskivert library - useful routines for java programs
// Copyright (C) 2006-2007 <NAME>, <NAME>
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.samskivert.jdbc.depot.operator;

import java.util.Collection;

import com.samskivert.jdbc.depot.PersistentRecord;
import com.samskivert.jdbc.depot.clause.SelectClause;
import com.samskivert.jdbc.depot.expression.ColumnExp;
import com.samskivert.jdbc.depot.expression.ExpressionVisitor;
import com.samskivert.jdbc.depot.expression.SQLExpression;

/**
 * A convenient container for implementations of conditional operators.  Classes that value brevity
 * over disambiguation will import Conditionals.* and construct queries with Equals() and In();
 * classes that feel otherwise will use Conditionals.Equals() and Conditionals.In().
 */
public abstract class Conditionals
{
    /** The SQL 'is null' operator. */
    public static class IsNull
        implements SQLOperator
    {
        public IsNull (String pColumn)
        {
            this(new ColumnExp(null, pColumn));
        }

        public IsNull (Class<? extends PersistentRecord> pClass, String pColumn)
        {
            this(new ColumnExp(pClass, pColumn));
        }

        public IsNull (ColumnExp column)
        {
            _column = column;
        }

        public ColumnExp getColumn()
        {
            return _column;
        }

        // from SQLExpression
        public void accept (ExpressionVisitor builder) throws Exception
        {
            builder.visit(this);
        }

        // from SQLExpression
        public void addClasses (Collection<Class<? extends PersistentRecord>> classSet)
        {
        }

        protected ColumnExp _column;
    }

    /** The SQL '=' operator. */
    public static class Equals extends SQLOperator.BinaryOperator
    {
        public Equals (SQLExpression column, Comparable value)
        {
            super(column, value);
        }

        public Equals (SQLExpression column, SQLExpression value)
        {
            super(column, value);
        }

        @Override
        public String operator()
        {
            return "=";
        }
    }

    /** The SQL '<' operator. */
    public static class LessThan extends SQLOperator.BinaryOperator
    {
        public LessThan (SQLExpression column, Comparable value)<commit_msg>Added NotEquals.<commit_after>//
// $Id$
//
// samskivert library - useful routines for java programs
// Copyright (C) 2006-2007 <NAME>, <NAME>
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.samskivert.jdbc.depot.operator;

import java.util.Collection;

import com.samskivert.jdbc.depot.PersistentRecord;
import com.samskivert.jdbc.depot.clause.SelectClause;
import com.samskivert.jdbc.depot.expression.ColumnExp;
import com.samskivert.jdbc.depot.expression.ExpressionVisitor;
import com.samskivert.jdbc.depot.expression.SQLExpression;

/**
 * A convenient container for implementations of conditional operators.  Classes that value brevity
 * over disambiguation will import Conditionals.* and construct queries with Equals() and In();
 * classes that feel otherwise will use Conditionals.Equals() and Conditionals.In().
 */
public abstract class Conditionals
{
    /** The SQL 'is null' operator. */
    public static class IsNull
        implements SQLOperator
    {
        public IsNull (String pColumn)
        {
            this(new ColumnExp(null, pColumn));
        }

        public IsNull (Class<? extends PersistentRecord> pClass, String pColumn)
        {
            this(new ColumnExp(pClass, pColumn));
        }

        public IsNull (ColumnExp column)
        {
            _column = column;
        }

        public ColumnExp getColumn()
        {
            return _column;
        }

        // from SQLExpression
        public void accept (ExpressionVisitor builder) throws Exception
        {
            builder.visit(this);
        }

        // from SQLExpression
        public void addClasses (Collection<Class<? extends PersistentRecord>> classSet)
        {
        }

        protected ColumnExp _column;
    }

    /** The SQL '=' operator. */
    public static class Equals extends SQLOperator.BinaryOperator
    {
        public Equals (SQLExpression column, Comparable value)
        {
            super(column, value);
        }

        public Equals (SQLExpression column, SQLExpression value)
        {
            super(column, value);
        }

        @Override
        public String operator()
        {
            return "=";
        }
    }

    /** The SQL '!=' operator. */
    public static class NotEquals extends SQLOperator.BinaryOperator
    {
        public NotEquals (SQLExpression column, Comparable value)
        {
            super(column, value);
        }

        public NotEquals (SQLExpression column, SQLExpression value)
        {
            super(column, value);
        }

        @Override
        public String operator()
        {
            return "!=";
        }
    }

    /** The SQL '<' operator. */
    public static class LessThan extends SQLOperator.BinaryOperator
    {
        public LessThan (SQLExpression column, Comparable value)
{'fraction_non_alphanumeric': 0.08348512446873102, 'fraction_numerical': 0.007285974499089253, 'mean_word_length': 2.421079958463136, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5394660', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1644, 'n_words': 606}