< prev index next >

src/demo/share/jfc/TableExample/TableSorter.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * --- 1,7 ---- /* ! * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *
*** 69,79 **** * @author Philip Milne */ @SuppressWarnings("serial") public final class TableSorter extends TableMap { ! int indexes[]; List<Integer> sortingColumns = new ArrayList<Integer>(); boolean ascending = true; int compares; public TableSorter() { --- 69,79 ---- * @author Philip Milne */ @SuppressWarnings("serial") public final class TableSorter extends TableMap { ! int[] indexes; List<Integer> sortingColumns = new ArrayList<Integer>(); boolean ascending = true; int compares; public TableSorter() {
*** 247,257 **** // requires twice the space of an in-place algorithm and makes // NlogN assigments shuttling the values between the two // arrays. The number of compares appears to vary between N-1 and // NlogN depending on the initial order but the main reason for // using it here is that, unlike qsort, it is stable. ! public void shuttlesort(int from[], int to[], int low, int high) { if (high - low < 2) { return; } int middle = (low + high) / 2; shuttlesort(to, from, low, middle); --- 247,257 ---- // requires twice the space of an in-place algorithm and makes // NlogN assigments shuttling the values between the two // arrays. The number of compares appears to vary between N-1 and // NlogN depending on the initial order but the main reason for // using it here is that, unlike qsort, it is stable. ! public void shuttlesort(int[] from, int[] to, int low, int high) { if (high - low < 2) { return; } int middle = (low + high) / 2; shuttlesort(to, from, low, middle);
< prev index next >