X-Git-Url: https://git.mdrn.pl/pylucene.git/blobdiff_plain/a2e61f0c04805cfcb8706176758d1283c7e3a55c..aaeed5504b982cf3545252ab528713250aa33eed:/lucene-java-3.4.0/lucene/contrib/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java diff --git a/lucene-java-3.4.0/lucene/contrib/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java b/lucene-java-3.4.0/lucene/contrib/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java deleted file mode 100644 index 1df4c0e..0000000 --- a/lucene-java-3.4.0/lucene/contrib/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.apache.lucene.facet.index.params; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.lucene.facet.taxonomy.CategoryPath; - -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A FacetIndexingParams that utilizes different category lists, defined by the - * dimension specified CategoryPaths (see - * {@link PerDimensionIndexingParams#addCategoryListParams(CategoryPath, CategoryListParams)} - *

- * A 'dimension' is defined as the first or "zero-th" component in a - * CategoryPath. For example, if a CategoryPath is defined as - * "/Author/American/Mark Twain", then the dimension is "Author". - *

- * This class also uses the 'default' CategoryListParams (as specified by - * {@link CategoryListParams#CategoryListParams()} when - * {@link #getCategoryListParams(CategoryPath)} is called for a CategoryPath - * whose dimension component has not been specifically defined. - * - * @lucene.experimental - */ -public class PerDimensionIndexingParams extends DefaultFacetIndexingParams { - - // "Root" or "first component" of a Category Path maps to a - // CategoryListParams - private final Map clParamsMap = new HashMap(); - - /** - * Construct with the default {@link CategoryListParams} as the default - * CategoryListParams for unspecified CategoryPaths. - */ - public PerDimensionIndexingParams() { - this(new CategoryListParams()); - } - - /** - * Construct with the included categoryListParams as the default - * CategoryListParams for unspecified CategoryPaths. - * - * @param categoryListParams - * the default categoryListParams to use - */ - public PerDimensionIndexingParams(CategoryListParams categoryListParams) { - super(categoryListParams); - } - - /** - * Get all the categoryListParams, including the default. - */ - @Override - public Iterable getAllCategoryListParams() { - ArrayList vals = - new ArrayList(clParamsMap.values()); - for (CategoryListParams clp : super.getAllCategoryListParams()) { - vals.add(clp); - } - return vals; - } - - /** - * Get the CategoryListParams based on the dimension or "zero-th category" - * of the specified CategoryPath. - */ - @Override - public CategoryListParams getCategoryListParams(CategoryPath category) { - if (category != null) { - CategoryListParams clParams = clParamsMap.get(category.getComponent(0)); - if (clParams != null) { - return clParams; - } - } - return super.getCategoryListParams(category); - } - - /** - * Add a CategoryListParams for a given CategoryPath's dimension or - * "zero-th" category. - * - * @param category - * @param clParams - */ - public void addCategoryListParams(CategoryPath category, CategoryListParams clParams) { - clParamsMap.put(category.getComponent(0), clParams); - } -}