| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.expr.sort; |
| 9 | |
| 10 | |
| 11 | /** |
| 12 | * A Sortable is an object that can be sorted using the QuickSort method. |
| 13 | * |
| 14 | * @author Michael H. Kay |
| 15 | */ |
| 16 | |
| 17 | public interface Sortable { |
| 18 | |
| 19 | /** |
| 20 | * Compare two objects within this Sortable, identified by their position. |
| 21 | * |
| 22 | * @return <0 if obj[a]<obj[b], 0 if obj[a]=obj[b], >0 if obj[a]>obj[b] |
| 23 | */ |
| 24 | |
| 25 | public int compare(int a, int b); |
| 26 | |
| 27 | /** |
| 28 | * Swap two objects within this Sortable, identified by their position. |
| 29 | */ |
| 30 | |
| 31 | public void swap(int a, int b); |
| 32 | |
| 33 | } |
| 34 |