@Override
 public int compare(AddressNode an1, AddressNode an2) {
   Address a1 = an1.getAddress();
   Address a2 = an2.getAddress();
   int result = ObjectUtils.compare(a1.getCityName(), a2.getCityName());
   if (result == 0) {
     result = ObjectUtils.compare(a1.getPostcode(), a2.getPostcode());
   }
   ;
   if (result == 0) {
     result = ObjectUtils.compare(a1.getStreetName(), a2.getStreetName());
   }
   ;
   if (result == 0) {
     result = ObjectUtils.compare(a1.getHouseNumber(), a2.getHouseNumber());
   }
   ;
   return result;
 }
Ejemplo n.º 2
0
  /** {@inheritDoc} */
  @Override
  public int compare(E o1, E o2) {
    for (int i = 0; i < this.comparables.size(); i++) {
      final ComparableMapping mapping = this.comparables.get(i);
      final Object v1 = mapping.getMapping().get(o1);
      final Object v2 = mapping.getMapping().get(o2);

      final int result = ObjectUtils.compare((Comparable<?>) v1, (Comparable<?>) v2);
      if (result == 0) {
        continue;
      }
      if (result < 0) {
        if (mapping.isAscending()) {
          return -1;
        } else {
          return 1;
        }
      }
    }

    return 0;
  }
 @Override
 public int compare(String o1, String o2) {
   return ObjectUtils.compare(o1, o2);
 }