Add Decimal64.{int,long,short}ValueExact() 58/66758/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 25 Dec 2017 11:58:44 +0000 (12:58 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 25 Dec 2017 16:02:00 +0000 (17:02 +0100)
commit6263890e48e422156cf083d2120ccd180d51dcde
tree6c66d20aebdbc74fe0359fdd47404ad7d71e35ea
parentfb2e696ec70adf28bf63fd9d15c01c4d35faba42
Add Decimal64.{int,long,short}ValueExact()

Add alternative methods which prevent loss of precision by throwing
ArithmeticException. Testing has revealed that valueOf(Integer.MIN_VALUE)
does not work correctly due to the fact negation does results in incorrect
bitmask -- which is fixed by widening conversion.

Change-Id: I206ced685d2edb753507f5d45e29bb6b405ff421
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Decimal64.java
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/Decimal64Test.java