// sequential scan; alternatively a B+-tree could be used
final Function queryFunction = new Function() {
   public Object invoke(Object queryObject) {
       final ClosedAuction auction = (ClosedAuction)((TimeStampedObject)queryObject).getObject();
       Cursor cursor = NEXMarkGeneratorSource.getPersonCursor(AUCTION_DATA_DIR+"person.xml", CASTOR_MAPPING_FILE);
       cursor.open();
       while (cursor.hasNext()) {
           Person next = (Person)cursor.next();
           if (auction.getBuyerId() == next.getId()) {
               cursor.close();
               return new SingleObjectCursor(next);
           }
       }
       cursor.close();
       return EmptyCursor.DEFAULT_INSTANCE;
   }
};
final Function closeFunction = new Function() {
   public Object invoke() {
       return null;
   }
};
final Function newResult = new Function() {
   public Object invoke(Object o1, Object o2) {
       return o2;
   }
};

NEXMarkGeneratorSource closedAuctions = new NEXMarkGeneratorSource(AUCTION_DATA_DIR,
        CASTOR_MAPPING_FILE, NEXMarkGeneratorSource.CLOSED_AUCTION_STREAM,
        NEXMarkGeneratorSource.GET_CLOSED_AUCTION_FUNCTION(), 0.5f, true);
closedAuctions.setCloseMode(Source.AUTOMATIC_CLOSE);

IndexJoin join = new IndexJoin(closedAuctions,
       queryFunction,
       closeFunction,
       newResult
);

sink = new SWTSink(join, "SWTSink", true, tf, SWT.MIN);

join.setMetaDataFactory(
	new MetaDataFactory(join, DEFAULT_METADATA2)
);

SWTPerformanceMonitor monitor = new SWTPerformanceMonitor((CompositeMetaData)join.getMetaData(), tf, SWT.NONE);
