String line = rafile.getNextLine();
while ((line != null) && (lineCount++ < MAX_LINES)) {
Matcher matcher = getFirstLinePattern().matcher(line);
- if (matcher.find()) {
+ if (matcher.matches()) {
matches++;
}
confidence = MAX_CONFIDENCE * matches / lineCount;
String line = fFile.getNextLine();
while (line != null) {
Matcher matcher = getFirstLinePattern().matcher(line);
- if (matcher.find()) {
- context.setLocation(new TmfLongLocation(rawPos));
- context.firstLineMatcher = matcher;
- context.firstLine = line;
- context.nextLineLocation = fFile.getFilePointer();
+ if (matcher.matches()) {
+ setupContext(context, rawPos, line, matcher);
return context;
}
rawPos = fFile.getFilePointer();
}
}
+ private void setupContext(TextTraceContext context, long rawPos, String line, Matcher matcher) throws IOException {
+ context.setLocation(new TmfLongLocation(rawPos));
+ context.firstLineMatcher = matcher;
+ context.firstLine = line;
+ context.nextLineLocation = fFile.getFilePointer();
+ }
+
@Override
public synchronized TmfContext seekEvent(double ratio) {
if (fFile == null) {
String line = fFile.getNextLine();
while (line != null) {
Matcher matcher = getFirstLinePattern().matcher(line);
- if (matcher.find()) {
- context.setLocation(new TmfLongLocation(rawPos));
- context.firstLineMatcher = matcher;
- context.firstLine = line;
- context.nextLineLocation = fFile.getFilePointer();
+ if (matcher.matches()) {
+ setupContext(context, rawPos, line, matcher);
return event;
}
parseNextLine(event, line);