KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > odmg > OzoneODMGDSet


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: OzoneODMGDSet.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
8

9 package org.ozoneDB.odmg;
10
11 import org.odmg.*;
12 //import org.ozoneDB.*;
13
import java.util.*;
14
15
16 /**
17  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
18  * @version $Revision: 1.1 $Date: 2001/12/18 10:31:31 $
19  */

20 public class OzoneODMGDSet extends HashSet implements DSet {
21     
22     
23     public OzoneODMGDSet() {
24         super();
25     }
26     
27     
28     public OzoneODMGDSet( Collection _collection ) {
29         super( _collection );
30     }
31     
32     
33     /**
34      * Create a new <code>DSet</code> object that is the set union of this
35      * <code>DSet</code> object and the set referenced by <code>otherSet</code>.
36      * @param otherSet The other set to be used in the union operation.
37      * @return A newly created <code>DSet</code> instance that contains the union of the two sets.
38      */

39     public DSet union( DSet otherSet ) {
40         DSet result = new OzoneODMGDSet( this );
41         result.addAll( otherSet );
42         return result;
43     }
44     
45     
46     /**
47      * Create a new <code>DSet</code> object that is the set intersection of this
48      * <code>DSet</code> object and the set referenced by <code>otherSet</code>.
49      * @param otherSet The other set to be used in the intersection operation.
50      * @return A newly created <code>DSet</code> instance that contains the
51      * intersection of the two sets.
52      */

53     public DSet intersection( DSet otherSet ) {
54         DSet result = new OzoneODMGDSet( this );
55         result.retainAll( otherSet );
56         return result;
57     }
58     
59     
60     /**
61      * Create a new <code>DSet</code> object that contains the elements of this
62      * collection minus the elements in <code>otherSet</code>.
63      * @param otherSet A set containing elements that should not be in the result set.
64      * @return A newly created <code>DSet</code> instance that contains the elements
65      * of this set minus those elements in <code>otherSet</code>.
66      */

67     public DSet difference( DSet otherSet ) {
68         DSet result = new OzoneODMGDSet( this );
69         result.removeAll( otherSet );
70         return result;
71     }
72     
73     
74     /**
75      * Determine whether this set is a subset of the set referenced by <code>otherSet</code>.
76      * @param otherSet Another set.
77      * @return True if this set is a subset of the set referenced by <code>otherSet</code>,
78      * otherwise false.
79      */

80     public boolean subsetOf( DSet otherSet ) {
81         return otherSet.containsAll( this );
82     }
83     
84     
85     /**
86      * Determine whether this set is a proper subset of the set referenced by
87      * <code>otherSet</code>.
88      * @param otherSet Another set.
89      * @return True if this set is a proper subset of the set referenced by
90      * <code>otherSet</code>, otherwise false.
91      */

92     public boolean properSubsetOf( DSet otherSet ) {
93         // because of Sets never have duplicate members this is true
94
return this.size() == otherSet.size() && subsetOf( otherSet );
95     }
96     
97     
98     /**
99      * Determine whether this set is a superset of the set referenced by <code>otherSet</code>.
100      * @param otherSet Another set.
101      * @return True if this set is a superset of the set referenced by <code>otherSet</code>,
102      * otherwise false.
103      */

104     public boolean supersetOf( DSet otherSet ) {
105         return this.containsAll( otherSet );
106     }
107     
108     
109     /**
110      * Determine whether this set is a proper superset of the set referenced by
111      * <code>otherSet</code>.
112      * @param otherSet Another set.
113      * @return True if this set is a proper superset of the set referenced by
114      * <code>otherSet</code>, otherwise false.
115      */

116     public boolean properSupersetOf( DSet otherSet ) {
117         // because of Sets never have duplicate members this is true
118
return this.size() == otherSet.size() && supersetOf( otherSet );
119     }
120     
121     
122     /**
123      * NOT SUPPORTED!
124      */

125     public Object JavaDoc selectElement( String JavaDoc predicate ) throws QueryInvalidException {
126         throw new NotImplementedException( "OQL not supported" );
127     }
128     
129     
130     /**
131      * NOT SUPPORTED!
132      */

133     public java.util.Iterator JavaDoc select( String JavaDoc predicate ) throws QueryInvalidException {
134         throw new NotImplementedException( "OQL not supported" );
135     }
136     
137     
138     /**
139      * NOT SUPPORTED!
140      */

141     public DCollection query( String JavaDoc predicate ) throws QueryInvalidException {
142         throw new NotImplementedException( "OQL not supported" );
143     }
144     
145     
146     /**
147      * NOT SUPPORTED!
148      */

149     public boolean existsElement( String JavaDoc predicate ) throws QueryInvalidException {
150         throw new NotImplementedException( "OQL not supported" );
151     }
152     
153 }
154
Popular Tags