From be00fd4fcfda8558a8dbf7bf46938b98dc548bc9 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 29 Sep 2015 07:33:25 +0200 Subject: [PATCH] Make initRanges() private Sonar warngs about the method being overridable. Change-Id: Ie804bd50d71b0935a87cffc2a0f0bc1e79de2ed0 Signed-off-by: Robert Varga --- ...64SpecificationEffectiveStatementImpl.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Decimal64SpecificationEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Decimal64SpecificationEffectiveStatementImpl.java index 18fb22ced1..4fc93446eb 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Decimal64SpecificationEffectiveStatementImpl.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/Decimal64SpecificationEffectiveStatementImpl.java @@ -38,8 +38,7 @@ public class Decimal64SpecificationEffectiveStatementImpl extends private static final String UNITS = ""; private static final BigDecimal DEFAULT_VALUE = null; - private static final QName QNAME = QName.create( - YangConstants.RFC6020_YANG_MODULE, TypeUtils.DECIMAL64); + private static final QName QNAME = QName.create(YangConstants.RFC6020_YANG_MODULE, TypeUtils.DECIMAL64); private static final String DESCRIPTION = "The decimal64 type represents a subset of the real numbers, which can " + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can " @@ -47,10 +46,8 @@ public class Decimal64SpecificationEffectiveStatementImpl extends + "'i x 10^-n' where i is an integer64 and n is an integer between 1 and 18, inclusively."; private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.3"; - private static final BigDecimal MIN_VALUE = new BigDecimal( - "-922337203685477580.8"); - private static final BigDecimal MAX_VALUE = new BigDecimal( - "922337203685477580.7"); + private static final BigDecimal MIN_VALUE = new BigDecimal("-922337203685477580.8"); + private static final BigDecimal MAX_VALUE = new BigDecimal("922337203685477580.7"); private static final List DEFAULT_RANGE_STATEMENTS; static { final String rangeDescription = "Integer values between " + MIN_VALUE @@ -103,20 +100,17 @@ public class Decimal64SpecificationEffectiveStatementImpl extends String maxValueString = rangeConstraint.getMax().toString(); String minValueString = rangeConstraint.getMin().toString(); - if ((!maxValueString.equals("max") && new BigDecimal(maxValueString) - .compareTo(MAX_VALUE) > 0) - || (!minValueString.equals("min") && new BigDecimal( - minValueString).compareTo(MIN_VALUE) < 0)) { + if ((!"max".equals(maxValueString) && MAX_VALUE.compareTo(new BigDecimal(maxValueString)) < 0) + || (!"min".equals(minValueString) && MIN_VALUE.compareTo(new BigDecimal(minValueString)) > 0)) { return false; } } return true; } - protected List initRanges() { + private List initRanges() { final RangeEffectiveStatementImpl rangeConstraints = firstEffective(RangeEffectiveStatementImpl.class); - return rangeConstraints != null ? rangeConstraints.argument() - : Collections. emptyList(); + return rangeConstraints != null ? rangeConstraints.argument() : Collections. emptyList(); } public boolean isExtended() { @@ -135,7 +129,7 @@ public class Decimal64SpecificationEffectiveStatementImpl extends @Override public DecimalTypeDefinition getBaseType() { - if(isExtended) { + if (isExtended) { if (decimal64Instance == null) { decimal64Instance = Decimal64.create(path, fractionDigits); } @@ -211,10 +205,8 @@ public class Decimal64SpecificationEffectiveStatementImpl extends @Override public String toString() { - return Decimal64SpecificationEffectiveStatementImpl.class - .getSimpleName() - + "[qName=" + QNAME - + ", fractionDigits=" + fractionDigits + "]"; + return Decimal64SpecificationEffectiveStatementImpl.class.getSimpleName() + + "[qName=" + QNAME + ", fractionDigits=" + fractionDigits + "]"; } @Override -- 2.36.6