<commit_before>package com.github.alokagrawal8.rxfirebase.rxdatabase;

import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseReference;
import rx.Observable;

import static com.github.alokagrawal8.rxfirebase.rxdatabase.Utils.checkNotNull;

@SuppressWarnings({ "WeakerAccess", "unused" }) public final class RxReference {

  private DatabaseReference childReference;
  private ValueEventListenerImpl valueEventListener;
  private ChildEventListenerImpl childEventListener;

  RxReference(@NonNull final RxDatabase database) {
    childReference = database.getDatabase().getReference();
  }

  @CheckResult @NonNull public RxReference child(@NonNull final String child) {
    checkNotNull(child, "Child address is null or empty string");
    childReference = childReference.child(child);
    return this;
  }

  @NonNull public Observable<Boolean> setValue(final Object o) {
    final CompletionListenerImpl listener = new CompletionListenerImpl();
    childReference.setValue(o, listener);
    return listener.getObservable();
  }

  @NonNull public Observable<Boolean> setValue(final Object o, final Object o1) {
    final CompletionListenerImpl listener = new CompletionListenerImpl();
    childReference.setValue(o, o1, listener);
    return listener.getObservable();
  }

  @NonNull public Observable<DataSnapshot> getValueEventListener() {
    if (valueEventListener == null) {
      valueEventListener = new ValueEventListenerImpl(false);
      childReference.addValueEventListener(valueEventListener);
    }
    return valueEventListener.getObservable();
  }

  @NonNull public Observable<DataSnapshot> getSingleValueEventListener() {
    final ValueEventListenerImpl listener = new ValueEventListenerImpl(true);
    childReference.addListenerForSingleValueEvent(listener);
    return listener.getObservable();
  }

  @NonNull public Observable<ChildEvent> getChildEventListener() {
    if (childEventListener == null) {
      childEventListener = new ChildEventListenerImpl();
      childReference.addChildEventListener(childEventListener);
    }
    return childEventListener.getObservable();
  }
}<commit_msg>Delete data<commit_after>package com.github.alokagrawal8.rxfirebase.rxdatabase;

import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseReference;
import rx.Observable;

import static com.github.alokagrawal8.rxfirebase.rxdatabase.Utils.checkNotNull;

@SuppressWarnings({ "WeakerAccess", "unused" }) public final class RxReference {

  private DatabaseReference childReference;
  private ValueEventListenerImpl valueEventListener;
  private ChildEventListenerImpl childEventListener;

  RxReference(@NonNull final RxDatabase database) {
    childReference = database.getDatabase().getReference();
  }

  @CheckResult @NonNull public RxReference child(@NonNull final String child) {
    checkNotNull(child, "Child address is null or empty string");
    childReference = childReference.child(child);
    return this;
  }

  @NonNull public Observable<Boolean> setValue(final Object o) {
    final CompletionListenerImpl listener = new CompletionListenerImpl();
    childReference.setValue(o, listener);
    return listener.getObservable();
  }

  @NonNull public Observable<Boolean> setValue(final Object o, final Object o1) {
    final CompletionListenerImpl listener = new CompletionListenerImpl();
    childReference.setValue(o, o1, listener);
    return listener.getObservable();
  }

  @NonNull public Observable<DataSnapshot> getValueEventListener() {
    if (valueEventListener == null) {
      valueEventListener = new ValueEventListenerImpl(false);
      childReference.addValueEventListener(valueEventListener);
    }
    return valueEventListener.getObservable();
  }

  @NonNull public Observable<DataSnapshot> getSingleValueEventListener() {
    final ValueEventListenerImpl listener = new ValueEventListenerImpl(true);
    childReference.addListenerForSingleValueEvent(listener);
    return listener.getObservable();
  }

  @NonNull public Observable<ChildEvent> getChildEventListener() {
    if (childEventListener == null) {
      childEventListener = new ChildEventListenerImpl();
      childReference.addChildEventListener(childEventListener);
    }
    return childEventListener.getObservable();
  }

  @NonNull public Observable<Boolean> removeValue() {
    final CompletionListenerImpl listener = new CompletionListenerImpl();
    childReference.removeValue(listener);
    return listener.getObservable();
  }
}
{'fraction_non_alphanumeric': 0.08606034849128771, 'fraction_numerical': 0.0016999575010624734, 'mean_word_length': 5.555710306406685, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '5016405', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1169, 'n_words': 271}