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