132
|
1 /*
|
|
2 File: BagView.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.BagView;
|
|
16
|
|
17 private import tango.util.collection.model.View;
|
|
18
|
|
19
|
|
20 /**
|
|
21 *
|
|
22 * Bags are collections supporting multiple occurrences of elements.
|
|
23 *
|
|
24 author: Doug Lea
|
|
25 * @version 0.93
|
|
26 *
|
|
27 * <P> For an introduction to this package see <A HREF="index.html"> Overview </A>.
|
|
28 *
|
|
29 **/
|
|
30
|
|
31 public interface BagView(V) : View!(V)
|
|
32 {
|
|
33 version (VERBOSE)
|
|
34 {
|
|
35 public alias adding opCat;
|
|
36
|
|
37 /**
|
|
38 * Construct a new Bag that is a clone of self except
|
|
39 * that it includes indicated element. This can be used
|
|
40 * to create a series of Bag, each differing from the
|
|
41 * other only in that they contain additional elements.
|
|
42 *
|
|
43 * @param the element to add to the new Bag
|
|
44 * Returns: the new Bag c, with the matches as this except that
|
|
45 * c.occurrencesOf(element) == occurrencesOf(element)+1
|
|
46 * Throws: IllegalElementException if !canInclude(element)
|
|
47 **/
|
|
48
|
|
49 public Bag adding(V element);
|
|
50
|
|
51 /**
|
|
52 * Construct a new Collection that is a clone of self except
|
|
53 * that it adds the indicated element if not already present. This can be used
|
|
54 * to create a series of collections, each differing from the
|
|
55 * other only in that they contain additional elements.
|
|
56 *
|
|
57 * @param element the element to include in the new collection
|
|
58 * Returns: a new collection c, with the matches as this, except that
|
|
59 * c.occurrencesOf(element) = min(1, occurrencesOfElement)
|
|
60 * Throws: IllegalElementException if !canInclude(element)
|
|
61 **/
|
|
62
|
|
63 public Bag addingIfAbsent(V element);
|
|
64 } // version
|
|
65
|
|
66 }
|