<commit_before>/**
 * Copyright (c) 2012 <NAME> <<EMAIL>>
 *
 * The full copyright and license information is presented
 * in the file LICENSE that was distributed with this source code.
 */
package mql.model.semantic

import collection.mutable.ListBuffer

/**
 * Command expressions, e.g. raw strings or integers
 */
abstract case class CommandExpression() extends ExpressionTree

object ColumnExpression {
  implicit def columnAlias2ColumnExpression(column: AliasedColumn) = ColumnExpression(column)
}

case class ColumnExpression(column: AliasedColumn) extends CommandExpression

object ConstantExpression {
  implicit def string2ConstantExpression(constant: String) = new ConstantExpression(constant)
}

case class ConstantExpression(constant: String) extends CommandExpression

case class Separator(override val constant: String) extends ConstantExpression(constant)

case class Concatenate(command1: CommandExpression, command2: CommandExpression, commands: CommandExpression*)(implicit separator: Separator)
  extends CommandExpression {
  children ++= concatenate()

  private[this] def concatenate():Iterable[CommandExpression] = {
    val buffer = new ListBuffer[CommandExpression]
    buffer ++= command1 :: command2 :: commands.toList flatMap (List(_, separator))
    buffer.remove(buffer.length - 1)
    buffer
  }
}

/**
 * Conditional (boolean) expressions
 */
abstract case class BooleanExpression() extends ExpressionTree

case class And(condition1: BooleanExpression, condition2: BooleanExpression, conditions: BooleanExpression*) extends BooleanExpression {
  children += condition1 += condition2 ++= conditions
}

case class Or(condition1: BooleanExpression, condition2: BooleanExpression, conditions: BooleanExpression*) extends BooleanExpression {
  children += condition1 += condition2 ++= conditions
}

abstract case class BinaryExpression(left: ExpressionTree, right: ExpressionTree)
  extends BooleanExpression {
  children += left += right
}

case class Equal(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)

case class !=(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)
case class >(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)<commit_msg>Refactoring.<commit_after>/**
 * Copyright (c) 2012 <NAME> <<EMAIL>>
 *
 * The full copyright and license information is presented
 * in the file LICENSE that was distributed with this source code.
 */
package mql.model.semantic

import collection.mutable.ListBuffer

/**
 * Command expressions, e.g. raw strings or integers
 */
abstract case class CommandExpression() extends ExpressionTree

object ColumnExpression {
  implicit def columnAlias2ColumnExpression(column: AliasedColumn) = ColumnExpression(column)
}

case class ColumnExpression(column: AliasedColumn) extends CommandExpression

object ConstantExpression {
  implicit def string2ConstantExpression(constant: String) = new ConstantExpression(constant)
}

case class ConstantExpression(constant: String) extends CommandExpression

case class Separator(override val constant: String) extends ConstantExpression(constant)

case class Concatenate(commands: CommandExpression*)(implicit separator: Separator)
  extends CommandExpression {
  assert(commands.length >= 2, "Concatenation is possible only for at least 2 commands." + commands.length + " given instead.")
  children ++= {
    val buffer = new ListBuffer[CommandExpression]
    buffer ++= commands.toList flatMap (List(_, separator))
    buffer.remove(buffer.length - 1)
    buffer
  }
}

/**
 * Conditional (boolean) expressions
 */
abstract case class BooleanExpression() extends ExpressionTree

case class And(condition1: BooleanExpression, condition2: BooleanExpression, conditions: BooleanExpression*) extends BooleanExpression {
  children += condition1 += condition2 ++= conditions
}

case class Or(condition1: BooleanExpression, condition2: BooleanExpression, conditions: BooleanExpression*) extends BooleanExpression {
  children += condition1 += condition2 ++= conditions
}

abstract case class BinaryExpression(left: ExpressionTree, right: ExpressionTree)
  extends BooleanExpression {
  children += left += right
}

case class Equal(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)

case class !=(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)
case class >(override val left: ExpressionTree, override val right: ExpressionTree)
  extends BinaryExpression(left, right)
{'fraction_non_alphanumeric': 0.08240819812126388, 'fraction_numerical': 0.007685738684884714, 'mean_word_length': 6.207692307692308, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '3400298', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1120, 'n_words': 395}