Skip to content
Browse files

Simplified atom placer comparator (which actually isn't used) to use …

…the boxed Interger comparator. The weight value is already boxed allowing us to easily compare the values.
  • Loading branch information...
1 parent c1b2ac6 commit f23c69cb0bbfff025b8195f76a670d37281f4b3b @johnmay committed
Showing with 4 additions and 11 deletions.
  1. +4 −11 src/main/org/openscience/cdk/layout/AtomPlacer.java
View
15 src/main/org/openscience/cdk/layout/AtomPlacer.java
@@ -78,19 +78,12 @@
{
public int compare(IAtom a, IAtom b)
{
- int aWeight = getWeight(a);
- int bWeight = getWeight(b);
- if(aWeight > bWeight)
- return +1;
- if(aWeight < bWeight)
- return -1;
- return 0;
+ return weight(a).compareTo(weight(b));
}
- private int getWeight(IAtom atom){
- if(atom.getProperty("Weight") == null)
- return Integer.MIN_VALUE;
- return (Integer) atom.getProperty("Weight");
+ private Integer weight(IAtom atom){
+ Integer weight = atom.getProperty("Weight");
+ return weight != null ? weight : Integer.MIN_VALUE;
}
};

0 comments on commit f23c69c

Please sign in to comment.
Something went wrong with that request. Please try again.