/*
 * Copyright 2015 Google.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.cloud.genomics.dataflow.model;

import com.google.cloud.dataflow.sdk.coders.DefaultCoder;
import com.google.cloud.dataflow.sdk.coders.AvroCoder;
import java.util.List;
import java.util.Objects;

/**
 * Contains frequency for a set of alleles for a single position on a single chromosome.
 * Used in VerifyBamId.
 */
@DefaultCoder(AvroCoder.class)
public class AlleleFreq {
  // Strings of length 1 of one of the following bases: ['A', 'C', 'T', 'G'].
  private String refBases;
  // List of length 1 of a String of length 1 of one of the following bases: ['A', 'C', 'T', 'G'].
  private List<String> altBases;
  // Frequency for a set of alleles for the given position on the given chromosome
  // in the range [0,1].
  private double refFreq;

  public String getRefBases() {
    return refBases;
  }

  public void setRefBases(String refBases) {
    this.refBases = refBases;
  }

  public List<String> getAltBases() {
    return altBases;
  }

  public void setAltBases(List<String> altBases) {
    this.altBases = altBases;
  }

  public double getRefFreq() {
    return refFreq;
  }

  public void setRefFreq(double refFreq) {
    this.refFreq = refFreq;
  }
	
	@Override
	public int hashCode() {
		return Objects.hash(refBases, altBases, refFreq);
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof AlleleFreq)) {
			return false;
		}
		AlleleFreq otherAlleleFreq = (AlleleFreq) o;
		return Objects.equals(refBases, otherAlleleFreq.getRefBases())
			&& (refFreq == otherAlleleFreq.getRefFreq())
			&& altBases.containsAll(otherAlleleFreq.getAltBases());
	}

  /* (non-Javadoc)
   * @see java.lang.Object#toString()
   */
  @Override
  public String toString() {
    return "AlleleFreq [refBases=" + refBases + ", altBases=" + altBases + ", refFreq=" + refFreq
        + "]";
  }
}

@@ -1770,17 +1770,18 @@
 ;%0A  %7D%0A%09%0A
-%09
+  
 @Overrid
@@ -1778,25 +1778,26 @@
   @Override%0A
-%09
+  
 public int h
@@ -1808,18 +1808,20 @@
 ode() %7B%0A
-%09%09
+    
 return O
@@ -1866,13 +1866,15 @@
 q);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Ove
@@ -1879,17 +1879,18 @@
 verride%0A
-%09
+  
 public b
@@ -1915,18 +1915,20 @@
 ct o) %7B%0A
-%09%09
+    
 if (!(o 
@@ -1953,19 +1953,22 @@
 req)) %7B%0A
-%09%09%09
+      
 return f
@@ -1977,14 +1977,18 @@
 se;%0A
-%09%09%7D%0A%09%09
+    %7D%0A    
 Alle
@@ -2028,18 +2028,20 @@
 req) o;%0A
-%09%09
+    
 return O
@@ -2095,19 +2095,22 @@
 ases())%0A
-%09%09%09
+      
 && (refF
@@ -2150,11 +2150,14 @@
 ())%0A
-%09%09%09
+      
 && a
@@ -2208,17 +2208,18 @@
 ses());%0A
-%09
+  
 %7D%0A%0A  /* 

Update AlleleFreq.java