Skip to content

Instantly share code, notes, and snippets.

@haluk
Created September 10, 2014 15:43
Show Gist options
  • Save haluk/bfc124e4b29deea1c499 to your computer and use it in GitHub Desktop.
Save haluk/bfc124e4b29deea1c499 to your computer and use it in GitHub Desktop.
package biotools.ro1;
/**
* Created by hd on 9/9/14.
*/
public class Gene {
private String geneA;
private String geneB;
public Gene(String geneA, String geneB) {
this.geneA = geneA;
this.geneB = geneB;
}
public Gene(String relation) {
String[] pair = relation.split("\\t");
this.geneA = pair[0];
this.geneB = pair[1];
}
public String getGeneA() {
return geneA;
}
public void setGeneA(String geneA) {
this.geneA = geneA;
}
public String getGeneB() {
return geneB;
}
public void setGeneB(String geneB) {
this.geneB = geneB;
}
@Override
public String toString() {
return "Gene{" +
"geneA='" + geneA + '\'' +
", geneB='" + geneB + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
Gene gene = (Gene) o;
if (this.geneA.equals(gene.geneA) && this.geneB.equals(gene.geneB)
|| this.geneA.equals(gene.geneB) && this.geneB.equals(gene.geneA))
return true;
else
return false;
}
@Override
public int hashCode() {
int result = geneA != null ? geneA.hashCode() : 0;
result = 31 * result + (geneB != null ? geneB.hashCode() : 0);
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment