
package org.pharmgkb.pharmcat.haplotype.model;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.base.Preconditions;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;


public class Variant implements Comparable<Variant>  {
  @Expose
  @SerializedName("position")
  private int m_position;
  @Expose
  @SerializedName("rsid")
  private String m_rsid;
  @Expose
  @SerializedName("vcfCall")
  private String m_vcfCall;
  private int m_vcfPosition;
  private String m_vcfAlleles;


  public Variant(int pos, @Nullable String rsids, @Nonnull String call, int vcfPosition, @Nonnull String vcfAlleles) {
    Preconditions.checkNotNull(call);
    m_position = pos;
    m_rsid = rsids;
    m_vcfCall = call;
    m_vcfPosition = vcfPosition;
    m_vcfAlleles = vcfAlleles;
  }


  public int getPosition() {
    return m_position;
  }

  public String getRsid() {
    return m_rsid;
  }

  public String getVcfCall() {
    return m_vcfCall;
  }

  public int getVcfPosition() {
    return m_vcfPosition;
  }

  public String getVcfAlleles() {
    return m_vcfAlleles;
  }

  @Override
  public int compareTo(@Nonnull Variant o) {

    int rez = Integer.compare(m_position, o.getPosition());
    if (rez != 0) {
      return rez;
    }
    rez = Integer.compare(m_vcfPosition, o.getVcfPosition());
    if (rez != 0) {
      return rez;
    }
    return m_vcfCall.compareTo(o.getVcfCall());
  }
}

@@ -305,16 +305,129 @@
 ant%3E  %7B%0A
+  private static final String sf_rsidFormat = %22%25s%25s%22;%0A  private static final String sf_positionFormat = %22%25d%25s%22;%0A%0A
   @Expos
@@ -1578,11 +1578,288 @@
 ());%0A  %7D
+%0A%0A  public String toString() %7B%0A    if (m_rsid != null) %7B%0A      return String.format(sf_rsidFormat, getRsid(), getVcfCall().replaceAll(%22%5B%7C%5C%5C/%5D%22, %22%22));%0A    %7D%0A    else %7B%0A      return String.format(sf_positionFormat, getPosition(), getVcfCall().replaceAll(%22%5B%7C%5C%5C/%5D%22, %22%22));%0A    %7D%0A  %7D
 %0A%7D%0A

Add a toString to Variant