use of org.eclipse.titan.log.viewer.parsers.data.LogRecord in project titan.EclipsePlug-ins by eclipse.
the class CachedLogReader method getRecordById.
@Override
public LogRecord getRecordById(final int id) throws IOException, ParseException {
if (id < cachedRecords[minIndex].getRecordNumber() || id > cachedRecords[maxIndex].getRecordNumber()) {
return logReader.getRecordById(id);
}
LogRecord tmp = new LogRecord();
tmp.setRecordNumber(id);
int index = Arrays.binarySearch(cachedRecords, tmp, new Comparator<LogRecord>() {
@Override
public int compare(final LogRecord o1, final LogRecord o2) {
return o1.getRecordNumber() - o2.getRecordNumber();
}
});
if (index > 0) {
return cachedRecords[index];
}
return null;
}
Aggregations