Adds more visibility to the code

This commit is contained in:
Fuzzlemann 2017-08-01 19:38:43 +02:00
parent 36574ec4e2
commit f7941fd59f

View File

@ -162,7 +162,10 @@ public class AnalysisUtils {
* @return
*/
public static String getBooleanPercentage(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
if (analysisType == AnalysisType.BOOLEAN_PERCENTAGE) {
if (analysisType != AnalysisType.BOOLEAN_PERCENTAGE) {
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
}
try {
List<Boolean> tempList = getCorrectValues(uuids, source)
.map(value -> (boolean) value)
@ -173,8 +176,6 @@ public class AnalysisUtils {
return logPluginDataCausedError(source, e);
}
}
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
}
/**
* @param analysisType
@ -183,7 +184,10 @@ public class AnalysisUtils {
* @return
*/
public static String getBooleanTotal(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
if (analysisType == AnalysisType.BOOLEAN_TOTAL) {
if (analysisType != AnalysisType.BOOLEAN_TOTAL) {
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
}
try {
List<Boolean> tempList = getCorrectValues(uuids, source)
.map(value -> (boolean) value)
@ -194,8 +198,6 @@ public class AnalysisUtils {
return logPluginDataCausedError(source, e);
}
}
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
}
private static String logPluginDataCausedError(PluginData source, Throwable e) {
Log.error("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""));
@ -214,6 +216,7 @@ public class AnalysisUtils {
public static int getUniqueJoins(Map<UUID, List<SessionData>> sessions, long scale) {
long now = MiscUtils.getTime();
long nowMinusScale = now - scale;
Set<UUID> uniqueJoins = new HashSet<>();
sessions.forEach((uuid, s) ->
s.stream()
@ -221,6 +224,7 @@ public class AnalysisUtils {
.map(session -> uuid)
.forEach(uniqueJoins::add)
);
return uniqueJoins.size();
}