pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / facet / src / java / org / apache / lucene / facet / index / attributes / CategoryAttribute.java
1 package org.apache.lucene.facet.index.attributes;
2
3 import java.util.Collection;
4 import java.util.Set;
5
6 import org.apache.lucene.util.Attribute;
7
8 import org.apache.lucene.facet.taxonomy.CategoryPath;
9
10 /**
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements.  See the NOTICE file distributed with
13  * this work for additional information regarding copyright ownership.
14  * The ASF licenses this file to You under the Apache License, Version 2.0
15  * (the "License"); you may not use this file except in compliance with
16  * the License.  You may obtain a copy of the License at
17  *
18  *     http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  */
26
27 /**
28  * An attribute which contains for a certain category the {@link CategoryPath}
29  * and additional properties.
30  * 
31  * @lucene.experimental
32  */
33 public interface CategoryAttribute extends Attribute {
34
35   /**
36    * Set the content of this {@link CategoryAttribute} from another
37    * {@link CategoryAttribute} object.
38    * 
39    * @param other
40    *            The {@link CategoryAttribute} to take the content from.
41    */
42   public void set(CategoryAttribute other);
43
44   /**
45    * Sets the category path value of this attribute.
46    * 
47    * @param cp
48    *            A category path. May not be null.
49    */
50   public void setCategoryPath(CategoryPath cp);
51
52   /**
53    * Returns the value of this attribute: a category path.
54    * 
55    * @return The category path last assigned to this attribute, or null if
56    *         none has been assigned.
57    */
58   public CategoryPath getCategoryPath();
59
60   /**
61    * Add a property. The property can be later retrieved using
62    * {@link #getProperty(Class)} with this property class .<br>
63    * Adding multiple properties of the same class is forbidden.
64    * 
65    * @param property
66    *            The property to add.
67    * @throws UnsupportedOperationException
68    *             When attempting to add a property of a class that was added
69    *             before and merge is prohibited.
70    */
71   public void addProperty(CategoryProperty property)
72       throws UnsupportedOperationException;
73
74   /**
75    * Get a property of a certain property class.
76    * 
77    * @param propertyClass
78    *            The required property class.
79    * @return The property of the given class, or null if no such property
80    *         exists.
81    */
82   public CategoryProperty getProperty(
83       Class<? extends CategoryProperty> propertyClass);
84
85   /**
86    * Get a property of one of given property classes.
87    * 
88    * @param propertyClasses
89    *            The property classes.
90    * @return A property matching one of the given classes, or null if no such
91    *         property exists.
92    */
93   public CategoryProperty getProperty(
94       Collection<Class<? extends CategoryProperty>> propertyClasses);
95
96   /**
97    * Get all the active property classes.
98    * 
99    * @return A set containing the active property classes, or {@code null} if
100    *         there are no properties.
101    */
102   public Set<Class<? extends CategoryProperty>> getPropertyClasses();
103
104   /**
105    * Clone this {@link CategoryAttribute}.
106    * 
107    * @return A clone of this {@link CategoryAttribute}.
108    */
109   public CategoryAttribute clone();
110
111   /**
112    * Resets this attribute to its initial value: a null category path and no
113    * properties.
114    */
115   public void clear();
116
117   /**
118    * Clear all properties.
119    */
120   public void clearProperties();
121
122   /**
123    * Remove an property of a certain property class.
124    * 
125    * @param propertyClass
126    *            The required property class.
127    */
128   public void remove(Class<? extends CategoryProperty> propertyClass);
129 }