KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > bidimap > AbstractOrderedBidiMapDecorator


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections.bidimap;
17
18 import org.apache.commons.collections.OrderedBidiMap;
19 import org.apache.commons.collections.OrderedMapIterator;
20
21 /**
22  * Provides a base decorator that enables additional functionality to be added
23  * to an OrderedBidiMap via decoration.
24  * <p>
25  * Methods are forwarded directly to the decorated map.
26  * <p>
27  * This implementation does not perform any special processing with the map views.
28  * Instead it simply returns the inverse from the wrapped map. This may be
29  * undesirable, for example if you are trying to write a validating implementation
30  * it would provide a loophole around the validation.
31  * But, you might want that loophole, so this class is kept simple.
32  *
33  * @since Commons Collections 3.0
34  * @version $Revision: 1.4 $ $Date: 2004/02/18 00:57:39 $
35  *
36  * @author Stephen Colebourne
37  */

38 public abstract class AbstractOrderedBidiMapDecorator
39         extends AbstractBidiMapDecorator implements OrderedBidiMap {
40     
41     /**
42      * Constructor that wraps (not copies).
43      *
44      * @param map the map to decorate, must not be null
45      * @throws IllegalArgumentException if the collection is null
46      */

47     protected AbstractOrderedBidiMapDecorator(OrderedBidiMap map) {
48         super(map);
49     }
50
51     /**
52      * Gets the map being decorated.
53      *
54      * @return the decorated map
55      */

56     protected OrderedBidiMap getOrderedBidiMap() {
57         return (OrderedBidiMap) map;
58     }
59
60     //-----------------------------------------------------------------------
61
public OrderedMapIterator orderedMapIterator() {
62         return getOrderedBidiMap().orderedMapIterator();
63     }
64
65     public Object JavaDoc firstKey() {
66         return getOrderedBidiMap().firstKey();
67     }
68
69     public Object JavaDoc lastKey() {
70         return getOrderedBidiMap().lastKey();
71     }
72
73     public Object JavaDoc nextKey(Object JavaDoc key) {
74         return getOrderedBidiMap().nextKey(key);
75     }
76
77     public Object JavaDoc previousKey(Object JavaDoc key) {
78         return getOrderedBidiMap().previousKey(key);
79     }
80
81     public OrderedBidiMap inverseOrderedBidiMap() {
82         return getOrderedBidiMap().inverseOrderedBidiMap();
83     }
84
85 }
86
Popular Tags