From 1e947afa4b660a23a2dcb57463dd810fb73e6030 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sun, 3 Sep 2006 21:48:14 +0000 Subject: Manage ordering properties with lists. --- .../java/com/amazon/carbonado/repo/toy/ToyStorage.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/test/java/com/amazon/carbonado/repo/toy') diff --git a/src/test/java/com/amazon/carbonado/repo/toy/ToyStorage.java b/src/test/java/com/amazon/carbonado/repo/toy/ToyStorage.java index dd29e4b..01f9fbf 100644 --- a/src/test/java/com/amazon/carbonado/repo/toy/ToyStorage.java +++ b/src/test/java/com/amazon/carbonado/repo/toy/ToyStorage.java @@ -48,10 +48,11 @@ import com.amazon.carbonado.filter.FilterValues; import com.amazon.carbonado.info.OrderedProperty; import com.amazon.carbonado.info.StorableIntrospector; +import com.amazon.carbonado.qe.ArraySortedQueryExecutor; import com.amazon.carbonado.qe.FilteredQueryExecutor; import com.amazon.carbonado.qe.IterableQueryExecutor; +import com.amazon.carbonado.qe.OrderingList; import com.amazon.carbonado.qe.QueryExecutor; -import com.amazon.carbonado.qe.SortedQueryExecutor; import com.amazon.carbonado.qe.StandardQuery; /** @@ -89,7 +90,7 @@ public class ToyStorage implements Storage, MasterSupport } public Query query() throws FetchException { - return new ToyQuery(null); + return new ToyQuery(null, null); } public Query query(String filter) throws FetchException { @@ -97,7 +98,7 @@ public class ToyStorage implements Storage, MasterSupport } public Query query(Filter filter) throws FetchException { - return new ToyQuery(filter.initialFilterValues()); + return new ToyQuery(filter.initialFilterValues(), null); } public boolean addTrigger(Trigger trigger) { @@ -211,7 +212,7 @@ public class ToyStorage implements Storage, MasterSupport } private class ToyQuery extends StandardQuery { - ToyQuery(FilterValues values, String... orderings) { + ToyQuery(FilterValues values, OrderingList orderings) { super(values, orderings); } @@ -223,19 +224,21 @@ public class ToyStorage implements Storage, MasterSupport return mRepo.enterTransaction(level); } - protected QueryExecutor getExecutor(FilterValues values, String... orderings) { + protected QueryExecutor getExecutor(FilterValues values, OrderingList orderings) { QueryExecutor executor = new IterableQueryExecutor(mType, mData, mDataLock); if (values != null) { executor = new FilteredQueryExecutor(executor, values.getFilter()); } - // FIXME: sorting + if (orderings.size() > 0) { + executor = new ArraySortedQueryExecutor(executor, null, orderings); + } return executor; } - protected StandardQuery newInstance(FilterValues values, String... orderings) { + protected StandardQuery newInstance(FilterValues values, OrderingList orderings) { return new ToyQuery(values, orderings); } } -- cgit v1.2.3