2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 using System.Runtime.InteropServices;
22 namespace Mono.Lucene.Net.Index
25 /// <summary> The TermVectorOffsetInfo class holds information pertaining to a Term in a {@link Mono.Lucene.Net.Index.TermPositionVector}'s
26 /// 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 /// original content).
30 public class TermVectorOffsetInfo
32 /// <summary> Convenience declaration when creating a {@link Mono.Lucene.Net.Index.TermPositionVector} that stores only position information.</summary>
34 public static readonly TermVectorOffsetInfo[] EMPTY_OFFSET_INFO = new TermVectorOffsetInfo[0];
35 private int startOffset;
36 private int endOffset;
38 public TermVectorOffsetInfo()
42 public TermVectorOffsetInfo(int startOffset, int endOffset)
44 this.endOffset = endOffset;
45 this.startOffset = startOffset;
48 /// <summary> The accessor for the ending offset for the term</summary>
49 /// <returns> The offset
51 public virtual int GetEndOffset()
56 public virtual void SetEndOffset(int endOffset)
58 this.endOffset = endOffset;
61 /// <summary> The accessor for the starting offset of the term.
64 /// <returns> The offset
66 public virtual int GetStartOffset()
71 public virtual void SetStartOffset(int startOffset)
73 this.startOffset = startOffset;
76 /// <summary> Two TermVectorOffsetInfos are equals if both the start and end offsets are the same</summary>
77 /// <param name="o">The comparison Object
79 /// <returns> true if both {@link #GetStartOffset()} and {@link #GetEndOffset()} are the same for both objects.
81 public override bool Equals(System.Object o)
85 if (!(o is TermVectorOffsetInfo))
88 TermVectorOffsetInfo termVectorOffsetInfo = (TermVectorOffsetInfo) o;
90 if (endOffset != termVectorOffsetInfo.endOffset)
92 if (startOffset != termVectorOffsetInfo.startOffset)
98 public override int GetHashCode()
101 result = startOffset;
102 result = 29 * result + endOffset;