<commit_before>package br.com.bloder.blormlib;

import android.view.View;

import java.util.ArrayList;
import java.util.List;

import br.com.bloder.blormlib.validation.Action;
import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validation> validations;
    private List<View> field;
    private List<String> errorMessages;
    private List<Validate> validates;
    private Action onSuccess;
    private Action onError;

    public Builder() {
      this.validates = new ArrayList<>();
      this.errorMessages = new ArrayList<>();
      this.validations = new ArrayList<>();
      this.field = new ArrayList<>();
    }

    public Builder(List<Validation> validations, List<View> field, List<String> errorMessages, List<Validate> validates, Action onSuccess, Action onError) {
      this.validations = validations;
      this.field = field;
      this.errorMessages = errorMessages;
      this.validates = validates;
      this.onSuccess = onSuccess;
      this.onError = onError;
    }

    public Builder field(View field) {
      this.field.add(field);
      return this;
    }

    public Builder validate(Validate validation) {
      this.validates.add(validation);
      return this;
    }

    public PhraseSequenceBuilder is(Validation validation) {
      this.errorMessages.add(null);
      this.validations.add(validation);
      return new PhraseSequenceBuilder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }

    public PhraseSequenceBuilder is(String errorMessage, Validation validation) {
      this.errorMessages.add(errorMessage);
      this.validations.add(validation);
      return new PhraseSequenceBuilder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }
  }

  public static class PhraseSequenceBuilder {

    private List<Validation> validations;
    private List<View> field;
    private List<String> errorMessages;
    private List<Validate> validates;
    private Action onSuccess;
    private Action onError;

    public PhraseSequenceBuilder(List<Validation> validations, List<View> field, List<String> errorMessages, List<Validate> validates, Action onSuccess, Action onError) {
      this.validations = validations;
      this.field = field;
      this.errorMessages = errorMessages;
      this.validates = validates;
      this.onSuccess = onSuccess;
      this.onError = onError;
    }

    public PhraseSequenceBuilder and(Validation validation) {
      this.errorMessages.add(null);
      this.validations.add(validation);
      return this;
    }

    public PhraseSequenceBuilder and(String errorMessage, Validation validation) {
      this.errorMessages.add(errorMessage);
      this.validations.add(validation);
      return this;
    }

    public PhraseSequenceBuilder and(Validate validate) {
      this.validates.add(validate);
      return this;
    }

    public Builder andField(View field) {
      this.field.add(field);
      return new Builder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }

    public PhraseSequenceBuilder onSuccess(Action action) {
      this.onSuccess = action;
      return this;
    }

    public PhraseSequenceBuilder onError(Action action) {
      this.onError = action;
      return this;
    }

    public void submitOn(View submittedItem) {
      submittedItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          new Blorm(validations, field, errorMessages, validates, onSuccess, onError).onSubmitted();
        }
      });<commit_msg>Change and func name to validate<commit_after>package br.com.bloder.blormlib;

import android.view.View;

import java.util.ArrayList;
import java.util.List;

import br.com.bloder.blormlib.validation.Action;
import br.com.bloder.blormlib.validation.Validate;
import br.com.bloder.blormlib.validation.Validation;

/**
 * Created by bloder on 05/06/16.
 */
public class Blorm {

  public static class Builder {

    private List<Validation> validations;
    private List<View> field;
    private List<String> errorMessages;
    private List<Validate> validates;
    private Action onSuccess;
    private Action onError;

    public Builder() {
      this.validates = new ArrayList<>();
      this.errorMessages = new ArrayList<>();
      this.validations = new ArrayList<>();
      this.field = new ArrayList<>();
    }

    public Builder(List<Validation> validations, List<View> field, List<String> errorMessages, List<Validate> validates, Action onSuccess, Action onError) {
      this.validations = validations;
      this.field = field;
      this.errorMessages = errorMessages;
      this.validates = validates;
      this.onSuccess = onSuccess;
      this.onError = onError;
    }

    public Builder field(View field) {
      this.field.add(field);
      return this;
    }

    public Builder validate(Validate validation) {
      this.validates.add(validation);
      return this;
    }

    public PhraseSequenceBuilder is(Validation validation) {
      this.errorMessages.add(null);
      this.validations.add(validation);
      return new PhraseSequenceBuilder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }

    public PhraseSequenceBuilder is(String errorMessage, Validation validation) {
      this.errorMessages.add(errorMessage);
      this.validations.add(validation);
      return new PhraseSequenceBuilder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }
  }

  public static class PhraseSequenceBuilder {

    private List<Validation> validations;
    private List<View> field;
    private List<String> errorMessages;
    private List<Validate> validates;
    private Action onSuccess;
    private Action onError;

    public PhraseSequenceBuilder(List<Validation> validations, List<View> field, List<String> errorMessages, List<Validate> validates, Action onSuccess, Action onError) {
      this.validations = validations;
      this.field = field;
      this.errorMessages = errorMessages;
      this.validates = validates;
      this.onSuccess = onSuccess;
      this.onError = onError;
    }

    public PhraseSequenceBuilder and(Validation validation) {
      this.errorMessages.add(null);
      this.validations.add(validation);
      return this;
    }

    public PhraseSequenceBuilder and(String errorMessage, Validation validation) {
      this.errorMessages.add(errorMessage);
      this.validations.add(validation);
      return this;
    }

    public PhraseSequenceBuilder validate(Validate validate) {
      this.validates.add(validate);
      return this;
    }

    public Builder andField(View field) {
      this.field.add(field);
      return new Builder(this.validations, this.field, this.errorMessages, this.validates, this.onSuccess, this.onError);
    }

    public PhraseSequenceBuilder onSuccess(Action action) {
      this.onSuccess = action;
      return this;
    }

    public PhraseSequenceBuilder onError(Action action) {
      this.onError = action;
      return this;
    }

    public void submitOn(View submittedItem) {
      submittedItem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          new Blorm(validations, field, errorMessages, validates, onSuccess, onError).onSubmitted();
        }
      });
{'fraction_non_alphanumeric': 0.09483887870055017, 'fraction_numerical': 0.0015719151165837044, 'mean_word_length': 3.3980414746543777, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '1560273', 'n_tokens_mistral': 2126, 'n_tokens_neox': 2087, 'n_words': 497}