Coverage Report - net.wotonomy.datastore.DataIndex
 
Classes in this File Line Coverage Branch Coverage Complexity
DataIndex
N/A 
N/A 
1
 
 1  
 /*
 2  
 Wotonomy: OpenStep design patterns for pure Java applications.
 3  
 Copyright (C) 2000 Michael Powers
 4  
 
 5  
 This library is free software; you can redistribute it and/or
 6  
 modify it under the terms of the GNU Lesser General Public
 7  
 License as published by the Free Software Foundation; either
 8  
 version 2.1 of the License, or (at your option) any later version.
 9  
 
 10  
 This library is distributed in the hope that it will be useful,
 11  
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
 Lesser General Public License for more details.
 14  
 
 15  
 You should have received a copy of the GNU Lesser General Public
 16  
 License along with this library; if not, see http://www.gnu.org
 17  
 */
 18  
 
 19  
 package net.wotonomy.datastore;
 20  
 
 21  
 import java.io.Serializable;
 22  
 import java.util.List;
 23  
 
 24  
 /**
 25  
 * A DataIndex maintains a list of objects associated with values.
 26  
 * The objects can then be retrieved based on the values.  This class
 27  
 * should not be much more complex than a simple map or list because 
 28  
 * the DataSoup is responsible for populating it.
 29  
 */
 30  
 public interface DataIndex extends Serializable
 31  
 {
 32  
     /**
 33  
     * Gets the name of this index.  The DataSoup uses this to
 34  
     * uniquely refer to this index.
 35  
     * @return The name of this index.
 36  
     */
 37  
     public String getName();
 38  
 
 39  
     /**
 40  
     * The property managed by this index.  This is the property 
 41  
     * used when the DataSoup builds and rebuilds this index.
 42  
     * @return The property managed by this index.
 43  
     */
 44  
     public String getProperty();
 45  
     
 46  
     /**
 47  
     * Adds an object to be associated with the specified value.
 48  
     * @param anObject A data object, usually but not always a DataKey.
 49  
     * @param newValue The property value to be associated with the data object.
 50  
     * @return The data object that was inserted, or null if an error occurred.
 51  
     */
 52  
     public Object addObject( Object anObject, Object newValue );
 53  
             
 54  
     /**
 55  
     * Updates an object previously associated with the specified
 56  
     * value to be associated with the specified new value.
 57  
     * @param anObject A data object, usually but not always a DataKey.
 58  
     * @param oldValue The value currently associated with the data object.
 59  
     * @param newValue The value to be associated with the data object.
 60  
     * @return The data object that was updated, or null if an error occurred.
 61  
     */
 62  
     public Object updateObject( Object anObject, 
 63  
             Object oldValue, Object newValue );
 64  
             
 65  
     /**
 66  
     * Removes an object from the index.
 67  
     * @param anObject A data object, usually but not always a DataKey.
 68  
     * @param oldValue The value currently associated with the data object.
 69  
     * @return The data object that was removed, or null if not found or error.
 70  
     */
 71  
     public Object removeObject( Object anObject, Object oldValue );
 72  
 
 73  
     /**
 74  
     * Removes all objects from the index.  Usually called before
 75  
     * rebuilding the index.
 76  
     */
 77  
     public void clear();
 78  
         
 79  
     /**
 80  
     * Returns all objects in the index whose associated values fall
 81  
     * between the two specified values, inclusive.  
 82  
     * @param beginValue The beginning value, or null for all values
 83  
     * up to an including the end key.
 84  
     * @param endValue The ending value, or null for all values
 85  
     * since and including the begin key.
 86  
     * @return A List of the matching objects, ordered in increasing
 87  
     * value, or null for invalid query parameters or other error.
 88  
     */
 89  
     public List query( Object beginValue, Object endValue );
 90  
     
 91  
 }
 92  
 
 93  
 /*
 94  
  * $Log$
 95  
  * Revision 1.2  2006/02/19 16:26:19  cgruber
 96  
  * Move non-unit-test code to tests project
 97  
  * Fix up code to work with proper imports
 98  
  * Fix maven dependencies.
 99  
  *
 100  
  * Revision 1.1  2006/02/16 13:18:56  cgruber
 101  
  * Check in all sources in eclipse-friendly maven-enabled packages.
 102  
  *
 103  
  * Revision 1.1.1.1  2000/12/21 15:46:50  mpowers
 104  
  * Contributing wotonomy.
 105  
  *
 106  
  * Revision 1.2  2000/12/20 16:25:35  michael
 107  
  * Added log to all files.
 108  
  *
 109  
  *
 110  
  */
 111