Mercurial > projects > ldc
comparison tango/tango/util/collection/model/Sortable.d @ 132:1700239cab2e trunk
[svn r136] MAJOR UNSTABLE UPDATE!!!
Initial commit after moving to Tango instead of Phobos.
Lots of bugfixes...
This build is not suitable for most things.
author | lindquist |
---|---|
date | Fri, 11 Jan 2008 17:57:40 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /* | |
2 File: Sortable.d | |
3 | |
4 Originally written by Doug Lea and released into the public domain. | |
5 Thanks for the assistance and support of Sun Microsystems Labs, Agorics | |
6 Inc, Loral, and everyone contributing, testing, and using this code. | |
7 | |
8 History: | |
9 Date Who What | |
10 24Sep95 dl@cs.oswego.edu Create from collections.d working file | |
11 | |
12 */ | |
13 | |
14 | |
15 module tango.util.collection.model.Sortable; | |
16 | |
17 private import tango.util.collection.model.Dispenser, | |
18 tango.util.collection.model.Comparator; | |
19 | |
20 | |
21 /** | |
22 * | |
23 * | |
24 * Sortable is a mixin interface for MutableCollections | |
25 * supporting a sort method that accepts | |
26 * a user-supplied Comparator with a compare method that | |
27 * accepts any two Objects and returns -1/0/+1 depending on whether | |
28 * the first is less than, equal to, or greater than the second. | |
29 * <P> | |
30 * After sorting, but in the absence of other mutative operations, | |
31 * Sortable Collections guarantee that enumerations | |
32 * appear in sorted order; that is if a and b are two elements | |
33 * obtained in succession from nextElement(), that | |
34 * <PRE> | |
35 * comparator().compare(a, b) <= 0. | |
36 * </PRE> | |
37 * | |
38 author: Doug Lea | |
39 * @version 0.93 | |
40 * | |
41 * <P> For an introduction to this package see <A HREF="index.html"> Overview </A>. | |
42 **/ | |
43 | |
44 public interface Sortable(T) : Dispenser!(T) | |
45 { | |
46 | |
47 /** | |
48 * Sort the current elements with respect to cmp.compare. | |
49 **/ | |
50 | |
51 public void sort(Comparator!(T) cmp); | |
52 } | |
53 | |
54 |