| 1 19 20 package edu.umd.cs.findbugs; 21 22 32 public class BugPattern implements Comparable <BugPattern> { 33 private String type; 34 private String abbrev; 35 private String category; 36 private boolean experimental; 37 private String shortDescription; 38 private String longDescription; 39 private String detailText; 40 private String detailHTML; 41 42 54 public BugPattern(String type, String abbrev, String category, boolean experimental, 55 String shortDescription, String longDescription, String detailText) { 56 this.type = type; 57 this.abbrev = abbrev; 58 this.category = category; 59 this.experimental = experimental; 60 this.shortDescription = shortDescription; 61 this.longDescription = longDescription; 62 this.detailText = detailText; 63 } 64 65 68 public String getType() { 69 return type; 70 } 71 72 75 public String getAbbrev() { 76 return abbrev; 77 } 78 79 82 public String getCategory() { 83 return category; 84 } 85 86 89 public boolean isExperimental() { 90 return experimental; 91 } 92 93 96 public String getShortDescription() { 97 return shortDescription; 98 } 99 100 103 public String getLongDescription() { 104 return longDescription; 105 } 106 107 110 public String getDetailText() { 111 return detailText; 112 } 113 114 117 public String getDetailHTML() { 118 if (detailHTML == null) { 119 StringBuffer buf = new StringBuffer (); 120 buf.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"); 121 buf.append("<HTML><HEAD><TITLE>"); 122 buf.append(getShortDescription()); 123 buf.append("</TITLE></HEAD><BODY><H1>"); 124 buf.append(getShortDescription()); 125 buf.append("</H1>\n"); 126 buf.append(getDetailText()); 127 buf.append("</BODY></HTML>\n"); 128 detailHTML = buf.toString(); 129 } 130 return detailHTML; 131 } 132 133 public int compareTo(BugPattern other) { 134 return type.compareTo(other.type); 135 } 136 137 @Override  138 public int hashCode() { 139 return type.hashCode(); 140 } 141 142 @Override  143 public boolean equals(Object o) { 144 if (!(o instanceof BugPattern)) 145 return false; 146 BugPattern other = (BugPattern) o; 147 return type.equals(other.type); 148 } 149 150 } 151 152 | Popular Tags |