1 package org.apache.lucene.index;
4 * Copyright 2007 The Apache Software Foundation
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 * Convenience class for holding TermVector information.
22 public class TermVectorEntry {
25 private int frequency;
26 private TermVectorOffsetInfo [] offsets;
30 public TermVectorEntry() {
33 public TermVectorEntry(String field, String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions) {
36 this.frequency = frequency;
37 this.offsets = offsets;
38 this.positions = positions;
42 public String getField() {
46 public int getFrequency() {
50 public TermVectorOffsetInfo[] getOffsets() {
54 public int[] getPositions() {
58 public String getTerm() {
63 void setFrequency(int frequency) {
64 this.frequency = frequency;
67 void setOffsets(TermVectorOffsetInfo[] offsets) {
68 this.offsets = offsets;
71 void setPositions(int[] positions) {
72 this.positions = positions;
77 public boolean equals(Object o) {
78 if (this == o) return true;
79 if (o == null || getClass() != o.getClass()) return false;
81 TermVectorEntry that = (TermVectorEntry) o;
83 if (term != null ? !term.equals(that.term) : that.term != null) return false;
89 public int hashCode() {
90 return (term != null ? term.hashCode() : 0);
94 public String toString() {
95 return "TermVectorEntry{" +
96 "field='" + field + '\'' +
97 ", term='" + term + '\'' +
98 ", frequency=" + frequency +