add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / facet / src / test / org / apache / lucene / facet / enhancements / CategoryEnhancementDummy2.java
1 package org.apache.lucene.facet.enhancements;
2
3 import org.apache.lucene.analysis.TokenStream;
4
5 import org.apache.lucene.facet.enhancements.CategoryEnhancement;
6 import org.apache.lucene.facet.enhancements.params.EnhancementsIndexingParams;
7 import org.apache.lucene.facet.index.DummyProperty;
8 import org.apache.lucene.facet.index.attributes.CategoryAttribute;
9 import org.apache.lucene.facet.index.attributes.CategoryProperty;
10 import org.apache.lucene.facet.index.streaming.CategoryListTokenizer;
11 import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
12
13 /**
14  * Licensed to the Apache Software Foundation (ASF) under one or more
15  * contributor license agreements.  See the NOTICE file distributed with
16  * this work for additional information regarding copyright ownership.
17  * The ASF licenses this file to You under the Apache License, Version 2.0
18  * (the "License"); you may not use this file except in compliance with
19  * the License.  You may obtain a copy of the License at
20  *
21  *     http://www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an "AS IS" BASIS,
25  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  */
29
30 public class CategoryEnhancementDummy2 implements CategoryEnhancement {
31
32   public static byte[] CATEGORY_TOKEN_BYTES = new byte[] { 3, 0, 7 };
33
34   public boolean generatesCategoryList() {
35     return false;
36   }
37
38   public String getCategoryListTermText() {
39     return null;
40   }
41
42   public CategoryListTokenizer getCategoryListTokenizer(
43       TokenStream tokenizer, EnhancementsIndexingParams indexingParams,
44       TaxonomyWriter taxonomyWriter) {
45     return null;
46   }
47
48   public byte[] getCategoryTokenBytes(CategoryAttribute categoryAttribute) {
49     return CATEGORY_TOKEN_BYTES;
50   }
51
52   public Object extractCategoryTokenData(byte[] buffer, int offset, int length) {
53     if (length != CATEGORY_TOKEN_BYTES.length) {
54       throw new IllegalArgumentException("unexpected data length "
55           + length);
56     }
57     byte[] ret = new byte[length];
58     System.arraycopy(buffer, offset, ret, 0, length);
59     return ret;
60   }
61
62   public Class<? extends CategoryProperty> getRetainableProperty() {
63     return DummyProperty.class;
64   }
65
66   @Override
67   public boolean equals(Object o) {
68     if (o instanceof CategoryEnhancementDummy2) {
69       return true;
70     }
71     return false;
72   }
73   
74   @Override
75   public int hashCode() {
76     return super.hashCode();
77   }
78   
79 }