コード例 #1
0
ファイル: Sorter.java プロジェクト: enenuki/phd
 /* 22:   */
 /* 23:   */ public void apply(Object object) /* 24:   */ {
   /* 25:37 */ if ((object instanceof Sortable))
   /* 26:   */ {
     /* 27:38 */ Sortable sortable = (Sortable) object;
     /* 28:39 */ sortable.sort(this);
     /* 29:   */ }
   /* 30:   */ }
コード例 #2
0
  public static void main(String[] args) {
    Sortable sortable = new BubbleSort();
    int[] input = {2, 0, 0, 2, 1, 4, 7, 0, 0, 4};

    System.out.println("\nBefore Sort : ");
    SortUtil.display(input);

    sortable.sort(input);

    System.out.println("\nAfter Sort : ");
    SortUtil.display(input);
  }
コード例 #3
0
ファイル: SortableTestBase.java プロジェクト: mbernson/iiad
  @Test
  public void testSort() throws Exception {
    Integer[] arr = new Integer[] {5, 2, 3, 1, 0, 4};

    Integer[] sorted = sortable.sort(arr);

    assertNotNull(sorted);
    assertEquals(arr.length, sorted.length);
    assertArrayEquals(sorted, new Integer[] {0, 1, 2, 3, 4, 5});

    assertSame(sorted[0], Integer.valueOf(0));
    assertSame(sorted[5], Integer.valueOf(5));
  }
コード例 #4
0
ファイル: Sorter.java プロジェクト: shahidminhas/abc
 /**
  * Sorts the test in <code>runner</code> using <code>comparator</code>
  *
  * @param object
  */
 public void apply(Object object) {
   if (object instanceof Sortable) {
     Sortable sortable = (Sortable) object;
     sortable.sort(this);
   }
 }
コード例 #5
0
 @Override
 public void sort(int[] inputArray) {
   super.sort(inputArray);
   insertionSort();
 }