<commit_before>package net.pixelcop.sewer;

import java.io.Closeable;
import java.io.IOException;

public abstract class Sink implements Closeable {

  public static final int CLOSED    = 0;
  public static final int OPENING   = 1;
  public static final int FLOWING   = 2;
  public static final int ERROR     = -1;


  protected int status = CLOSED;
  protected Sink subSink = null;

  protected SourceSinkFactory<Sink> sinkFactory;


  /**
   * Open the Sink
   *
   * @throws IOException
   */
  public abstract void open() throws IOException;

  /**
   * Append an Event to the Sink
   * @param event
   * @throws IOException
   */
  public abstract void append(Event event) throws IOException;



  public void setStatus(int status) {
    this.status = status;
  }

  public int getStatus() {
    return status;
  }

  public void setSubSink(Sink subSink) {
    this.subSink = subSink;
  }

  public Sink getSubSink() {
    return subSink;
  }

  public void setSinkFactory(SourceSinkFactory<Sink> sinkFactory) {
    this.sinkFactory = sinkFactory;
  }

  public SourceSinkFactory<Sink> getSinkFactory() {
    return sinkFactory;
  }

  /**
   * Create the SubSink, if possible
   *
   * @return True if a SubSink was created, false otherwise.<commit_msg>use an AtomicInteger for status<commit_after>package net.pixelcop.sewer;

import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

public abstract class Sink implements Closeable {

  public static final int CLOSED    = 0;
  public static final int OPENING   = 1;
  public static final int FLOWING   = 2;
  public static final int ERROR     = -1;


  private AtomicInteger status = new AtomicInteger(CLOSED);
  protected Sink subSink = null;

  protected SourceSinkFactory<Sink> sinkFactory;


  /**
   * Open the Sink
   *
   * @throws IOException
   */
  public abstract void open() throws IOException;

  /**
   * Append an Event to the Sink
   * @param event
   * @throws IOException
   */
  public abstract void append(Event event) throws IOException;


  public void setStatus(int status) {
    this.status.set(status);
  }

  public int getStatus() {
    return status.get();
  }

  public void setSubSink(Sink subSink) {
    this.subSink = subSink;
  }

  public Sink getSubSink() {
    return subSink;
  }

  public void setSinkFactory(SourceSinkFactory<Sink> sinkFactory) {
    this.sinkFactory = sinkFactory;
  }

  public SourceSinkFactory<Sink> getSinkFactory() {
    return sinkFactory;
  }

  /**
   * Create the SubSink, if possible
   *
   * @return True if a SubSink was created, false otherwise.
{'fraction_non_alphanumeric': 0.08393742846241893, 'fraction_numerical': 0.003052270125906143, 'mean_word_length': 3.1952, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2639125', 'n_tokens_mistral': 811, 'n_tokens_neox': 807, 'n_words': 249}