]> gitweb.fperrin.net Git - Dictionary.git/blob - src/com/hughes/android/dictionary/engine/TokenRow.java
Added Apache license.
[Dictionary.git] / src / com / hughes / android / dictionary / engine / TokenRow.java
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package com.hughes.android.dictionary.engine;
16
17 import java.io.IOException;
18 import java.io.PrintStream;
19 import java.io.RandomAccessFile;
20
21 public class TokenRow extends RowBase {
22   
23   TokenRow(final RandomAccessFile raf, final int thisRowIndex, final Index index) throws IOException {
24     super(raf, thisRowIndex, index);
25   }
26
27   TokenRow(final int referenceIndex, final int thisRowIndex, final Index index) {
28     super(referenceIndex, thisRowIndex, index);
29   }
30   
31   public String toString() {
32     return getToken() + "@" + referenceIndex;
33   }
34
35   @Override
36   public TokenRow getTokenRow(final boolean search) {
37     return this;
38   }
39
40   @Override
41   public void setTokenRow(TokenRow tokenRow) {
42     throw new RuntimeException("Shouldn't be setting TokenRow's TokenRow!");
43   }
44   
45   public String getToken() {
46     return index.sortedIndexEntries.get(referenceIndex).token;
47   }
48
49   @Override
50   public void print(final PrintStream out) {
51     out.println("===" + getToken() + "===");
52   }
53
54   @Override
55   public String getRawText(boolean compact) {
56     return getToken();
57   }
58
59
60 }