Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ private List<Location> parseLocationString(String string, int versus) {
l.setPartialOn3prime(true);
}

if (!(accession == null || "".equals(accession))) l.setAccession(new AccessionID(accession));
if (accession != null && !"".equals(accession)) {
l.setAccession(new AccessionID(accession));
}

boundedLocationsCollection.add(l);

Expand Down
16 changes: 14 additions & 2 deletions biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ public static boolean equal(boolean one, boolean two) {
* @see #classEqual(Object, Object)
*/
public static boolean equal(Object one, Object two) {
return one == null && two == null || !(one == null || two == null) && (one == two || one.equals(two));
if (one == two) {
return true;
}
if (one == null || two == null) {
return false;
}
return one.equals(two);
}

/**
Expand Down Expand Up @@ -84,6 +90,12 @@ public static boolean equal(Object one, Object two) {
* equal at the class level
*/
public static boolean classEqual(Object one, Object two) {
return one == two || !(one == null || two == null) && one.getClass() == two.getClass();
if (one == two) {
return true;
}
if (one == null || two == null) {
return false;
}
return one.getClass() == two.getClass();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static Location fromBio( int start, int end, char strand )
int s= start - 1;
int e= end;

if( !( strand == '-' || strand == '+' || strand == '.' ))
if( strand != '-' && strand != '+' && strand != '.' )
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
Expand Down Expand Up @@ -166,7 +166,7 @@ public static Location fromBioExt( int start, int length, char strand, int total
int s= start;
int e= s + length;

if( !( strand == '-' || strand == '+' || strand == '.' ))
if( strand != '-' && strand != '+' && strand != '.' )
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public boolean equals(Object obj) {
if ((this.surname == null) ? (other.surname != null) : !this.surname.equals(other.surname)) {
return false;
}
return !((this.initials == null) ? (other.initials != null) : !this.initials.equals(other.initials));
return (this.initials == null) ? other.initials == null : this.initials.equals(other.initials);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public boolean isHeavyAtom() {
* @return <CODE>true</CODE> if Element is not Hydrogen and not Carbon.
*/
public boolean isHeteroAtom() {
return !(this == C || this == H);
return this != C && this != H;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str
//afpChain.setTotalRmsdOpt(rmsd);
//System.out.println("rmsd: " + rmsd);

if(!(nAtom<strLen*0.95) && (!isRmsdLenAssigned)) {
if(nAtom >= strLen * 0.95 && !isRmsdLenAssigned) {
rmsdLen=rmsd;
isRmsdLenAssigned=true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str
//afpChain.setTotalRmsdOpt(rmsd);
//System.out.println("rmsd: " + rmsd);

if(!(nAtom<strLen*0.95) && (!isRmsdLenAssigned)) {
if(nAtom >= strLen * 0.95 && !isRmsdLenAssigned) {
rmsdLen=rmsd;
isRmsdLenAssigned=true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static boolean isUnaryExpression(String expression) {
if (first < 0 || last < 0) {
return true;
}
return ! (first == 0 && last > first);
return first != 0 || last <= first;
}

public static List<String> parseUnaryOperatorExpression(String operatorExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static List<SecStrucInfo> getSecStrucInfo(Structure s) {
Group g = iter.next();
if (g.hasAminoAtoms()) {
Object p = g.getProperty(Group.SEC_STRUC);
if (!(p == null)) {
if (p != null) {
SecStrucInfo ss = (SecStrucInfo) p;
listSSI.add(ss);
}
Expand Down