Mercurial > hg > blitz_condensed
diff src/org/dancres/blitz/entry/SearchVisitor.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/dancres/blitz/entry/SearchVisitor.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,47 @@ +package org.dancres.blitz.entry; + +import net.jini.core.transaction.TransactionException; + +import org.dancres.blitz.mangler.MangledEntry; + +/** + When an EntryRepository is asked to perform a search based on a template + it offers matches to a SearchVisitor until it either exhausts all + possibilities or is told to stop by the SearchVisitor. Note searches + should lock the state of the associated EntrySleeve whilst + <code>offer</code> is invoked to prevent acceptance by SearchVisitorImpl + which must later be cancelled due to the underlying EntrySleeve having + gone into an unreachable state. + */ +public interface SearchVisitor { + /** + Returned from offer when the SearchVisitor wishes to exit the search + and doesn't wish to accept the offer. + */ + public static final int STOP = 1; + + /** + Returned from offer when the SearchVisitor wishes to accept the offer. + The FS should make good on the offer before stopping the search. + */ + public static final int ACCEPTED = 2; + + /** + Indicates the SearchVisitor cannot accept the offer and wishes search + to continue with more offers + */ + public static final int TRY_AGAIN = 3; + + /** + This method can also be used by the asynchronous recent write code. + + @return STOP if the SearchVisitor wishes to halt the search and + doesn't want to act on the offer. + */ + public int offer(SearchOffer anOffer); + + /** + @return <code>true</code> if this Visitor wishes to perform a take. + */ + public boolean isDeleter(); +}