43 |
import org.omg.CORBA.BAD_PARAM; |
import org.omg.CORBA.BAD_PARAM; |
44 |
import org.omg.CORBA.ORB; |
import org.omg.CORBA.ORB; |
45 |
import org.omg.CORBA.TypeCode; |
import org.omg.CORBA.TypeCode; |
|
import org.omg.CORBA.TypeCodePackage.*; |
|
46 |
import org.omg.DynamicAny.DynAny; |
import org.omg.DynamicAny.DynAny; |
47 |
import org.omg.DynamicAny.DynAnyPackage.InvalidValue; |
import org.omg.DynamicAny.DynAnyPackage.InvalidValue; |
48 |
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; |
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; |
57 |
* |
* |
58 |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
59 |
*/ |
*/ |
60 |
public class gnuDynFixed |
public class gnuDynFixed extends anyUndivideable implements DynFixed |
|
extends anyUndivideable |
|
|
implements DynFixed |
|
61 |
{ |
{ |
62 |
/** |
/** |
63 |
* Use serialVersionUID for interoperability. |
* Use serialVersionUID for interoperability. |
87 |
/** |
/** |
88 |
* Create a new instance of the dyn fixed. |
* Create a new instance of the dyn fixed. |
89 |
*/ |
*/ |
90 |
public gnuDynFixed(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory, |
public gnuDynFixed(TypeCode oType, TypeCode aType, |
91 |
ORB anOrb |
gnuDynAnyFactory aFactory, ORB anOrb |
92 |
) |
) |
93 |
{ |
{ |
94 |
super(oType, aType, aFactory, anOrb); |
super(oType, aType, aFactory, anOrb); |
95 |
try |
try |
127 |
* Set the value. |
* Set the value. |
128 |
*/ |
*/ |
129 |
public boolean set_value(String fixed_value) |
public boolean set_value(String fixed_value) |
130 |
throws TypeMismatch, InvalidValue |
throws TypeMismatch, InvalidValue |
131 |
{ |
{ |
132 |
// Count the digits till decimal point. |
// Count the digits till decimal point. |
133 |
int digs = 0; |
int digs = 0; |
149 |
} |
} |
150 |
if (digs > (digits - scale)) |
if (digs > (digits - scale)) |
151 |
throw new InvalidValue("Too many digits: " + digs + " for " + digits + |
throw new InvalidValue("Too many digits: " + digs + " for " + digits + |
152 |
"." + scale |
"." + scale |
153 |
); |
); |
154 |
|
|
155 |
try |
try |
156 |
{ |
{ |
174 |
/** |
/** |
175 |
* Assign the value from another BigDecimal. |
* Assign the value from another BigDecimal. |
176 |
*/ |
*/ |
177 |
public void assign(DynAny from) |
public void assign(DynAny from) throws TypeMismatch |
|
throws TypeMismatch |
|
178 |
{ |
{ |
179 |
checkType(official_type, from.type()); |
checkType(official_type, from.type()); |
180 |
|
|
223 |
* Set the value from Any (must hold <code>fixed</code> with the matching |
* Set the value from Any (must hold <code>fixed</code> with the matching |
224 |
* typecode.). |
* typecode.). |
225 |
*/ |
*/ |
226 |
public void from_any(Any an_any) |
public void from_any(Any an_any) throws TypeMismatch, InvalidValue |
|
throws TypeMismatch, InvalidValue |
|
227 |
{ |
{ |
228 |
try |
try |
229 |
{ |
{ |