}
private static int length(BatchReport.Range range) {
- return range.getEndLine() - range.getStartLine() + 1;
+ return (range.getEndLine() - range.getStartLine()) + 1;
}
private Map<BatchReport.Range, Integer> createDuplicationIdsByRange(List<BatchReport.Duplication> duplications) {
return input != null && input.getKey().equals(dto.getKey());
}
});
- Integer nextPosition = moveUpOrDown ? (currentPosition > 0 ? currentPosition - 1 : null) : (currentPosition < rootCharacteristics.size() - 1 ? currentPosition + 1 : null);
- return nextPosition != null ? Iterables.get(rootCharacteristics, nextPosition) : null;
+ Integer nextPosition = moveUpOrDown ?
+ ((currentPosition > 0) ? (currentPosition - 1) : null) :
+ ((currentPosition < (rootCharacteristics.size() - 1)) ? (currentPosition + 1) : null);
+ return (nextPosition != null) ? Iterables.get(rootCharacteristics, nextPosition) : null;
}
/**
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+
import java.util.Arrays;
import java.util.List;
if (!Arrays.equals(l10nParams, message.l10nParams)) {
return false;
}
- if (text != null ? !text.equals(message.text) : message.text != null) {
+ if ((text != null) ? !text.equals(message.text) : (message.text != null)) {
return false;
}
return true;
public class MeasureFilterResult {
- public static enum Error {
+ public enum Error {
UNKNOWN, VALUE_SHOULD_BE_A_NUMBER
}
private String getMetricColumn() {
if (metric.isNumericType()) {
- return period != null ? "pmsort.variation_value_" + period : "pmsort.value";
+ return (period != null) ? ("pmsort.variation_value_" + period) : "pmsort.value";
} else {
return "pmsort.text_value";
}
public void add(@Nullable E key, Long value) {
if (key != null) {
Long currentValue = sumByKeys.get(key);
- sumByKeys.put(key, currentValue != null ? currentValue + value : value);
+ sumByKeys.put(key, (currentValue != null) ? (currentValue + value) : value);
}
}
}
ActionPlanDto actionPlanDto = (ActionPlanDto) o;
- return !(id != null ? !id.equals(actionPlanDto.id) : actionPlanDto.id != null);
+ return !((id != null) ? !id.equals(actionPlanDto.id) : (actionPlanDto.id != null));
}
@Override
DefaultCharacteristic that = (DefaultCharacteristic) o;
- if (key != null ? !key.equals(that.key) : that.key != null) {
+ if ((key != null) ? !key.equals(that.key) : (that.key != null)) {
return false;
}
return !(ruleKey != null ? !ruleKey.equals(that.ruleKey) : that.ruleKey != null);
@Override
public int hashCode() {
- int result = key != null ? key.hashCode() : 0;
- result = 31 * result + (ruleKey != null ? ruleKey.hashCode() : 0);
+ int result = (key != null) ? key.hashCode() : 0;
+ result = 31 * result + ((ruleKey != null) ? ruleKey.hashCode() : 0);
return result;
}
import org.sonar.api.i18n.I18n;
import javax.annotation.CheckForNull;
+
import java.util.Locale;
/**
private String format(Locale locale, int days, int hours, int minutes, boolean isNegative){
StringBuilder message = new StringBuilder();
if (days > 0) {
- message.append(message(locale, "work_duration.x_days", isNegative ? -1 * days : days));
+ message.append(message(locale, "work_duration.x_days", isNegative ? (-1 * days) : days));
}
if (displayHours(days, hours)) {
addSpaceIfNeeded(message);
- message.append(message(locale, "work_duration.x_hours", isNegative && message.length() == 0 ? -1 * hours : hours));
+ message.append(message(locale, "work_duration.x_hours", (isNegative && message.length() == 0) ? (-1 * hours) : hours));
}
if (displayMinutes(days, hours, minutes)) {
addSpaceIfNeeded(message);
- message.append(message(locale, "work_duration.x_minutes", isNegative && message.length() == 0 ? -1 * minutes : minutes));
+ message.append(message(locale, "work_duration.x_minutes", (isNegative && message.length() == 0) ? (-1 * minutes) : minutes));
}
return message.toString();
}