01: package org.odmg;
02:
03: /**
04: * This interface defines the operations associated with an ODMG bag collection.
05: * All of the operations defined by the JavaSoft <code>Collection</code>
06: * interface are supported by an ODMG implementation of <code>DBag</code>,
07: * the exception <code>UnsupportedOperationException</code> is not thrown when a
08: * call is made to any of the <code>Collection</code> methods.
09: * @author David Jordan (as Java Editor of the Object Data Management Group)
10: * @version ODMG 3.0
11: */
12: // * @see java.lang.UnsupportedOperationException
13: public interface DBag extends DCollection {
14: /**
15: * A new <code>DBag</code> instance is created that is the union of this object
16: * and <code>otherBag</code>.
17: * This method is similar to the <code>addAll</code> method in <code>Collection</code>,
18: * except that this method creates a new collection and <code>addAll</code>
19: * modifies the object to contain the result.
20: * @param otherBag The other bag to use in the union operation.
21: * @return A <code>DBag</code> instance that contains the union of this object
22: * and <code>otherBag</code>.
23: */
24: // * @see com.sun.java.util.collections.Collection#addAll
25: public DBag union(DBag otherBag);
26:
27: /**
28: * A new <code>DBag</code> instance is created that contains the intersection of
29: * this object and the <code>DBag</code> referenced by <code>otherBag</code>.
30: * This method is similar to the <code>retainAll</code> method in <code>Collection</code>,
31: * except that this method creates a new collection and <code>retainAll</code>
32: * modifies the object to contain the result.
33: * @param otherBag The other bag to use in creating the intersection.
34: * @return A <code>DBag</code> instance that contains the intersection of this
35: * object and <code>otherBag</code>.
36: */
37: // @see com.sun.java.util.collections.Collection#retainAll
38: public DBag intersection(DBag otherBag);
39:
40: /**
41: * A new <code>DBag</code> instance is created that contains the difference of
42: * this object and the <code>DBag</code> instance referenced by <code>otherBag</code>.
43: * This method is similar to the <code>removeAll</code> method in <code>Collection</code>,
44: * except that this method creates a new collection and <code>removeAll</code>
45: * modifies the object to contain the result.
46: * @param otherBag The other bag to use in creating the difference.
47: * @return A <code>DBag</code> instance that contains the elements of this object
48: * minus the elements in <code>otherBag</code>.
49: */
50: // * @see com.sun.java.util.collections.Collection#removeAll
51: public DBag difference(DBag otherBag);
52:
53: /**
54: * This method returns the number of occurrences of the object <code>obj</code>
55: * in the <code>DBag</code> collection.
56: * @param obj The value that may have elements in the collection.
57: * @return The number of occurrences of <code>obj</code> in this collection.
58: */
59: public int occurrences(Object obj);
60: }
|