<commit_before>package ragnardb.runtime;

import com.sun.tools.javac.util.StringUtils;
import gw.lang.reflect.IPropertyInfo;
import ragnardb.parser.ast.SQL;

import java.awt.font.NumericShaper;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public abstract class SQLConstraint
{

  IPropertyInfo _propertyInfo;

  public static SQLConstraint isEqualTo( IPropertyInfo pr, Object o )
  {
    return new IsEqualToConstraint( pr, o );
  }

  public static SQLConstraint isIn( IPropertyInfo pr, List<Object> l )
  {
    return new IsInConstraint( pr, l );
  }

  public static SQLConstraint isLike( IPropertyInfo pr, String s )
  {
    return new IsLikeConstraint( pr, s );
  }

  abstract String getSQL( ITypeToSQLMetadata metadata );

  abstract List<Object> getArgs();


  public SQLConstraint andAlso(SQLConstraint sql){
    return new AndConstraint(_propertyInfo, this, sql);
  }

  private static class AndConstraint extends SQLConstraint
  {

    SQLConstraint constraint1;
    SQLConstraint constraint2;
    String result;

    AndConstraint( IPropertyInfo pi, SQLConstraint _constraint1, SQLConstraint _constraint2 )
    {
      _propertyInfo = pi;
      constraint1 = _constraint1;
      constraint2 = _constraint2;
    }

    public String getSQL( ITypeToSQLMetadata metadata ){
      result = " ( " +   constraint1.getSQL(metadata)  + " AND " +  constraint2.getSQL(metadata) + " ) ";
      return result;
    }

    List<Object> getArgs()
    {<commit_msg>Or Constraints added<commit_after>package ragnardb.runtime;

import com.sun.tools.javac.util.StringUtils;
import gw.lang.reflect.IPropertyInfo;
import ragnardb.parser.ast.SQL;

import java.awt.font.NumericShaper;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public abstract class SQLConstraint
{

  IPropertyInfo _propertyInfo;

  public static SQLConstraint isEqualTo( IPropertyInfo pr, Object o )
  {
    return new IsEqualToConstraint( pr, o );
  }

  public static SQLConstraint isIn( IPropertyInfo pr, List<Object> l )
  {
    return new IsInConstraint( pr, l );
  }

  public static SQLConstraint isLike( IPropertyInfo pr, String s )
  {
    return new IsLikeConstraint( pr, s );
  }

  abstract String getSQL( ITypeToSQLMetadata metadata );

  abstract List<Object> getArgs();


  public SQLConstraint andAlso(SQLConstraint sql){
    return new AndConstraint(_propertyInfo, this, sql);
  }

  public SQLConstraint orElse(SQLConstraint sql){
    return new OrConstraint(_propertyInfo, this, sql);
  }

  private static class AndConstraint extends SQLConstraint
  {

    SQLConstraint constraint1;
    SQLConstraint constraint2;
    String result;

    AndConstraint( IPropertyInfo pi, SQLConstraint _constraint1, SQLConstraint _constraint2 )
    {
      _propertyInfo = pi;
      constraint1 = _constraint1;
      constraint2 = _constraint2;
    }

    public String getSQL( ITypeToSQLMetadata metadata ){
      result = " ( " +   constraint1.getSQL(metadata)  + " AND " +  constraint2.getSQL(metadata) + " ) ";
      return result;
    }

    List<Object> getArgs()
    {
      List answer = new ArrayList();
      answer.addAll(constraint1.getArgs());
      answer.addAll(constraint2.getArgs());
      return answer;
    }
  }

  private static class OrConstraint extends SQLConstraint
  {

    SQLConstraint constraint1;
    SQLConstraint constraint2;
    String result;

    OrConstraint( IPropertyInfo pi, SQLConstraint _constraint1, SQLConstraint _constraint2 )
    {
      _propertyInfo = pi;
      constraint1 = _constraint1;
      constraint2 = _constraint2;
    }

    public String getSQL( ITypeToSQLMetadata metadata ){
      result = " ( " +   constraint1.getSQL(metadata)  + " OR " +  constraint2.getSQL(metadata) + " ) ";
      return result;
    }

    List<Object> getArgs()
    {
{'fraction_non_alphanumeric': 0.08633093525179857, 'fraction_numerical': 0.008221993833504625, 'mean_word_length': 3.5746180963572267, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '6717901', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1123, 'n_words': 293}