//# 0 errors, 18 messages
//#
package net.sourceforge.pebble.comparator;
    //#reverseresponseidcomparator.java:1:1: class: net.sourceforge.pebble.comparator.ReverseResponseIdComparator
    //#reverseresponseidcomparator.java:1:1: method: net.sourceforge.pebble.comparator.ReverseResponseIdComparator.net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init

import java.util.Comparator;

/**
 * A comparator used to order response ids, in reverse order.
 *
 * @author    Simon Brown
 */
public class ReverseResponseIdComparator implements Comparator {
    //#reverseresponseidcomparator.java:10: method: void net.sourceforge.pebble.comparator.ReverseResponseIdComparator.net.sourceforge.pebble.comparator.ReverseResponseIdComparator()
    //#reverseresponseidcomparator.java:10: end of method: void net.sourceforge.pebble.comparator.ReverseResponseIdComparator.net.sourceforge.pebble.comparator.ReverseResponseIdComparator()

  /**
   * Compares two objects.
   *
   * @param o1  object 1
   * @param o2  object 2
   * @return  -n, 0 or +n if the date represented by the second blog entry is less than,
   *          the same as or greater than the first, respectively
   */
  public int compare(Object o1, Object o2) {
    String responseId1 = (String)o1;
    //#reverseresponseidcomparator.java:21: method: int net.sourceforge.pebble.comparator.ReverseResponseIdComparator.compare(Object, Object)
    //#input(int compare(Object, Object)): o1
    //#input(int compare(Object, Object)): o2
    //#output(int compare(Object, Object)): return_value
    //#pre[1] (int compare(Object, Object)): o1 != null
    //#pre[2] (int compare(Object, Object)): o2 != null
    //#post(int compare(Object, Object)): init'ed(return_value)
    String responseId2 = (String)o2;

    int start = responseId1.lastIndexOf("/");
    return responseId2.substring(start).compareTo(responseId1.substring(start));
    //#reverseresponseidcomparator.java:25: end of method: int net.sourceforge.pebble.comparator.ReverseResponseIdComparator.compare(Object, Object)
  }

}
    //#output(net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init): __Descendant_Table[net/sourceforge/pebble/comparator/ReverseResponseIdComparator]
    //#output(net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init): __Dispatch_Table.compare(Ljava/lang/Object;Ljava/lang/Object;)I
    //#post(net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init): __Descendant_Table[net/sourceforge/pebble/comparator/ReverseResponseIdComparator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init): __Dispatch_Table.compare(Ljava/lang/Object;Ljava/lang/Object;)I == &compare
    //#reverseresponseidcomparator.java:: end of method: net.sourceforge.pebble.comparator.ReverseResponseIdComparator.net.sourceforge.pebble.comparator.ReverseResponseIdComparator__static_init
    //#reverseresponseidcomparator.java:: end of class: net.sourceforge.pebble.comparator.ReverseResponseIdComparator
