1 52 53 package freemarker.debug; 54 55 import java.io.Serializable ; 56 57 62 public class Breakpoint implements Serializable , Comparable 63 { 64 private final String templateName; 65 private final int line; 66 67 72 public Breakpoint(String templateName, int line) 73 { 74 this.templateName = templateName; 75 this.line = line; 76 } 77 78 81 public int getLine() 82 { 83 return line; 84 } 85 88 public String getTemplateName() 89 { 90 return templateName; 91 } 92 93 public int hashCode() 94 { 95 return templateName.hashCode() + 31 * line; 96 } 97 98 public boolean equals(Object o) 99 { 100 if(o instanceof Breakpoint) 101 { 102 Breakpoint b = (Breakpoint)o; 103 return b.templateName.equals(templateName) && b.line == line; 104 } 105 return false; 106 } 107 108 public int compareTo(Object o) 109 { 110 Breakpoint b = (Breakpoint)o; 111 int r = templateName.compareTo(b.templateName); 112 return r == 0 ? line - b.line : r; 113 } 114 115 118 public String getLocationString() 119 { 120 return templateName + ":" + line; 121 } 122 } 123 | Popular Tags |