public void computeFileStats(BugCollection bugs) { if (bugs.getProjectStats() != this) { throw new IllegalArgumentException("Collection doesn't own stats"); } fileBugHashes = FileBugHash.compute(bugs); }
public Map<String, String> getFileHashes(BugCollection bugs) { if (bugs.getProjectStats() != this) { throw new IllegalArgumentException("Collection doesn't own stats"); } if (fileBugHashes == null) { computeFileStats(bugs); } HashMap<String, String> result = new HashMap<>(); for (String sourceFile : fileBugHashes.getSourceFiles()) { result.put(sourceFile, fileBugHashes.getHash(sourceFile)); } return result; }
HashSet<String> sourceFilesInCollection(BugCollection collection) { HashSet<String> result = new HashSet<>(); for (PackageStats pStats : collection.getProjectStats().getPackageStats()) { for (ClassStats cStats : pStats.getClassStats()) { result.add(cStats.getSourceFile()); } } return result; }
FileBugHash(BugCollection bugs) { for (PackageStats pStat : bugs.getProjectStats().getPackageStats()) { for (ClassStats cStat : pStat.getSortedClassStats()) { String path = cStat.getName();
public void generateTreeMap(BugCollection bugCollection) { for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() > 0) { buggyPackages.add(p.getPackageName()); for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() == 0) { cleanCode(p.getPackageName(), p.size(), p.getClassStats().size()); for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() > 0) { int high = p.getBugsAtPriority(Priorities.HIGH_PRIORITY);
for (PackageStats ps : origCollection.getProjectStats().getPackageStats()) { String prefix = ClassName.extractPackagePrefix(ps.getPackageName(), prefixLength);
String totalClasses = getOptionalAttribute(attributes, "total_classes"); if (totalClasses != null && totalClasses.length() > 0) { bugCollection.getProjectStats().setTotalClasses(Integer.parseInt(totalClasses)); bugCollection.getProjectStats().setTotalSize(Integer.parseInt(totalSize)); bugCollection.getProjectStats().setReferencedClasses(Integer.parseInt(referencedClasses)); bugCollection.getProjectStats().setVMVersion(vmVersion); try { bugCollection.getProjectStats().setTimestamp(timestamp); } catch (java.text.ParseException e) { throw new SAXException("Unparseable sequence number: '" + timestamp + "'", e); int numClasses = Integer.parseInt(getRequiredAttribute(attributes, "total_types", qName)); int size = Integer.parseInt(getRequiredAttribute(attributes, "total_size", qName)); bugCollection.getProjectStats().putPackageStats(packageName, numClasses, size); int size = Integer.parseInt(getRequiredAttribute(attributes, "size", qName)); String sourceFile = getOptionalAttribute(attributes, "sourceFile"); bugCollection.getProjectStats().addClass(className, sourceFile, isInterface, size, false);
origCollectionVersionClone.setTimestamp(origCollectionVersion.getTimestamp()); origCollectionVersionClone.setReleaseName(origCollectionVersion.getReleaseName()); origCollectionVersionClone.setNumClasses(origCollection.getProjectStats().getNumClasses()); origCollectionVersionClone.setCodeSize(origCollection.getProjectStats().getCodeSize()); String sourceFile = classBugFoundIn.getSourceFileName(); boolean fixed = sourceFile != null && analyzedSourceFiles.contains(sourceFile) || newCollection.getProjectStats().getClassStats(className) != null; if (fixed) { if (!copyDeadBugs) { if (origCollection.getProjectStats().getClassStats(className) != null) { newBug.setIntroducedByChangeOfExistingClass(true);
origCollection.readXML(args[argCount]); ProjectStats stats = origCollection.getProjectStats(); printRow("kind", "name", "density/KNCSS", "bugs", "NCSS"); double projectDensity = density(stats.getTotalBugs(), stats.getCodeSize());
/** * Configure the BugCollection (if the BugReporter being used is * constructing one). * * @param findBugs * the IFindBugsEngine */ public static void configureBugCollection(IFindBugsEngine findBugs) { BugCollection bugs = findBugs.getBugReporter().getBugCollection(); if (bugs != null) { bugs.setReleaseName(findBugs.getReleaseName()); Project project = findBugs.getProject(); String projectName = project.getProjectName(); if (projectName == null) { projectName = findBugs.getProjectName(); project.setProjectName(projectName); } long timestamp = project.getTimestamp(); if (FindBugs.validTimestamp(timestamp)) { bugs.setTimestamp(timestamp); bugs.getProjectStats().setTimestamp(timestamp); } } }
public void computeFileStats(BugCollection bugs) { if (bugs.getProjectStats() != this) { throw new IllegalArgumentException("Collection doesn't own stats"); } fileBugHashes = FileBugHash.compute(bugs); }
public Map<String, String> getFileHashes(BugCollection bugs) { if (bugs.getProjectStats() != this) { throw new IllegalArgumentException("Collection doesn't own stats"); } if (fileBugHashes == null) { computeFileStats(bugs); } HashMap<String, String> result = new HashMap<String, String>(); for (String sourceFile : fileBugHashes.getSourceFiles()) { result.put(sourceFile, fileBugHashes.getHash(sourceFile)); } return result; }
HashSet<String> sourceFilesInCollection(BugCollection collection) { HashSet<String> result = new HashSet<String>(); for (PackageStats pStats : collection.getProjectStats().getPackageStats()) { for (ClassStats cStats : pStats.getClassStats()) { result.add(cStats.getSourceFile()); } } return result; }
FileBugHash(BugCollection bugs) { for (PackageStats pStat : bugs.getProjectStats().getPackageStats()) { for (ClassStats cStat : pStat.getSortedClassStats()) { String path = cStat.getName();
for (PackageStats ps : origCollection.getProjectStats().getPackageStats()) { String prefix = ClassName.extractPackagePrefix(ps.getPackageName(), prefixLength);
public void generateTreeMap(BugCollection bugCollection) { for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() > 0) { buggyPackages.add(p.getPackageName()); for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() == 0) { cleanCode(p.getPackageName(), p.size(), p.getClassStats().size()); for (PackageStats p : bugCollection.getProjectStats().getPackageStats()) { if (p.getTotalBugs() > 0) { int high = p.getBugsAtPriority(Priorities.HIGH_PRIORITY);
int classCount = 0; int ncss = 0; ProjectStats projectStats = bugCollection.getProjectStats(); for (PackageStats ps : projectStats.getPackageStats()) { int num = ps.getNumClasses();
origCollectionVersionClone.setTimestamp(origCollectionVersion.getTimestamp()); origCollectionVersionClone.setReleaseName(origCollectionVersion.getReleaseName()); origCollectionVersionClone.setNumClasses(origCollection.getProjectStats().getNumClasses()); origCollectionVersionClone.setCodeSize(origCollection.getProjectStats().getCodeSize()); String sourceFile = classBugFoundIn.getSourceFileName(); boolean fixed = sourceFile != null && analyzedSourceFiles.contains(sourceFile) || newCollection.getProjectStats().getClassStats(className) != null; if (fixed) { if (!copyDeadBugs) { if (origCollection.getProjectStats().getClassStats(className) != null) { newBug.setIntroducedByChangeOfExistingClass(true);
origCollection.readXML(args[argCount]); ProjectStats stats = origCollection.getProjectStats(); printRow("kind", "name", "density/KNCSS", "bugs", "NCSS"); double projectDensity = density(stats.getTotalBugs(), stats.getCodeSize());
/** * Configure the BugCollection (if the BugReporter being used is * constructing one). * * @param findBugs * the IFindBugsEngine */ public static void configureBugCollection(IFindBugsEngine findBugs) { BugCollection bugs = findBugs.getBugReporter().getBugCollection(); if (bugs != null) { bugs.setReleaseName(findBugs.getReleaseName()); Project project = findBugs.getProject(); String projectName = project.getProjectName(); if (projectName == null) { projectName = findBugs.getProjectName(); project.setProjectName(projectName); } long timestamp = project.getTimestamp(); if (FindBugs.validTimestamp(timestamp)) { bugs.setTimestamp(timestamp); bugs.getProjectStats().setTimestamp(timestamp); } } }