/////// Sortable.java /////// /* public interface name extends interface1, Interface2, ... { // all methods should be declared public (and abstract by dafault) // all vars should be declared public, static and final } */ public interface Sortable {/** compares elements i and j and * for element_i >, ==, < element_j returns * > 0, 0, < 0 if direction is INCREASING * < 0, 0, > 0 if direction is DECREASING */ int compare(int i, int j); /** swaps elements i and j */ void swap(int i, int j); /** first element index */ int first(); /** last element index */ int last(); /** get/set sort flag */ boolean sorted(); void sorted(boolean b); /** get/set sort direction flag to INCREASING or DECREASING */ void direction(int dir); int direction(); /** possible direction flag values */ static final int INCREASING = 1; static final int DECREASING = -1; }