KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > odmg > DBag


1 package org.odmg;
2
3
4
5 /**
6
7  * This interface defines the operations associated with an ODMG bag collection.
8
9  * All of the operations defined by the JavaSoft <code>Collection</code>
10
11  * interface are supported by an ODMG implementation of <code>DBag</code>,
12
13  * the exception <code>UnsupportedOperationException</code> is not thrown when a
14
15  * call is made to any of the <code>Collection</code> methods.
16
17  * @author David Jordan (as Java Editor of the Object Data Management Group)
18
19  * @version ODMG 3.0
20
21  */

22
23 // * @see java.lang.UnsupportedOperationException
24

25
26
27 public interface DBag extends DCollection
28
29 {
30
31     /**
32
33      * A new <code>DBag</code> instance is created that is the union of this object
34
35      * and <code>otherBag</code>.
36
37      * This method is similar to the <code>addAll</code> method in <code>Collection</code>,
38
39      * except that this method creates a new collection and <code>addAll</code>
40
41      * modifies the object to contain the result.
42
43      * @param otherBag The other bag to use in the union operation.
44
45      * @return A <code>DBag</code> instance that contains the union of this object
46
47      * and <code>otherBag</code>.
48
49      */

50
51 // * @see com.sun.java.util.collections.Collection#addAll
52

53     public DBag union(DBag otherBag);
54
55
56
57     /**
58
59      * A new <code>DBag</code> instance is created that contains the intersection of
60
61      * this object and the <code>DBag</code> referenced by <code>otherBag</code>.
62
63      * This method is similar to the <code>retainAll</code> method in <code>Collection</code>,
64
65      * except that this method creates a new collection and <code>retainAll</code>
66
67      * modifies the object to contain the result.
68
69      * @param otherBag The other bag to use in creating the intersection.
70
71      * @return A <code>DBag</code> instance that contains the intersection of this
72
73      * object and <code>otherBag</code>.
74
75      */

76
77 // @see com.sun.java.util.collections.Collection#retainAll
78

79     public DBag intersection(DBag otherBag);
80
81
82
83     /**
84
85      * A new <code>DBag</code> instance is created that contains the difference of
86
87      * this object and the <code>DBag</code> instance referenced by <code>otherBag</code>.
88
89      * This method is similar to the <code>removeAll</code> method in <code>Collection</code>,
90
91      * except that this method creates a new collection and <code>removeAll</code>
92
93      * modifies the object to contain the result.
94
95      * @param otherBag The other bag to use in creating the difference.
96
97      * @return A <code>DBag</code> instance that contains the elements of this object
98
99      * minus the elements in <code>otherBag</code>.
100
101      */

102
103 // * @see com.sun.java.util.collections.Collection#removeAll
104

105     public DBag difference(DBag otherBag);
106
107
108
109     /**
110
111      * This method returns the number of occurrences of the object <code>obj</code>
112
113      * in the <code>DBag</code> collection.
114
115      * @param obj The value that may have elements in the collection.
116
117      * @return The number of occurrences of <code>obj</code> in this collection.
118
119      */

120
121     public int occurrences(Object JavaDoc obj);
122
123 }
124
125
Popular Tags