KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > mdr > persistence > MultivaluedIndex


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.mdr.persistence;
20
21 /**
22  *
23  * @author Pavel Buzek
24  * @version
25  */

26 public interface MultivaluedIndex extends Index {
27     /** Returns a collection view of the values associated in the index with specified key.
28      * Returned collection is live and modifiable.
29      * If there are no values associated with the key empty collection is returned.
30      * @return
31      * @param key
32      * @throws StorageException
33      */

34     public java.util.Collection JavaDoc getItems (Object JavaDoc key) throws StorageException;
35     /** Like getItems, but if the index contains keys, this returns the objects
36      * corresponding to the key
37      * @return
38      * @param key
39      * @throws StorageException
40      */

41     public java.util.Collection JavaDoc getObjects (Object JavaDoc key, SinglevaluedIndex repos) throws StorageException;
42     /** If true, the collection of values is contrained to hold
43      * no more than one of any value.
44      * @throws StorageException
45      * @param key
46      * @param repos where to fetch objects from
47      * @return
48      */

49     public boolean isUnique() throws StorageException;
50
51     /** Removes the first occurrence of the specified element in the list
52      * of values associated with the specified key.
53      * @return true if this index changed as a result of this call
54      * @param key
55      * @param value
56      */

57     public boolean remove (Object JavaDoc key, Object JavaDoc value) throws StorageException;
58     
59     /** Returns a collection of {@link java.util.Map.Entry} key-value pairs in the index,
60      * where key matches the queried prefix.
61      * Values are live and modifiable collection, as in case of {@link #getObjects} method.
62      * @param prefix queried prefix
63      * @param repos primary index
64      * @return
65      * @throws StorageException
66      * @throws UnsupportedOperationException thrown if the index does not support quries on
67      * prefixes (due to unsuitable key entry type, etc.)
68      */

69     public java.util.Collection JavaDoc queryByKeyPrefix (Object JavaDoc prefix, SinglevaluedIndex repos) throws StorageException;
70 }
71
Popular Tags