<commit_before>/*
 * Copyright 2015, The Querydsl Team (http://www.querydsl.com/team)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.querydsl.scala

import java.util.Arrays._
import java.util.Collection

import com.querydsl.core.types.Ops._
import com.querydsl.core.types._
import com.querydsl.scala.Constants._
import com.querydsl.scala.Operations._

object Constants {

  def constant(value: Integer) = ConstantImpl.create(value.intValue)

  def constant(value: String) = ConstantImpl.create(value)

  def constant[T](value: T) = ConstantImpl.create(value)

}

trait DslExpression[T] extends Expression[T] {

  def as(right: Path[T]): DslExpression[T] = Operations.dsl(getType, ALIAS, this, right)

  def as(alias: String): DslExpression[T] = as(ExpressionUtils.path[T](getType, alias))

}

trait SimpleExpression[T] extends DslExpression[T] {

  override def as(right: Path[T]): SimpleExpression[T] = simple(getType, ALIAS, this, right)

  override def as(alias: String): SimpleExpression[T] = as(ExpressionUtils.path[T](getType, alias))

  def eq(right: T): BooleanExpression = eq(constant(right))

  def eq(right: Expression[T]) = boolean(EQ, this, right)

  def ===(right: T) = eq(right)

  def ===(right: Expression[T]) = eq(right)

  def ne(right: T): BooleanExpression = ne(constant(right))

  def ne(right: Expression[T]) = boolean(NE, this, right)

  def !==(right: T) = ne(right)

  def !==(right: Expression[T]) = ne(right)

  lazy val count = number[Long](classOf[Long], AggOps.COUNT_AGG, this)

  def in(right: Collection[T]) = boolean(IN, this, constant(right))

  def in(right: T*): BooleanExpression = in(asList(right: _*))

  def in(right: CollectionExpression[T,_]) = boolean(IN, this, right)

  def countDistinct() = number[Long](classOf[Long], AggOps.COUNT_DISTINCT_AGG, this)

  lazy val isNotNull = boolean(IS_NOT_NULL, this)

  lazy val isNull = boolean(IS_NULL, this)

  def notIn(right: Collection[T]) = in(right).not

  def notIn(right: T*) = in(right: _*).not

  def notIn(right: CollectionExpression[T,_]) = in(right).not

  def nullif(right: T): SimpleExpression[T] = nullif(constant(right))

  def nullif(right: Expression[T]) = simple[T](getType, NULLIF, this, right)

  def is[M <: SimpleExpression[T]](f: M => BooleanExpression): BooleanExpression = {
    if (f == null) isNull else f(this.asInstanceOf[M])
  }

  def not[M <: SimpleExpression[T]](f: M => BooleanExpression): BooleanExpression = f(this.asInstanceOf[M]).not

}

trait ArrayExpression[T <: Array[_]] extends DslExpression[T] {

  lazy val size = number[Integer](classOf[Integer], Ops.ARRAY_SIZE, this)

}

trait CollectionExpressionBase[T <: Collection[C], C, Q <: Expression[_ >: C]]
  extends DslExpression[T] with com.querydsl.core.types.CollectionExpression[T,C] {

  lazy val size = number[Int](classOf[Int], COL_SIZE, this)

  lazy val isEmpty = boolean(COL_IS_EMPTY, this)<commit_msg>Extend SimpleExpression#in(...) signatures<commit_after>/*
 * Copyright 2015, The Querydsl Team (http://www.querydsl.com/team)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.querydsl.scala

import java.util.Arrays._
import java.util.Collection

import com.querydsl.core.types.Ops._
import com.querydsl.core.types._
import com.querydsl.scala.Constants._
import com.querydsl.scala.Operations._

object Constants {

  def constant(value: Integer) = ConstantImpl.create(value.intValue)

  def constant(value: String) = ConstantImpl.create(value)

  def constant[T](value: T) = ConstantImpl.create(value)

}

trait DslExpression[T] extends Expression[T] {

  def as(right: Path[T]): DslExpression[T] = Operations.dsl(getType, ALIAS, this, right)

  def as(alias: String): DslExpression[T] = as(ExpressionUtils.path[T](getType, alias))

}

trait SimpleExpression[T] extends DslExpression[T] {

  override def as(right: Path[T]): SimpleExpression[T] = simple(getType, ALIAS, this, right)

  override def as(alias: String): SimpleExpression[T] = as(ExpressionUtils.path[T](getType, alias))

  def eq(right: T): BooleanExpression = eq(constant(right))

  def eq(right: Expression[T]) = boolean(EQ, this, right)

  def ===(right: T) = eq(right)

  def ===(right: Expression[T]) = eq(right)

  def ne(right: T): BooleanExpression = ne(constant(right))

  def ne(right: Expression[T]) = boolean(NE, this, right)

  def !==(right: T) = ne(right)

  def !==(right: Expression[T]) = ne(right)

  lazy val count = number[Long](classOf[Long], AggOps.COUNT_AGG, this)

  def in(right: Collection[T]) = boolean(IN, this, constant(right))

  def in(right: T*): BooleanExpression = in(asList(right: _*))

  def in(right: CollectionExpression[T,_]) = boolean(IN, this, right)

  def in(right: SubQueryExpression[T]) = boolean(IN, this, right)

  def countDistinct() = number[Long](classOf[Long], AggOps.COUNT_DISTINCT_AGG, this)

  lazy val isNotNull = boolean(IS_NOT_NULL, this)

  lazy val isNull = boolean(IS_NULL, this)

  def notIn(right: Collection[T]) = in(right).not

  def notIn(right: T*) = in(right: _*).not

  def notIn(right: CollectionExpression[T,_]) = in(right).not

  def notIn(right: SubQueryExpression[T]) = in(right).not

  def nullif(right: T): SimpleExpression[T] = nullif(constant(right))

  def nullif(right: Expression[T]) = simple[T](getType, NULLIF, this, right)

  def is[M <: SimpleExpression[T]](f: M => BooleanExpression): BooleanExpression = {
    if (f == null) isNull else f(this.asInstanceOf[M])
  }

  def not[M <: SimpleExpression[T]](f: M => BooleanExpression): BooleanExpression = f(this.asInstanceOf[M]).not

}

trait ArrayExpression[T <: Array[_]] extends DslExpression[T] {

  lazy val size = number[Integer](classOf[Integer], Ops.ARRAY_SIZE, this)

}

trait CollectionExpressionBase[T <: Collection[C], C, Q <: Expression[_ >: C]]
  extends DslExpression[T] with com.querydsl.core.types.CollectionExpression[T,C] {

  lazy val size = number[Int](classOf[Int], COL_SIZE, this)

  lazy val isEmpty = boolean(COL_IS_EMPTY, this)
{'fraction_non_alphanumeric': 0.13781729528180123, 'fraction_numerical': 0.002294564749749032, 'mean_word_length': 5.101487314085739, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2015113', 'n_tokens_mistral': 2300, 'n_tokens_neox': 2243, 'n_words': 619}