1 package org.apache.lucene.index;
3 import java.io.Serializable;
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * The TermVectorOffsetInfo class holds information pertaining to a Term in a {@link org.apache.lucene.index.TermPositionVector}'s
24 * offset information. This offset information is the character offset as set during the Analysis phase (and thus may not be the actual offset in the
27 public class TermVectorOffsetInfo implements Serializable {
29 * Convenience declaration when creating a {@link org.apache.lucene.index.TermPositionVector} that stores only position information.
31 public transient static final TermVectorOffsetInfo[] EMPTY_OFFSET_INFO = new TermVectorOffsetInfo[0];
32 private int startOffset;
33 private int endOffset;
35 public TermVectorOffsetInfo() {
38 public TermVectorOffsetInfo(int startOffset, int endOffset) {
39 this.endOffset = endOffset;
40 this.startOffset = startOffset;
44 * The accessor for the ending offset for the term
47 public int getEndOffset() {
51 public void setEndOffset(int endOffset) {
52 this.endOffset = endOffset;
56 * The accessor for the starting offset of the term.
60 public int getStartOffset() {
64 public void setStartOffset(int startOffset) {
65 this.startOffset = startOffset;
69 * Two TermVectorOffsetInfos are equals if both the start and end offsets are the same
70 * @param o The comparison Object
71 * @return true if both {@link #getStartOffset()} and {@link #getEndOffset()} are the same for both objects.
74 public boolean equals(Object o) {
75 if (this == o) return true;
76 if (!(o instanceof TermVectorOffsetInfo)) return false;
78 final TermVectorOffsetInfo termVectorOffsetInfo = (TermVectorOffsetInfo) o;
80 if (endOffset != termVectorOffsetInfo.endOffset) return false;
81 if (startOffset != termVectorOffsetInfo.startOffset) return false;
87 public int hashCode() {
90 result = 29 * result + endOffset;