1 /*******************************************************************************
2 
3         Copyright:
4             Copyright (c) 2008 Kris Bell.
5             Some parts copyright (c) 2009-2016 dunnhumby Germany GmbH.
6             All rights reserved.
7 
8         License:
9             Tango Dual License: 3-Clause BSD License / Academic Free License v3.0.
10             See LICENSE_TANGO.txt for details.
11 
12         Version: Apr 2008: Initial release
13 
14         Authors: Kris
15 
16 *******************************************************************************/
17 
18 module ocean.util.container.model.IContainer;
19 
20 /*******************************************************************************
21 
22         Generic container
23 
24 *******************************************************************************/
25 
26 interface IContainer (V)
27 {
28         size_t size ();
29 
30         bool isEmpty ();
31 
32         IContainer dup ();
33 
34         IContainer clear ();
35 
36         IContainer reset ();
37 
38         IContainer check ();
39 
40         bool contains (V value);
41 
42         bool take (ref V element);
43 
44         V[] toArray (V[] dst = null);
45 
46         size_t remove (V element, bool all);
47 
48         int opApply (scope int delegate(ref V value) dg);
49 
50         size_t replace (V oldElement, V newElement, bool all);
51 }
52 
53 
54 /*******************************************************************************
55 
56         Comparator function
57 
58 *******************************************************************************/
59 
60 template Compare (V)
61 {
62         alias int function (ref V a, ref V b) Compare;
63 }
64