// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/bus/CopyBus.java
// public class CopyBus extends ADefaultBus<ICopyConfiguration> {
// 
//     private static volatile CopyBus instance;
// 
//     public static CopyBus getInstance() {
//         if (instance == null) {
//             synchronized (CopyBus.class) {
//                 if (instance == null) {
//                     instance = new CopyBus();
//                 }
//             }
//         }
// 
//         return instance;
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/CopyToSdCard.java
// public class CopyToSdCard {
// 
//     public void copy(@NonNull ICopyConfiguration copy) {
//         Observable.just(copy)
//                 .observeOn(Schedulers.io())
//                 .subscribeOn(Schedulers.io())
//                 .subscribe(new CopyAction());
//     }
// 
//     public interface ICopyConfiguration {
// 
//         InputStream getCopyStream() throws IOException;
// 
//         File getTarget() throws IOException;
// 
//         long getSize() throws IOException;
// 
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/CopyToSdCard.java
// public interface ICopyConfiguration {
// 
//     InputStream getCopyStream() throws IOException;
// 
//     File getTarget() throws IOException;
// 
//     long getSize() throws IOException;
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/WordListRawResourceCopyConfiguration.java
// public class WordListRawResourceCopyConfiguration implements CopyToSdCard.ICopyConfiguration {
// 
//     private static final String FOLDER = "wordlists";
// 
//     private final Context context;
//     private final int rawRes;
//     private final File baseDir;
// 
//     public WordListRawResourceCopyConfiguration(@NonNull Context context,
//                                                 @RawRes int rawRes) {
// 
//         this.context = context.getApplicationContext();
//         this.rawRes = rawRes;
// 
//         baseDir = new File(context.getExternalFilesDir(null), FOLDER);
// 
//         try {
//             FileUtils.forceMkdir(baseDir);
//         } catch (IOException e) {
//             throw new IllegalStateException("Failed to create required directory " + baseDir, e);
//         }
//     }
// 
//     @Override
//     public InputStream getCopyStream() throws IOException {
//         return context.getResources()
//                 .openRawResource(rawRes);
//     }
// 
//     @Override
//     public File getTarget() throws IOException {
//         String resourceEntryName = context.getResources()
//                 .getResourceEntryName(rawRes);
// 
//         return new File(baseDir, resourceEntryName);
//     }
// 
//     @Override
//     public long getSize() throws IOException {
//         InputStream inputStream = context.getResources()
//                 .openRawResource(rawRes);
// 
//         long fileSize = inputStream.available();
//         inputStream.close();
// 
//         return fileSize;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o != null
//                 && o instanceof WordListRawResourceCopyConfiguration) {
// 
//             WordListRawResourceCopyConfiguration other = (WordListRawResourceCopyConfiguration) o;
//             return rawRes == other.rawRes
//                     && baseDir.equals(other.baseDir);
//         }
// 
//         return false;
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/dictionary/IDictionary.java
// public interface IDictionary {
// 
//     /**
//      * Determine if a word should be redacted.
//      *
//      * @param word the word in question
//      * @return true if the word should be redacted
//      */
//     boolean shouldRedact(@NonNull String word);
// 
//     /**
//      * The name of the dictionary.
//      *
//      * @return a string resource representation of the dictionary name.
//      */
//     @StringRes
//     int getName();
// 
//     /**
//      * A constant UUID of the dictionary.
//      *
//      * @return a constant UUID
//      */
//     @NonNull
//     String getUUID();
// 
// }


import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import com.ToxicBakery.app.screenshot_redaction.R;
import com.ToxicBakery.app.screenshot_redaction.bus.CopyBus;
import com.ToxicBakery.app.screenshot_redaction.copy.CopyToSdCard;
import com.ToxicBakery.app.screenshot_redaction.copy.CopyToSdCard.ICopyConfiguration;
import com.ToxicBakery.app.screenshot_redaction.copy.WordListRawResourceCopyConfiguration;
import com.ToxicBakery.app.screenshot_redaction.dictionary.IDictionary;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import java.io.IOException;
import java.util.Locale;
import java.util.Set;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
package com.ToxicBakery.app.screenshot_redaction.dictionary.impl;






public class DictionaryEnglishNames implements IDictionary {

    private static final String TAG = "DictionaryEnglishNames";

    private static DictionaryEnglishNames instance;

    @VisibleForTesting
    final ICopyConfiguration copyConfiguration;

    private final CopyBus copyBus;

    private Set<String> words;

    DictionaryEnglishNames(@NonNull Context context) {
        copyConfiguration = new WordListRawResourceCopyConfiguration(context, R.raw.wordlist_english_names);
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/bus/CopyBus.java
// public class CopyBus extends ADefaultBus<ICopyConfiguration> {
// 
//     private static volatile CopyBus instance;
// 
//     public static CopyBus getInstance() {
//         if (instance == null) {
//             synchronized (CopyBus.class) {
//                 if (instance == null) {
//                     instance = new CopyBus();
//                 }
//             }
//         }
// 
//         return instance;
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/CopyToSdCard.java
// public class CopyToSdCard {
// 
//     public void copy(@NonNull ICopyConfiguration copy) {
//         Observable.just(copy)
//                 .observeOn(Schedulers.io())
//                 .subscribeOn(Schedulers.io())
//                 .subscribe(new CopyAction());
//     }
// 
//     public interface ICopyConfiguration {
// 
//         InputStream getCopyStream() throws IOException;
// 
//         File getTarget() throws IOException;
// 
//         long getSize() throws IOException;
// 
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/CopyToSdCard.java
// public interface ICopyConfiguration {
// 
//     InputStream getCopyStream() throws IOException;
// 
//     File getTarget() throws IOException;
// 
//     long getSize() throws IOException;
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/copy/WordListRawResourceCopyConfiguration.java
// public class WordListRawResourceCopyConfiguration implements CopyToSdCard.ICopyConfiguration {
// 
//     private static final String FOLDER = "wordlists";
// 
//     private final Context context;
//     private final int rawRes;
//     private final File baseDir;
// 
//     public WordListRawResourceCopyConfiguration(@NonNull Context context,
//                                                 @RawRes int rawRes) {
// 
//         this.context = context.getApplicationContext();
//         this.rawRes = rawRes;
// 
//         baseDir = new File(context.getExternalFilesDir(null), FOLDER);
// 
//         try {
//             FileUtils.forceMkdir(baseDir);
//         } catch (IOException e) {
//             throw new IllegalStateException("Failed to create required directory " + baseDir, e);
//         }
//     }
// 
//     @Override
//     public InputStream getCopyStream() throws IOException {
//         return context.getResources()
//                 .openRawResource(rawRes);
//     }
// 
//     @Override
//     public File getTarget() throws IOException {
//         String resourceEntryName = context.getResources()
//                 .getResourceEntryName(rawRes);
// 
//         return new File(baseDir, resourceEntryName);
//     }
// 
//     @Override
//     public long getSize() throws IOException {
//         InputStream inputStream = context.getResources()
//                 .openRawResource(rawRes);
// 
//         long fileSize = inputStream.available();
//         inputStream.close();
// 
//         return fileSize;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o != null
//                 && o instanceof WordListRawResourceCopyConfiguration) {
// 
//             WordListRawResourceCopyConfiguration other = (WordListRawResourceCopyConfiguration) o;
//             return rawRes == other.rawRes
//                     && baseDir.equals(other.baseDir);
//         }
// 
//         return false;
//     }
// 
// }
// 
// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/dictionary/IDictionary.java
// public interface IDictionary {
// 
//     /**
//      * Determine if a word should be redacted.
//      *
//      * @param word the word in question
//      * @return true if the word should be redacted
//      */
//     boolean shouldRedact(@NonNull String word);
// 
//     /**
//      * The name of the dictionary.
//      *
//      * @return a string resource representation of the dictionary name.
//      */
//     @StringRes
//     int getName();
// 
//     /**
//      * A constant UUID of the dictionary.
//      *
//      * @return a constant UUID
//      */
//     @NonNull
//     String getUUID();
// 
// }


// Path: app/src/main/java/com/ToxicBakery/app/screenshot_redaction/dictionary/impl/DictionaryEnglishNames.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import com.ToxicBakery.app.screenshot_redaction.R;
import com.ToxicBakery.app.screenshot_redaction.bus.CopyBus;
import com.ToxicBakery.app.screenshot_redaction.copy.CopyToSdCard;
import com.ToxicBakery.app.screenshot_redaction.copy.CopyToSdCard.ICopyConfiguration;
import com.ToxicBakery.app.screenshot_redaction.copy.WordListRawResourceCopyConfiguration;
import com.ToxicBakery.app.screenshot_redaction.dictionary.IDictionary;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import java.io.IOException;
import java.util.Locale;
import java.util.Set;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

package com.ToxicBakery.app.screenshot_redaction.dictionary.impl;






public class DictionaryEnglishNames implements IDictionary {

    private static final String TAG = "DictionaryEnglishNames";

    private static DictionaryEnglishNames instance;

    @VisibleForTesting
    final ICopyConfiguration copyConfiguration;

    private final CopyBus copyBus;

    private Set<String> words;

    DictionaryEnglishNames(@NonNull Context context) {
        copyConfiguration = new WordListRawResourceCopyConfiguration(context, R.raw.wordlist_english_names);
        copyBus = CopyBus.getInstance();