forked from mozilla-services/socorro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove trailing whitespace from uncompressed text files
- Loading branch information
Showing
559 changed files
with
37,402 additions
and
37,402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* the Initial Developer. All Rights Reserved. | ||
* | ||
* Contributor(s): | ||
* | ||
* | ||
* Xavier Stevens <[email protected]>, Mozilla Corporation (original author) | ||
* | ||
* Alternatively, the contents of this file may be used under the terms of | ||
|
@@ -44,18 +44,18 @@ public class CorrelationReport { | |
private String product = null; | ||
private String productVersion = null; | ||
private OperatingSystem os = null; | ||
|
||
public CorrelationReport(String product, String productVersion, String os) { | ||
this.product = product; | ||
this.productVersion = productVersion; | ||
this.os = new OperatingSystem(os); | ||
} | ||
|
||
public CorrelationReport(String product, String productVersion, String os, String signature) { | ||
this(product, productVersion, os); | ||
this.os.addSignature(signature, new Signature(signature)); | ||
} | ||
|
||
public String getProduct() { | ||
return product; | ||
} | ||
|
@@ -79,45 +79,45 @@ public OperatingSystem getOs() { | |
public void setOs(OperatingSystem os) { | ||
this.os = os; | ||
} | ||
|
||
public void calculateModuleRatios() { | ||
Map<String, Signature> signatures = os.getSignatures(); | ||
Map<String, Module> osModuleMap = os.getModuleCounts(); | ||
Map<String, Module> osAddonMap = os.getAddonCounts(); | ||
for (Map.Entry<String, Signature> sigEntry : signatures.entrySet()) { | ||
Signature sig = sigEntry.getValue(); | ||
|
||
Map<String, Module> modules = sig.getModuleCounts(); | ||
for (Map.Entry<String, Module> moduleEntry : modules.entrySet()) { | ||
Module m = moduleEntry.getValue(); | ||
float sigRatio = sig.getCount() > 0 ? (float)m.getCount() / (float)sig.getCount() : 0.0f; | ||
int osCount = osModuleMap.get(moduleEntry.getKey()).getCount(); | ||
float osRatio = os.getCount() > 0 ? (float)osCount / (float)os.getCount() : 0.0f; | ||
|
||
m.setSigRatio(sigRatio); | ||
m.setOsRatio(osRatio); | ||
|
||
modules.put(moduleEntry.getKey(), m); | ||
} | ||
sig.setModuleCounts(modules); | ||
|
||
Map<String, Module> addons = sig.getAddonCounts(); | ||
for (Map.Entry<String, Module> addonEntry : addons.entrySet()) { | ||
Module m = addonEntry.getValue(); | ||
float sigRatio = sig.getCount() > 0 ? (float)m.getCount() / (float)sig.getCount() : 0.0f; | ||
int osCount = osAddonMap.get(addonEntry.getKey()).getCount(); | ||
float osRatio = os.getCount() > 0 ? (float)osCount / (float)os.getCount() : 0.0f; | ||
|
||
m.setSigRatio(sigRatio); | ||
m.setOsRatio(osRatio); | ||
|
||
addons.put(addonEntry.getKey(), m); | ||
} | ||
sig.setAddonCounts(addons); | ||
|
||
signatures.put(sigEntry.getKey(), sig); | ||
} | ||
|
||
os.setSignatures(signatures); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* the Initial Developer. All Rights Reserved. | ||
* | ||
* Contributor(s): | ||
* | ||
* | ||
* Xavier Stevens <[email protected]>, Mozilla Corporation (original author) | ||
* | ||
* Alternatively, the contents of this file may be used under the terms of | ||
|
@@ -47,47 +47,47 @@ | |
import com.mozilla.util.MapValueComparator; | ||
|
||
public class Module { | ||
|
||
private String name; | ||
private int count; | ||
private float sigRatio = 0.0f; | ||
private float osRatio = 0.0f; | ||
private Map<String, Integer> versionCounts = new HashMap<String, Integer>(); | ||
|
||
public Module(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public int getCount() { | ||
return count; | ||
} | ||
|
||
public void setCount(int count) { | ||
this.count = count; | ||
} | ||
|
||
public Map<String, Integer> getVersionCounts() { | ||
return versionCounts; | ||
} | ||
|
||
public List<Map.Entry<String, Integer>> getSortedVersionCounts() { | ||
List<Map.Entry<String, Integer>> versionPairs = new ArrayList<Map.Entry<String, Integer>>(versionCounts.entrySet()); | ||
Collections.sort(versionPairs, Collections.reverseOrder(new MapValueComparator())); | ||
Collections.sort(versionPairs, Collections.reverseOrder(new MapValueComparator())); | ||
return versionPairs; | ||
} | ||
|
||
public void incrementVersionCount(String moduleVersion, int count) { | ||
int existingCount = 0; | ||
if (versionCounts.containsKey(moduleVersion)) { | ||
existingCount = versionCounts.get(moduleVersion); | ||
} | ||
versionCounts.put(moduleVersion, existingCount + count); | ||
} | ||
|
||
public void setVersionCounts(Map<String, Integer> versionCounts) { | ||
this.versionCounts = versionCounts; | ||
} | ||
|
@@ -107,16 +107,16 @@ public float getOsRatio() { | |
public void setOsRatio(float osRatio) { | ||
this.osRatio = osRatio; | ||
} | ||
|
||
public static class ModuleComparator implements Comparator<Module> { | ||
|
||
public int compare(Module o1, Module o2) { | ||
float diffRatio1 = o1.getSigRatio() - o1.getOsRatio(); | ||
float diffRatio2 = o2.getSigRatio() - o2.getOsRatio(); | ||
|
||
return diffRatio1 < diffRatio2 ? -1 : diffRatio1 > diffRatio2 ? 1 : 0; | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.