/** Builds a composite comparator matching the specified sortBy array */ public static Comparator<Info> buildComparator(SortBy... sortBy) { if (sortBy.length == 0) { throw new IllegalArgumentException( "No way to build comparators out of an empty comparator set"); } if (sortBy.length == 1) { return buildComparator(sortBy[0]); } else { List<Comparator<Info>> comparators = new ArrayList<Comparator<Info>>(); for (SortBy curr : sortBy) { Comparator<Info> comparator = buildComparator(curr); comparators.add(comparator); } return new CompositeComparator<Info>(comparators); } }
public CatalogStoreFeatureIterator(int offset, int count, SortBy[] sortOrder, Filter filter, Catalog catalog, CatalogStoreMapping mapping, RecordDescriptor recordDescriptor, Map<String, String> interpolationProperties) { this.offset = offset; this.count = count; this.sortOrder = sortOrder; this.filter = filter; catalogFacade = catalog.getFacade(); this.mapping = mapping; this.interpolationProperties = interpolationProperties; layerIt = catalogFacade.list(ResourceInfo.class, filter, null, null, sortOrder); nextLayer(); layerGroupIt = catalogFacade.list(LayerGroupInfo.class, filter, null, null, sortOrder); nextLayerGroup(); comparator = sortOrder==null || sortOrder.length==0 ? null : CatalogComparatorFactory.buildComparator(sortOrder); index = 0; while (index < offset && hasNext()) { nextInternal(); } builder = new GenericRecordBuilder(recordDescriptor); }
sortOrder == null || sortOrder.length == 0 ? null : CatalogComparatorFactory.buildComparator(sortOrder); index = 0; while (index < offset && hasNext()) {