<commit_before>package foam.dao;

import foam.core.*;
import foam.dao.*;
import foam.mlang.*;
import foam.mlang.predicate.*;
import foam.mlang.order.*;

public abstract class AbstractDAO
  extends    ContextAwareSupport
  implements DAO
{
  protected ClassInfo    of_         = null;
  protected PropertyInfo primaryKey_ = null;

  public DAO where(Predicate predicate) {
    return new FilteredDAO().setPredicate(predicate).setDelegate(this);
  }

  public DAO orderBy(Comparator comparator) {
    return new OrderedDAO().setOrder(comparator).setDelegate(this);
  }

  public DAO skip(long count) {
    return new SkipDAO().setSkip(count).setDelegate(this);
  }

  public DAO limit(long count) {
    return new LimitedDAO().setLimit(count).setDelegate(this);
  }

  public void pipe_(X x, foam.dao.Sink sink) {
    throw new UnsupportedOperationException();
  }

  protected Sink decorateSink_(Sink sink, long skip, long limit, Comparator order, Predicate predicate) {
    if ( limit > 0 ) {
      sink = new LimitedSink().setLimit(limit).setDelegate(sink);
    }

    if ( skip > 0 ) {
      sink = new SkipSink().setSkip(skip).setDelegate(sink);
    }

    if ( order != null ) {
      sink = new OrderedSink().setComparator(order).setDelegate(sink);
    }

    if ( predicate != null ) {
      sink = new PredicatedSink().setPredicate(predicate).setDelegate(sink);
    }

    return sink;
  }

  public ClassInfo getOf() {
    return of_;
  }

  public AbstractDAO setOf(ClassInfo of) {
    of_ = of;
    primaryKey_ = (PropertyInfo)of.getAxiomByName("id");
    return this;
  }

  public PropertyInfo getPrimaryKey() {
    return primaryKey_;
  }

  protected Object getPK(FObject obj) {
    return getPrimaryKey().get(obj);
  }

  public void listen() {
    this.listen_(this.getX());
  }

  public void listen_(X x) {
    // TODO
  }

  public FObject put(FObject obj) {
    return this.put_(this.getX(), obj);
  }

  public FObject remove(FObject obj) {
    return this.remove_(this.getX(), obj);
  }

  public void removeAll() {
    this.removeAll_(this.getX(), 0, 0, null, null);
  }

  public Sink select(Sink sink) {
    return this.select_(this.getX(), sink, 0, 0, null, null);
  }

  public FObject find(Object id) {
    return this.find_(this.getX(), id);
  }

  public void pipe(Sink sink) {
    this.pipe_(this.getX(), sink);
  }

  public DAO inX(X x) {
    ProxyDAO dao = new ProxyDAO();
    dao.setDelegate(this);
    dao.setX(x);
    return dao;
  }

  public Object cmd_(X x, Object obj) {
    // TODO
    return null;
  }

  public Object cmd(Object obj) {
    return this.cmd_(this.getX(), obj);
  }
}
<commit_msg>Factored in 0 as a valid value<commit_after>package foam.dao;

import foam.core.*;
import foam.dao.*;
import foam.mlang.*;
import foam.mlang.predicate.*;
import foam.mlang.order.*;

public abstract class AbstractDAO
  extends    ContextAwareSupport
  implements DAO
{
  protected ClassInfo    of_         = null;
  protected PropertyInfo primaryKey_ = null;

  public DAO where(Predicate predicate) {
    return new FilteredDAO().setPredicate(predicate).setDelegate(this);
  }

  public DAO orderBy(Comparator comparator) {
    return new OrderedDAO().setOrder(comparator).setDelegate(this);
  }

  public DAO skip(long count) {
    return new SkipDAO().setSkip(count).setDelegate(this);
  }

  public DAO limit(long count) {
    return new LimitedDAO().setLimit(count).setDelegate(this);
  }

  public void pipe_(X x, foam.dao.Sink sink) {
    throw new UnsupportedOperationException();
  }

  protected Sink decorateSink_(Sink sink, long skip, long limit, Comparator order, Predicate predicate) {
    if ( limit >= 0 ) {
      sink = new LimitedSink().setLimit(limit).setDelegate(sink);
    }

    if ( skip >= 0 ) {
      sink = new SkipSink().setSkip(skip).setDelegate(sink);
    }

    if ( order != null ) {
      sink = new OrderedSink().setComparator(order).setDelegate(sink);
    }

    if ( predicate != null ) {
      sink = new PredicatedSink().setPredicate(predicate).setDelegate(sink);
    }

    return sink;
  }

  public ClassInfo getOf() {
    return of_;
  }

  public AbstractDAO setOf(ClassInfo of) {
    of_ = of;
    primaryKey_ = (PropertyInfo)of.getAxiomByName("id");
    return this;
  }

  public PropertyInfo getPrimaryKey() {
    return primaryKey_;
  }

  protected Object getPK(FObject obj) {
    return getPrimaryKey().get(obj);
  }

  public void listen() {
    this.listen_(this.getX());
  }

  public void listen_(X x) {
    // TODO
  }

  public FObject put(FObject obj) {
    return this.put_(this.getX(), obj);
  }

  public FObject remove(FObject obj) {
    return this.remove_(this.getX(), obj);
  }

  public void removeAll() {
    this.removeAll_(this.getX(), 0, 0, null, null);
  }

  public Sink select(Sink sink) {
    return this.select_(this.getX(), sink, 0, 0, null, null);
  }

  public FObject find(Object id) {
    return this.find_(this.getX(), id);
  }

  public void pipe(Sink sink) {
    this.pipe_(this.getX(), sink);
  }

  public DAO inX(X x) {
    ProxyDAO dao = new ProxyDAO();
    dao.setDelegate(this);
    dao.setX(x);
    return dao;
  }

  public Object cmd_(X x, Object obj) {
    // TODO
    return null;
  }

  public Object cmd(Object obj) {
    return this.cmd_(this.getX(), obj);
  }
}

{'fraction_non_alphanumeric': 0.12691218130311616, 'fraction_numerical': 0.0024551463644948064, 'mean_word_length': 3.1214007782101167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5691764', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1777, 'n_words': 430}