01: /*
02: * ModuleEntry.java
03: *
04: * Created on October 8, 2002, 4:01 PM
05: */
06:
07: package org.netbeans.performance.impl.logparsing;
08:
09: import org.netbeans.performance.spi.*;
10: import java.util.*;
11:
12: /**Wrapper class for a module entry line in a NetBeans log.
13: *
14: * @author Tim Boudreau
15: */
16: public class ModuleEntry extends ValueLogElement {
17: String qualifiedName;
18: String simpleName;
19: int specversion;
20: Date builddate;
21:
22: public ModuleEntry(String s) {
23: super (s);
24: }
25:
26: protected void parse() throws ParseException {
27: int verindex = line.indexOf(' ');
28: if (verindex > 0) {
29: qualifiedName = line.substring(0, verindex - 2);
30: int p = qualifiedName.lastIndexOf('.') + 1;
31: if (p == -1)
32: p = 0;
33: int e = qualifiedName.indexOf('/');
34: if (e == -1)
35: e = qualifiedName.length();
36: simpleName = qualifiedName.substring(p, e);
37: //XXX TODO - wrap build date and version info
38: } else {
39: throw new ParseException(line,
40: "Cannot find module info in \"" + line + "\"");
41: }
42:
43: }
44:
45: public String toString() {
46: checkParsed();
47: return simpleName;
48: }
49:
50: public int hashCode() {
51: return line.hashCode() ^ 37;
52: }
53:
54: public boolean equals(Object o) {
55: return (o instanceof ModuleEntry)
56: && (((ModuleEntry) o).line.equals(line));
57: }
58: }
|