38 |
|
|
39 |
package gnu.CORBA.DynAn; |
package gnu.CORBA.DynAn; |
40 |
|
|
41 |
import gnu.CORBA.CDR.cdrBufOutput; |
import gnu.CORBA.CDR.BufferedCdrOutput; |
42 |
import gnu.CORBA.OctetHolder; |
import gnu.CORBA.OctetHolder; |
43 |
import gnu.CORBA.Unexpected; |
import gnu.CORBA.Unexpected; |
44 |
import gnu.CORBA.WCharHolder; |
import gnu.CORBA.WCharHolder; |
45 |
import gnu.CORBA.WStringHolder; |
import gnu.CORBA.WStringHolder; |
46 |
import gnu.CORBA.holderFactory; |
import gnu.CORBA.HolderLocator; |
47 |
import gnu.CORBA.typeNamer; |
import gnu.CORBA.TypeKindNamer; |
48 |
import gnu.CORBA.universalHolder; |
import gnu.CORBA.GeneralHolder; |
49 |
|
|
50 |
import org.omg.CORBA.Any; |
import org.omg.CORBA.Any; |
51 |
import org.omg.CORBA.AnyHolder; |
import org.omg.CORBA.AnyHolder; |
84 |
* |
* |
85 |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) |
86 |
*/ |
*/ |
87 |
public class gnuDynAny extends abstractDynAny implements DynAny, Serializable |
public class gnuDynAny extends AbstractAny implements DynAny, Serializable |
88 |
{ |
{ |
89 |
/** |
/** |
90 |
* Use serialVersionUID for interoperability. |
* Use serialVersionUID for interoperability. |
132 |
{ |
{ |
133 |
if (holder != null) |
if (holder != null) |
134 |
{ |
{ |
135 |
cdrBufOutput buffer = new cdrBufOutput(); |
BufferedCdrOutput buffer = new BufferedCdrOutput(); |
136 |
holder._write(buffer); |
holder._write(buffer); |
137 |
|
|
138 |
gnuDynAny other; |
gnuDynAny other; |
165 |
public DynAny current_component() throws TypeMismatch |
public DynAny current_component() throws TypeMismatch |
166 |
{ |
{ |
167 |
throw new TypeMismatch("Not applicable for " + |
throw new TypeMismatch("Not applicable for " + |
168 |
typeNamer.nameIt(final_type) |
TypeKindNamer.nameIt(final_type) |
169 |
); |
); |
170 |
} |
} |
171 |
|
|
193 |
{ |
{ |
194 |
throw new InvalidValue(ISNULL); |
throw new InvalidValue(ISNULL); |
195 |
} |
} |
196 |
else if (a_holder instanceof universalHolder) |
else if (a_holder instanceof GeneralHolder) |
197 |
{ |
{ |
198 |
holder = holderFactory.createHolder(official_type); |
holder = HolderLocator.createHolder(official_type); |
199 |
if (holder == null) |
if (holder == null) |
200 |
holder = holderFactory.createHolder(final_type); |
holder = HolderLocator.createHolder(final_type); |
201 |
|
|
202 |
if (holder == null) |
if (holder == null) |
203 |
holder = ((universalHolder) a_holder).Clone(); |
holder = ((GeneralHolder) a_holder).Clone(); |
204 |
else |
else |
205 |
{ |
{ |
206 |
InputStream in = an_any.create_input_stream(); |
InputStream in = an_any.create_input_stream(); |
890 |
*/ |
*/ |
891 |
public boolean equal(DynAny other) |
public boolean equal(DynAny other) |
892 |
{ |
{ |
893 |
if (other instanceof abstractDynAny) |
if (other instanceof AbstractAny) |
894 |
{ |
{ |
895 |
if (other instanceof gnuDynAny) |
if (other instanceof gnuDynAny) |
896 |
{ |
{ |
899 |
if (!x.holder.getClass().equals(holder.getClass())) |
if (!x.holder.getClass().equals(holder.getClass())) |
900 |
return false; |
return false; |
901 |
|
|
902 |
cdrBufOutput b1 = new cdrBufOutput(); |
BufferedCdrOutput b1 = new BufferedCdrOutput(); |
903 |
x.holder._write(b1); |
x.holder._write(b1); |
904 |
|
|
905 |
cdrBufOutput b2 = new cdrBufOutput(b1.buffer.size() + 10); |
BufferedCdrOutput b2 = new BufferedCdrOutput(b1.buffer.size() + 10); |
906 |
holder._write(b2); |
holder._write(b2); |
907 |
|
|
908 |
return Arrays.equals(b1.buffer.toByteArray(), |
return Arrays.equals(b1.buffer.toByteArray(), |