132
|
1 /*
|
|
2 File: Set.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 22Oct95 dl add addElements
|
|
12
|
|
13 */
|
|
14
|
|
15
|
|
16 module tango.util.collection.model.Set;
|
|
17
|
|
18 private import tango.util.collection.model.SetView,
|
|
19 tango.util.collection.model.Iterator,
|
|
20 tango.util.collection.model.Dispenser;
|
|
21
|
|
22
|
|
23 /**
|
|
24 *
|
|
25 * MutableSets support an include operations to add
|
|
26 * an element only if it not present.
|
|
27 *
|
|
28 author: Doug Lea
|
|
29 * @version 0.93
|
|
30 *
|
|
31 * <P> For an introduction to this package see <A HREF="index.html"> Overview </A>.
|
|
32 *
|
|
33 **/
|
|
34
|
|
35 public interface Set(T) : SetView!(T), Dispenser!(T)
|
|
36 {
|
|
37 /**
|
|
38 * Include the indicated element in the collection.
|
|
39 * No effect if the element is already present.
|
|
40 * @param element the element to add
|
|
41 * Returns: condition:
|
|
42 * <PRE>
|
|
43 * has(element) &&
|
|
44 * no spurious effects &&
|
|
45 * Version change iff !PREV(this).has(element)
|
|
46 * </PRE>
|
|
47 * Throws: IllegalElementException if !canInclude(element)
|
|
48 **/
|
|
49
|
|
50 public void add (T element);
|
|
51
|
|
52
|
|
53 /**
|
|
54 * Include all elements of the enumeration in the collection.
|
|
55 * Behaviorally equivalent to
|
|
56 * <PRE>
|
|
57 * while (e.more()) include(e.get());
|
|
58 * </PRE>
|
|
59 * @param e the elements to include
|
|
60 * Throws: IllegalElementException if !canInclude(element)
|
|
61 * Throws: CorruptedIteratorException propagated if thrown
|
|
62 **/
|
|
63
|
|
64 public void add (Iterator!(T) e);
|
|
65 public alias add opCatAssign;
|
|
66 }
|
|
67
|