1 /*
2 * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef _SET_
26 #define _SET_
27 // Sets - An Abstract Data Type
28
29 // Should not manually include these in AVM framework. %%%%% - Ungar
30 // #ifndef _PORT_
31 // #include "port.hpp"
32 // #endif // _PORT_
33 //INTERFACE
34
35 class SparseSet;
36 class VectorSet;
37 class ListSet;
38 class CoSet;
39
40 class ostream;
41 class SetI_;
42
43 // These sets can grow or shrink, based on the initial size and the largest
44 // element currently in them. Basically, they allow a bunch of bits to be
232 friend class SetI;
233 virtual ~SetI_();
234 virtual uint next(void)=0;
235 virtual int test(void)=0;
236 };
237
238 class SetI {
239 protected:
240 SetI_ *impl;
241 public:
242 uint elem; // The publically accessible element
243
244 SetI( const Set *s ) { impl = s->iterate(elem); }
245 ~SetI() { delete impl; }
246 void reset( const Set *s ) { delete impl; impl = s->iterate(elem); }
247 void operator ++(void) { elem = impl->next(); }
248 int test(void) { return impl->test(); }
249 };
250
251 #endif // _SET_
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_LIBADT_SET_HPP
26 #define SHARE_VM_LIBADT_SET_HPP
27
28 #include "libadt/port.hpp"
29 #include "memory/allocation.hpp"
30
31 #ifndef _SET_
32 #define _SET_
33 // Sets - An Abstract Data Type
34
35 // Should not manually include these in AVM framework. %%%%% - Ungar
36 // #ifndef _PORT_
37 // #include "port.hpp"
38 // #endif // _PORT_
39 //INTERFACE
40
41 class SparseSet;
42 class VectorSet;
43 class ListSet;
44 class CoSet;
45
46 class ostream;
47 class SetI_;
48
49 // These sets can grow or shrink, based on the initial size and the largest
50 // element currently in them. Basically, they allow a bunch of bits to be
238 friend class SetI;
239 virtual ~SetI_();
240 virtual uint next(void)=0;
241 virtual int test(void)=0;
242 };
243
244 class SetI {
245 protected:
246 SetI_ *impl;
247 public:
248 uint elem; // The publically accessible element
249
250 SetI( const Set *s ) { impl = s->iterate(elem); }
251 ~SetI() { delete impl; }
252 void reset( const Set *s ) { delete impl; impl = s->iterate(elem); }
253 void operator ++(void) { elem = impl->next(); }
254 int test(void) { return impl->test(); }
255 };
256
257 #endif // _SET_
258
259 #endif // SHARE_VM_LIBADT_SET_HPP
|