KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > collections > _BaseTreeMap_values


1 /*
2  * _BaseTreeMap_values.java
3  * $Id: _BaseTreeMap_values.java,v 1.6 2003/11/20 23:18:41 per_nyfelt Exp $
4  * This file is based on TreeMap.java from GNU Classpath. Quote:
5
6 TreeMap.java -- a class providing a basic Red-Black Tree data structure,
7 mapping Object --> Object
8 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
9
10 This file is part of GNU Classpath.
11
12 GNU Classpath is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2, or (at your option)
15 any later version.
16
17 GNU Classpath is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with GNU Classpath; see the file COPYING. If not, write to the
24 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 02111-1307 USA.
26
27 Linking this library statically or dynamically with other modules is
28 making a combined work based on this library. Thus, the terms and
29 conditions of the GNU General Public License cover the whole
30 combination.
31
32 As a special exception, the copyright holders of this library give you
33 permission to link this library with independent modules to produce an
34 executable, regardless of the license terms of these independent
35 modules, and to copy and distribute the resulting executable under
36 terms of your choice, provided that you also meet, for each linked
37 independent module, the terms and conditions of the license of that
38 module. An independent module is a module which is not derived from
39 or based on this library. If you modify this library, you may extend
40 this exception to your version of the library, but you are not
41 obligated to do so. If you do not wish to do so, delete this
42 exception statement from your version.
43
44  * end quote.
45  *
46  * This file is licenced under the same conditions as its original (GPL +
47  * "special exception").
48  */

49
50 package org.ozoneDB.collections;
51
52 import java.util.Iterator JavaDoc;
53
54 /**
55  * <p>DO NOT USE THIS CLASS DIRECTLY.</p>
56  * <p>This should be an anonymous inner class; ozone will probably never support
57  * these as being seperate ozone objects, so we have to resort to this hack.</p>
58  */

59 public class _BaseTreeMap_values extends AbstractOzoneCollection implements OzoneCollection {
60
61     private static final long serialVersionUID = 1L;
62
63     private BaseTreeMap owner;
64
65     /** Creates a new instance of BaseTreeMap_values */
66     public _BaseTreeMap_values(BaseTreeMap owner) {
67         this.owner = owner;
68     }
69
70     public int size() {
71         return owner.size();
72     }
73
74     public Iterator JavaDoc iterator() {
75         if (owner._org_ozoneDB_alwaysUseInternalIterator()) {
76             return _org_ozoneDB_internalIterator();
77         } else {
78 // TODO: replace when FakeFactoryGenerator is ready
79
// return = BaseTreeMap_TreeIteratorFactory.getDefault.create(owner, BaseTreeMapImpl.VALUES);
80
return (Iterator JavaDoc) database().createObject(_BaseTreeMap_OzoneTreeIteratorImpl.class,
81                     new Class JavaDoc[] {BaseTreeMap.class, Integer.TYPE},
82                     new Object JavaDoc[] {owner, new Integer JavaDoc(BaseTreeMapImpl.VALUES)});
83         }
84     }
85
86     public Iterator JavaDoc _org_ozoneDB_internalIterator() {
87         return new _BaseTreeMap_TreeIterator(owner, BaseTreeMapImpl.VALUES);
88     }
89
90     public void clear() {
91         owner.clear();
92     }
93
94 }
Popular Tags