|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AbstractUnsignedIntData.java | 0% | 16,7% | 50% | 16,7% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml.instance.data; |
|
| 11 |
|
|
| 12 |
import java.math.BigInteger; |
|
| 13 |
|
|
| 14 |
import org.jbind.xml.core.data.IUnsignedIntData; |
|
| 15 |
import org.jbind.xml.msg.XmlException; |
|
| 16 |
import org.jbind.xml.msg.XmlMessages; |
|
| 17 |
|
|
| 18 |
public abstract class AbstractUnsignedIntData extends AbstractIntegerData implements IUnsignedIntData {
|
|
| 19 |
|
|
| 20 |
private final static BigInteger ourMaxUnsignedInt = new BigInteger("4294967295");
|
|
| 21 |
|
|
| 22 | 3 |
public BigInteger getBigInteger() {
|
| 23 | 3 |
return new BigInteger(getCanonicalForm_()); |
| 24 |
} |
|
| 25 |
|
|
| 26 | 0 |
public void setBigInteger(BigInteger aValue) throws XmlException {
|
| 27 | 0 |
if (aValue.compareTo(ourMaxUnsignedInt) > 0) {
|
| 28 | 0 |
throw new XmlException(XmlMessages.numberTooLarge(String.valueOf(aValue), null)); |
| 29 |
} |
|
| 30 | 0 |
if (aValue.signum() < 0) {
|
| 31 | 0 |
throw new XmlException(XmlMessages.numberTooSmall(String.valueOf(aValue), null)); |
| 32 |
} |
|
| 33 | 0 |
setLong(aValue.longValue()); |
| 34 |
} |
|
| 35 |
|
|
| 36 |
} |
|
| 37 |
|
|
||||||||||