Some progress toward implementing store(Analysis).
[cfb.git] / prod / net / jaekl / cfb / store / Location.java
1 package net.jaekl.cfb.store;
2
3 import net.jaekl.cfb.xml.BugClass;
4 import net.jaekl.cfb.xml.BugMethod;
5 import net.jaekl.cfb.xml.SourceLine;
6
7 public class Location {
8         String m_className;
9         String m_methodName;
10         int m_startLine;
11         int m_endLine;
12         
13         public Location(SourceLine sourceLine)
14         {
15                 init(sourceLine);
16         }
17         
18         public Location(BugMethod method) 
19         {
20                 init(method.getSourceLines());
21                 m_className = method.getClassName();
22                 m_methodName = method.getMethodName();
23         }
24         
25         public Location(BugClass bugClass)
26         {
27                 init(bugClass.getSourceLines());
28                 m_className = bugClass.getClassName();
29         }
30         
31         private void init(SourceLine[] sourceLines) 
32         {
33                 if (sourceLines.length > 0) {
34                         assert(null != sourceLines[0]);
35                         init(sourceLines[0]);
36                 }               
37         }
38
39         private void init(SourceLine sourceLine)
40         {
41                 m_className = sourceLine.getClassName();
42                 m_methodName = null;
43                 m_startLine = sourceLine.getStart();
44                 m_endLine = sourceLine.getEnd();
45         }
46 }