📄 gnudynany.java
字号:
{ return ((WStringHolder) holder).value; } catch (ClassCastException cex) { TypeMismatch m = new TypeMismatch(); m.initCause(cex); throw m; } } /** {@inheritDoc} */ public void insert_any(Any a_x) throws TypeMismatch, InvalidValue { try { if (a_x.type().kind().value() == TCKind._tk_null) ((AnyHolder) holder).value = a_x; else { OutputStream buf = a_x.create_output_stream(); buf.write_any(a_x); holder._read(buf.create_input_stream()); buf.close(); } valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } catch (MARSHAL m) { InvalidValue v = new InvalidValue(); v.initCause(m); throw v; } catch (IOException ex) { throw new Unexpected(ex); } } /** {@inheritDoc} */ public void insert_boolean(boolean a_x) throws InvalidValue, TypeMismatch { try { ((BooleanHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_char(char a_x) throws InvalidValue, TypeMismatch { try { ((CharHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_double(double a_x) throws InvalidValue, TypeMismatch { try { ((DoubleHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_float(float a_x) throws InvalidValue, TypeMismatch { try { ((FloatHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_long(int a_x) throws InvalidValue, TypeMismatch { try { ((IntHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_longlong(long a_x) throws InvalidValue, TypeMismatch { try { ((LongHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_octet(byte a_x) throws InvalidValue, TypeMismatch { try { ((OctetHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_reference(Object a_x) throws InvalidValue, TypeMismatch { try { ((ObjectHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_short(short a_x) throws InvalidValue, TypeMismatch { try { ((ShortHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_string(String a_x) throws InvalidValue, TypeMismatch { try { if (a_x != null && final_type.length() > 0 && a_x.length() > final_type.length() ) throw new InvalidValue(a_x.length() + " exceeds bound, " + final_type.length() ); ((StringHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } catch (BadKind e) { TypeMismatch t = new TypeMismatch(); t.initCause(e); throw t; } } /** {@inheritDoc} */ public void insert_typecode(TypeCode a_x) throws InvalidValue, TypeMismatch { try { ((TypeCodeHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_ulong(int a_x) throws InvalidValue, TypeMismatch { try { ((IntHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_ulonglong(long a_x) throws InvalidValue, TypeMismatch { try { ((LongHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_ushort(short a_x) throws InvalidValue, TypeMismatch { try { ((ShortHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_val(Serializable a_x) throws InvalidValue, TypeMismatch { try { ((ValueBaseHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_wchar(char a_x) throws InvalidValue, TypeMismatch { try { ((WCharHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } } /** {@inheritDoc} */ public void insert_wstring(String a_x) throws InvalidValue, TypeMismatch { try { if (a_x != null && final_type.length() > 0 && a_x.length() > type().length() ) throw new InvalidValue(a_x.length() + " exceeds bound, " + final_type.length() ); ((WStringHolder) holder).value = a_x; valueChanged(); } catch (ClassCastException cex) { TypeMismatch t = new TypeMismatch(); t.initCause(cex); throw t; } catch (BadKind e) { TypeMismatch t = new TypeMismatch(); t.initCause(e); throw t; } } /** * The objects, enclosed inside this class, have only one component (self). * * @return false, always (no other action). */ public boolean next() { return false; } /** * Returns without action. */ public void rewind() { } /** * This objects, stored in this wrapper, never have multiple internal * components to seek. * * @return false, always (no other action). */ public boolean seek(int p) { return false; } /** * Returns the enclosed {@link Any}. * * @return the enclosed {@link Any}. */ public Any to_any() { Any a = createAny(); a.insert_Streamable(holder); a.type(official_type); return a; } /** {@inheritDoc} */ public TypeCode type() { return official_type; } /** * Compute hashcode in a trivial way. */ protected int getHashCodeSimple(int maximum) { int h = super.hashCode() / 2; if (h < 0) h = -h; return h % maximum; } /** * Inserts Any, contained in the parameter, into Any, contained in this * DynAny. */ public void insert_dyn_any(DynAny d) throws TypeMismatch, InvalidValue { check(d.type().kind()); Any a = d.to_any(); holder = a.extract_Streamable(); valueChanged(); } /** * Checks for equality. The DynAnys are equal if the stored Anys are equal. */ public boolean equal(DynAny other) { if (other instanceof AbstractAny) { if (other instanceof gnuDynAny) { gnuDynAny x = (gnuDynAny) other; if (!x.holder.getClass().equals(holder.getClass())) return false; BufferedCdrOutput b1 = new BufferedCdrOutput(); x.holder._write(b1); BufferedCdrOutput b2 = new BufferedCdrOutput(b1.buffer.size() + 10); holder._write(b2); return Arrays.equals(b1.buffer.toByteArray(), b2.buffer.toByteArray() ); } else return false; } if (other == null) return false; else if (other.component_count() != component_count() || !official_type.equal(other.type()) ) return false; else return other.to_any().equal(to_any()); } /** * This final_type has no components. * * @return 0, always. */ public int component_count() { return 0; } public DynAny get_dyn_any() throws TypeMismatch, InvalidValue { return new gnuDynAny(holder, official_type, final_type, factory, orb); } private void check(TCKind t) throws TypeMismatch { if (t.value() != final_type.kind().value()) throw new TypeMismatch(t.value() + "!=" + final_type.kind().value()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -