001: /* $Id: RowCollection.java,v 1.2 2005/12/22 09:02:30 ahimanikya Exp $
002: * =======================================================================
003: * Copyright (c) 2005-2006 Axion Development Team. All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions
007: * are met:
008: *
009: * 1. Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the following
011: * disclaimer.
012: *
013: * 2. Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in
015: * the documentation and/or other materials provided with the
016: * distribution.
017: *
018: * 3. The names "Tigris", "Axion", nor the names of its contributors may
019: * not be used to endorse or promote products derived from this
020: * software without specific prior written permission.
021: *
022: * 4. Products derived from this software may not be called "Axion", nor
023: * may "Tigris" or "Axion" appear in their names without specific prior
024: * written permission.
025: *
026: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
027: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
028: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
029: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
030: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
031: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
032: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
033: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
034: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
036: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
037: * =======================================================================
038: */
039: package org.axiondb;
040:
041: /**
042: * @version $Revision: 1.2 $ $Date: 2005/12/22 09:02:30 $
043: * @author Ahimanikya Satapathy
044: */
045: public interface RowCollection {
046:
047: /**
048: * Ensures that this row collection contains the specified row. Returns <tt>true</tt>
049: * if this row collection changed as a result of the call. (Returns <tt>false</tt>
050: * if this row collection does not permit duplicates and already contains the
051: * specified row.)
052: * <p>
053: *
054: * @param row whose presence in this row collection is to be ensured.
055: * @return <tt>true</tt> if this row collection changed as a result of the call
056: * @throws UnsupportedOperationException <tt>add</tt> is not supported by this row
057: * collection.
058: */
059: boolean add(Row row) throws AxionException;
060:
061: /**
062: * Removes all of the rows from this row collection.
063: *
064: * @throws UnsupportedOperationException if the <tt>clear</tt> method is not
065: * supported by this row collection.
066: */
067: void clear() throws AxionException;
068:
069: /**
070: * Returns <tt>true</tt> if this row collection contains the specified row. More
071: * formally, returns <tt>true</tt> if and only if this row collection contains at
072: * least one row <tt>e</tt> such that <tt>(o==null ? e==null : row.equals(e))</tt>.
073: *
074: * @param row whose presence in this row collection is to be tested.
075: * @return <tt>true</tt> if this row collection contains the specified row
076: */
077: boolean contains(Row row) throws AxionException;
078:
079: /**
080: * Returns <tt>true</tt> if this row collection contains no rows.
081: *
082: * @return <tt>true</tt> if this row collection contains no rows
083: */
084: boolean isEmpty();
085:
086: /**
087: * Returns an iterator over the rows in this row collection. There are no guarantees
088: * concerning the order in which the rows are returned (unless this row collection is
089: * an instance of some class that provides a guarantee).
090: *
091: * @return an <tt>Iterator</tt> over the rows in this row collection
092: */
093: RowIterator rowIterator() throws AxionException;
094:
095: /**
096: * Removes a single instance of the specified row from this row collection, if it is
097: * present.
098: *
099: * @param row to be removed from this row collection, if present.
100: * @return <tt>true</tt> if this row collection changed as a result of the call
101: * @throws UnsupportedOperationException remove is not supported by this row
102: * collection.
103: */
104: boolean remove(Row row) throws AxionException;
105:
106: /**
107: * Returns the number of rows in this row collection.
108: *
109: * @return the number of rows in this row collection
110: */
111: int size();
112:
113: }
|