Mercurial > hg > blitz_condensed
diff src/org/dancres/blitz/DiskView.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/DiskView.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,41 @@ +package org.dancres.blitz; + +import org.dancres.blitz.entry.SearchOffer; +import org.dancres.blitz.entry.SearchVisitor; +import org.dancres.blitz.mangler.MangledEntry; + +/** + * Responsible for sourcing matching Entry's from the EntryRepositories to + * go into the UIDSet + */ +class DiskView implements SearchVisitor { + private UIDSet theUIDs; + private MangledEntry theTemplate; + + DiskView(MangledEntry aTemplate, UIDSet aSet) { + theTemplate = aTemplate; + theUIDs = aSet; + } + + public int offer(SearchOffer anOffer) { + MangledEntry myTarget = anOffer.getEntry(); + + if (theTemplate.match(myTarget)) { + // Need to record a globally unique id for later + theUIDs.add(new SpaceEntryUID(anOffer.getEntry().getType(), + anOffer.getInfo().getOID())); + } + + if (theUIDs.isFull()) + return STOP; + else + return TRY_AGAIN; + } + + /** + @return <code>true</code> if this Visitor wishes to perform a take. + */ + public boolean isDeleter() { + return false; + } +} \ No newline at end of file