01: /*
02: Copyright (C) 2007 Mobixess Inc. http://www.java-objects-database.com
03:
04: This file is part of the JODB (Java Objects Database) open source project.
05:
06: JODB is free software; you can redistribute it and/or modify it under
07: the terms of version 2 of the GNU General Public License as published
08: by the Free Software Foundation.
09:
10: JODB is distributed in the hope that it will be useful, but WITHOUT ANY
11: WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: for more details.
14:
15: You should have received a copy of the GNU General Public License along
16: with this program; if not, write to the Free Software Foundation, Inc.,
17: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19: package com.mobixess.jodb.core.query;
20:
21: import java.io.IOException;
22:
23: import com.mobixess.jodb.core.io.JODBOperationContext;
24:
25: class SortingDataProvider {
26: private SortDataCache _sortDataCache;
27: private JODBOperationContext _context;
28: private QueryNode _query;
29:
30: /**
31: * @param sortDataCache
32: * @param context
33: */
34: SortingDataProvider(SortDataCache sortDataCache,
35: JODBOperationContext context, QueryNode query) {
36: super ();
37: _sortDataCache = sortDataCache;
38: _context = context;
39: _query = query;
40: }
41:
42: public SortingDataContainer getComparableForId(long objectID)
43: throws IOException {
44: SortingDataContainer container = _sortDataCache
45: .getSortDataForCandidateId(objectID);
46: if (container != null) {
47: return container;
48: }
49: _query.refillSortData(objectID, _sortDataCache, _context);
50: return _sortDataCache.acceptCandidate();
51: }
52:
53: }
|