01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: DxAbstractSet.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
08:
09: package org.ozoneDB.DxLib;
10:
11: /**
12: *
13: *
14: * @author <a href="http://www.softwarebuero.de/">SMB</a>
15: * @version $Revision: 1.1 $Date: 2001/12/18 10:31:30 $
16: */
17: public abstract class DxAbstractSet extends DxAbstractCollection
18: implements DxSet {
19:
20: final static long serialVersionUID = 1L;
21:
22: /** */
23: public boolean equals(Object obj) {
24: if (obj instanceof DxSet && obj != null) {
25: DxSet rhs = (DxSet) obj;
26:
27: if (this == obj) {
28: return true;
29: }
30:
31: if (count() != rhs.count()) {
32: return false;
33: }
34:
35: return containsAll(rhs);
36: } else {
37: return false;
38: }
39: }
40:
41: /**
42: */
43: public synchronized boolean retainAll(DxCollection coll) {
44: boolean answer = false;
45: DxIterator it = iterator();
46: Object obj;
47: while ((obj = it.next()) != null) {
48: if (!coll.contains(obj)) {
49: it.removeObject();
50: answer = true;
51: }
52: }
53: return answer;
54: }
55:
56: }
|