01: /*
02: * Copyright 2003-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
17:
18: import java.util.SortedMap;
19:
20: /**
21: * Defines a map that allows bidirectional lookup between key and values
22: * and retains both keys and values in sorted order.
23: * <p>
24: * Implementations should allow a value to be looked up from a key and
25: * a key to be looked up from a value with equal performance.
26: *
27: * @since Commons Collections 3.0
28: * @version $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $
29: *
30: * @author Stephen Colebourne
31: */
32: public interface SortedBidiMap extends OrderedBidiMap, SortedMap {
33:
34: /**
35: * Gets a view of this map where the keys and values are reversed.
36: * <p>
37: * Changes to one map will be visible in the other and vice versa.
38: * This enables both directions of the map to be accessed equally.
39: * <p>
40: * Implementations should seek to avoid creating a new object every time this
41: * method is called. See <code>AbstractMap.values()</code> etc. Calling this
42: * method on the inverse map should return the original.
43: * <p>
44: * Implementations must return a <code>SortedBidiMap</code> instance,
45: * usually by forwarding to <code>inverseSortedBidiMap()</code>.
46: *
47: * @return an inverted bidirectional map
48: */
49: public BidiMap inverseBidiMap();
50:
51: /**
52: * Gets a view of this map where the keys and values are reversed.
53: * <p>
54: * Changes to one map will be visible in the other and vice versa.
55: * This enables both directions of the map to be accessed as a <code>SortedMap</code>.
56: * <p>
57: * Implementations should seek to avoid creating a new object every time this
58: * method is called. See <code>AbstractMap.values()</code> etc. Calling this
59: * method on the inverse map should return the original.
60: * <p>
61: * The inverse map returned by <code>inverseBidiMap()</code> should be the
62: * same object as returned by this method.
63: *
64: * @return an inverted bidirectional map
65: */
66: public SortedBidiMap inverseSortedBidiMap();
67:
68: }
|