|
|||||||||||||||||||
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 | |||||||||||||||
IntegerData.java | 0% | 46,7% | 57,1% | 45,8% |
|
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.IDecimalData; |
|
15 |
import org.jbind.xml.core.data.IIntegerData; |
|
16 |
import org.jbind.xml.msg.IConstraintViolations; |
|
17 |
import org.jbind.xml.msg.XmlException; |
|
18 |
import org.jbind.xml.msg.XmlMessages; |
|
19 |
|
|
20 |
public class IntegerData extends AbstractIntegerData { |
|
21 |
|
|
22 |
private BigInteger myValue = null; |
|
23 |
|
|
24 | 19 |
public BigInteger getBigInteger() { |
25 | 19 |
return myValue; |
26 |
} |
|
27 |
|
|
28 | 0 |
public void setBigInteger(BigInteger aNewValue) throws XmlException { |
29 | 0 |
BigInteger oldValue = myValue; |
30 | 0 |
myValue = aNewValue; |
31 | 0 |
IConstraintViolations violations = completeSimpleStorageAssignment_(); |
32 | 0 |
if (!violations.isEmpty()) { |
33 | 0 |
myValue = oldValue; |
34 | 0 |
throw new XmlException(violations); |
35 |
} |
|
36 |
} |
|
37 |
|
|
38 | 10 |
public int compareSubTypeData_(IDecimalData aData) { |
39 | 10 |
return myValue.compareTo(((IIntegerData)aData).getBigInteger()); |
40 |
} |
|
41 |
|
|
42 | 45 |
public void doAccept(String aString) throws XmlException { |
43 | 45 |
super.doAccept(aString); |
44 | 45 |
try { |
45 | 45 |
myValue = new BigInteger(aString); |
46 |
} catch (NumberFormatException e) { |
|
47 | 4 |
throw new XmlException(XmlMessages.simpleDataConversionException(aString, e, getImpl_())); |
48 |
} |
|
49 |
} |
|
50 |
|
|
51 | 55 |
public String getCanonicalForm_() { |
52 | 55 |
return String.valueOf(myValue); |
53 |
} |
|
54 |
|
|
55 | 0 |
public Object getSimpleStorageObject() { |
56 | 0 |
return myValue; |
57 |
} |
|
58 |
|
|
59 | 0 |
public void setSimpleStorageObject(Object aValue) { |
60 | 0 |
myValue = (BigInteger)aValue; |
61 |
} |
|
62 |
|
|
63 |
} |
|
64 |
|
|