Search in sources :

Example 21 with LogRecord

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;
}
Also used : LogRecord(org.eclipse.titan.log.viewer.parsers.data.LogRecord)

Aggregations

LogRecord (org.eclipse.titan.log.viewer.parsers.data.LogRecord)21 ParseException (java.text.ParseException)9 EventObject (org.eclipse.titan.log.viewer.views.msc.model.EventObject)9 IFile (org.eclipse.core.resources.IFile)6 TableItem (org.eclipse.swt.widgets.TableItem)5 IOException (java.io.IOException)4 IProject (org.eclipse.core.resources.IProject)4 TechnicalException (org.eclipse.titan.log.viewer.exceptions.TechnicalException)4 UserException (org.eclipse.titan.log.viewer.exceptions.UserException)4 LogFileMetaData (org.eclipse.titan.log.viewer.models.LogFileMetaData)4 IViewReference (org.eclipse.ui.IViewReference)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 File (java.io.File)3 IWorkspace (org.eclipse.core.resources.IWorkspace)3 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)3 RecordParser (org.eclipse.titan.log.viewer.parsers.RecordParser)3 ExecutionModel (org.eclipse.titan.log.viewer.views.msc.model.ExecutionModel)3 RandomAccessFile (java.io.RandomAccessFile)2 ArrayList (java.util.ArrayList)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2