View Javadoc

1   package com.atlassian.plugin.web.descriptors;
2   
3   import java.util.Comparator;
4   
5   /**
6    * A simple comparator for any weighted descriptor - lowest weights first.
7    */
8   public class WeightedDescriptorComparator implements Comparator<WeightedDescriptor>
9   {
10      public int compare(WeightedDescriptor w1, WeightedDescriptor w2)
11      {
12          if (w1.getWeight() < w2.getWeight())
13              return -1;
14          else if (w1.getWeight() > w2.getWeight())
15              return 1;
16          else
17              return 0;
18      }
19  }