/*
 * The Exomiser - A tool to annotate and prioritize genomic variants
 *
 * Copyright (c) 2016-2019 Queen Mary University of London.
 * Copyright (c) 2012-2016 Charité Universitätsmedizin Berlin and Genome Research Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.monarchinitiative.exomiser.core.genome.dao;

import com.google.common.collect.ImmutableSet;
import org.monarchinitiative.exomiser.core.model.AlleleProtoAdaptor;
import org.monarchinitiative.exomiser.core.model.Variant;
import org.monarchinitiative.exomiser.core.proto.AlleleProto;

import java.util.Objects;
import java.util.Set;

/**
 * @author Jules Jacobsen <j.jacobsen@qmul.ac.uk>
 */
public class InMemoryVariantWhiteList implements VariantWhiteList {

    private static final VariantWhiteList EMPTY = new EmptyVariantWhiteList();

    private final Set<AlleleProto.AlleleKey> whiteList;


    public static VariantWhiteList empty() {
        return EMPTY;
    }

    public static VariantWhiteList of(Set<AlleleProto.AlleleKey> whiteList) {
        Objects.requireNonNull(whiteList);

        if (whiteList.isEmpty()) {
            return EMPTY;
        }
        return new InMemoryVariantWhiteList(whiteList);
    }

    private InMemoryVariantWhiteList(Set<AlleleProto.AlleleKey> whiteList) {
        this.whiteList = ImmutableSet.copyOf(whiteList);
    }

    @Override
    public boolean contains(Variant variant) {
        AlleleProto.AlleleKey alleleKey = AlleleProtoAdaptor.toAlleleKey(variant);
        return whiteList.contains(alleleKey);
    }

    @Override
    public String toString() {
        return "InMemoryVariantWhiteList{" +
                "whiteList=" + whiteList +
                '}';
    }

    private static class EmptyVariantWhiteList implements VariantWhiteList {

        @Override
        public boolean contains(Variant variant) {
            return false;
        }
    }

}

@@ -951,55 +951,8 @@
 o;%0A%0A
-import com.google.common.collect.ImmutableSet;%0A
 impo
@@ -1133,24 +1133,50 @@
 leleProto;%0A%0A
+import java.util.HashSet;%0A
 import java.
@@ -1913,27 +1913,21 @@
 t = 
-ImmutableSet.copyOf
+new HashSet%3C%3E
 (whi

Update InMemoryVariantWhiteList internals to use HashMap