Skip to content

Commit

Permalink
Minor improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Jun 5, 2017
1 parent 840dfd4 commit 1096e83
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main/java/proteomics/Types/AA.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ public class AA {

public final char aa;
public final float delta_mass;
private final String toString;
private final int hashCode;

public AA(char aa, float delta_mass) {
this.aa = aa;
this.delta_mass = delta_mass;
}

public String toString() {
if (Math.abs(delta_mass) > 1e-6) {
return String.format("%c[%.2f]", aa, delta_mass);
toString = String.format("%c[%.2f]", aa, delta_mass);
} else {
return String.valueOf(aa);
toString = String.valueOf(aa);
}
hashCode = toString.hashCode();
}

public String toString() {
return toString;
}

public int hashCode() {
return hashCode;
}

public boolean equals(Object other) {
Expand Down

0 comments on commit 1096e83

Please sign in to comment.