Révision 3781

TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TSCorpus.java (revision 3781)
78 78
	
79 79
	FileChannel offsetsFileChannel = null;
80 80
	
81
	/**
82
	 * offset to pass from TIGER to CQP positions
83
	 */
81 84
	MappedByteBuffer offsetsMapped = null; // one offset per tiger position
82 85
	
86
	/**
87
	 * 
88
	 */
83 89
	RandomAccessFile presencesRAFile = null;
84 90
	
85 91
	FileChannel presencesFileChannel = null;
86 92
	
93
	/**
94
	 * 
95
	 * 1 if the TIGER position has a position in CQP ; 0 if not
96
	 */
87 97
	MappedByteBuffer presencesMapped = null; // one 0/1 boolean per tiger position
88 98
	
89 99
	private int[] sentence_starts;
......
161 171
		}
162 172
	}
163 173
	
174

  
175
	/**
176
	 * @return TIGER position shifted to CQP position
177
	 */
164 178
	public int getOffset(int tigerPosition) {
165 179
		if (offsetsMapped != null) {
166 180
			return offsetsMapped.getInt(tigerPosition * Integer.BYTES);
......
170 184
		}
171 185
	}
172 186
	
187
	/**
188
	 * @return TIGER positions shifted to CQP positions
189
	 */
173 190
	public int[] getOffsets(int tigerPositions[]) {
174 191
		int[] ret = new int[tigerPositions.length];
175 192
		if (offsetsMapped != null) {
......
181 198
		return ret;
182 199
	}
183 200
	
201
	/**
202
	 * offset to add when passing to TIGER index to CQP index
203
	 * @return
204
	 */
184 205
	public MappedByteBuffer getOffsetsMapped() {
185 206
		return offsetsMapped;
186 207
	}
187 208
	
209
	/**
210
	 * 
211
	 * @param tigerPosition
212
	 * @return 1 if the TIGER position has a position in CQP ; 0 if not
213
	 */
188 214
	public MappedByteBuffer getPresencesMapped() {
189 215
		return presencesMapped;
190 216
	}
191 217
	
218
	/**
219
	 * 
220
	 * @param tigerPosition
221
	 * @return 1 if the TIGER position has a position in CQP ; 0 if not
222
	 */
192 223
	public int getPresence(int tigerPosition) {
193 224
		if (presencesMapped != null) {
194 225
			return presencesMapped.getInt(tigerPosition * Integer.BYTES);
......
198 229
		}
199 230
	}
200 231
	
232
	/**
233
	 * 
234
	 * @param tigerPosition
235
	 * @return 1 if the TIGER position has a position in CQP ; 0 if not
236
	 */
201 237
	public int[] getPresences(int tigerPositions[]) {
202 238
		int[] ret = new int[tigerPositions.length];
203 239
		if (presencesMapped != null) {
TXM/trunk/bundles/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 3781)
208 208
			}
209 209
			int[] cpos = { matches.get(0).getStart(), matches.get(matches.size() - 1).getEnd() };
210 210
			
211
			//apply shifts on start and end positions
212
			MappedByteBuffer offsetsMapped = tcorpus.getOffsetsMapped();
213
			if (offsetsMapped != null) {
214
				cpos[0] -= offsetsMapped.getInt(cpos[0] * Integer.BYTES);
215
				cpos[1] -= offsetsMapped.getInt(cpos[1] * Integer.BYTES);
216
			}
217
			
211 218
			int[] starts = tcorpus.getSentenceStartPositions();
212 219
			int sent_max = starts.length;
213 220
			int sent_min = 0;

Formats disponibles : Unified diff