⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnuany.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  }  /** {@inheritDoc} */  public char extract_wchar()                     throws BAD_OPERATION  {    check(TCKind._tk_wchar);    return ((WCharHolder) has).value;  }  /** {@inheritDoc} */  public String extract_wstring()                         throws BAD_OPERATION  {    // StringHolder also holds wstrings.    check(TCKind._tk_wstring);    return ((WStringHolder) has).value;  }  /**   * Inserts the CORBA object and sets the typecode to the given type.   */  public void insert_Object(org.omg.CORBA.Object x, TypeCode typecode)  {    has = new ObjectHolder(x);    type(typecode);  }  /**   * Inserts the CORBA object.   */  public void insert_Object(org.omg.CORBA.Object x)  {    has = new ObjectHolder(x);  }  /**   * Insert the CORBA Principal.   * This implementation uses direct assignment, so the later   * alterations of that BigDecimal are reflected on the   * content of this {@link Any}.   *   * @deprecated by CORBA 2.2.   */  public void insert_Principal(Principal x)  {    resetTypes();    if (has instanceof PrincipalHolder)      ((PrincipalHolder) has).value = x;    else      has = new PrincipalHolder(x);  }  /**   * Sets the value to the value, encapsulated in this holder.   * This implementation uses direct assignment, so the later   * alterations of that streamable are reflected on the   * content of this {@link Any}.   */  public void insert_Streamable(Streamable x)  {    resetTypes();    has = x;  }  /**   * Insert the typecode into this Any   * @param typecode the typecode to insert.   */  public void insert_TypeCode(TypeCode typecode)  {    resetTypes();    if (has instanceof TypeCodeHolder)      ((TypeCodeHolder) has).value = typecode;    else      has = new TypeCodeHolder(typecode);  }  /** {@inheritDoc} */  public void insert_Value(Serializable x, TypeCode c_typecode)  {    if (typecode != null && typecode.kind() == TCKind.tk_value_box)      {        has = new gnuValueHolder(x, typecode);      }    else      {        type(typecode);        insert_Value(x);      }  }  /** {@inheritDoc} */  public void insert_Value(Serializable x)  {    if (typecode != null && typecode.kind() == TCKind.tk_value_box)      {        has = new gnuValueHolder(x, typecode);      }    else      {        if (has instanceof ValueBaseHolder)          ((ValueBaseHolder) has).value = x;        else          has = new ValueBaseHolder(x);      }  }  /**  * Insert another {@link Any} into this {@link Any}.  * This implementation uses direct assignment, so the later  * alterations of that {@link Any} are reflected on the  * content of this {@link Any}.  */  public void insert_any(Any an_any)  {    resetTypes();    if (has instanceof AnyHolder)      ((AnyHolder) has).value = an_any;    else      has = new AnyHolder(an_any);  }  /** {@inheritDoc} */  public void insert_boolean(boolean x)  {    resetTypes();    if (has instanceof BooleanHolder)      ((BooleanHolder) has).value = x;    else      has = new BooleanHolder(x);  }  /** {@inheritDoc} */  public void insert_char(char x)  {    resetTypes();    if (has instanceof CharHolder)      ((CharHolder) has).value = x;    else      has = new CharHolder(x);  }  /** {@inheritDoc} */  public void insert_double(double x)  {    resetTypes();    if (has instanceof DoubleHolder)      ((DoubleHolder) has).value = x;    else      has = new DoubleHolder(x);  }  /**   * Inserts the CORBA <code>fixed</code>, setting the typecode   * explicitly.   * This implementation uses direct assignment, so the later   * alterations of that BigDecimal are reflected on the   * content of this {@link Any}.   */  public void insert_fixed(BigDecimal x, TypeCode x_typecode)  {    resetTypes();    insert_fixed(x);    typecode = x_typecode;  }  /**   * Inserts the CORBA <code>fixed</code>, setting the typecode   * by example of the currently passed value.   * This implementation uses direct assignment, so the later   * alterations of that BigDecimal are reflected on the   * content of this {@link Any}, including the typecode.   */  public void insert_fixed(BigDecimal x)  {    resetTypes();    if (has instanceof FixedHolder)      ((FixedHolder) has).value = x;    else      has = new FixedHolder(x);  }  /** {@inheritDoc} */  public void insert_float(float x)  {    resetTypes();    if (has instanceof FloatHolder)      ((FloatHolder) has).value = x;    else      has = new FloatHolder(x);  }  /** {@inheritDoc} */  public void insert_long(int x)  {    resetTypes();    if (has instanceof IntHolder)      ((IntHolder) has).value = x;    else      has = new IntHolder(x);  }  /** {@inheritDoc} */  public void insert_longlong(long x)  {    resetTypes();    if (has instanceof LongHolder)      ((LongHolder) has).value = x;    else      has = new LongHolder(x);  }  /** {@inheritDoc} */  public void insert_octet(byte x)  {    resetTypes();    if (has instanceof OctetHolder)      ((OctetHolder) has).value = x;    else      has = new OctetHolder(x);  }  /** {@inheritDoc} */  public void insert_short(short x)  {    resetTypes();    if (has instanceof ShortHolder)      ((ShortHolder) has).value = x;    else      has = new ShortHolder(x);  }  /** {@inheritDoc} */  public void insert_string(String x)  {    resetTypes();    if (has instanceof StringHolder)      ((StringHolder) has).value = x;    else      has = new StringHolder(x);    typecode = new StringTypeCode(TCKind.tk_string);  }  /** {@inheritDoc} */  public void insert_ulong(int x)  {    resetTypes();    if (has instanceof IntHolder)      ((IntHolder) has).value = x;    else      has = new IntHolder(x);    xKind = TCKind._tk_ulong;  }  /** {@inheritDoc} */  public void insert_ulonglong(long x)  {    resetTypes();    if (has instanceof LongHolder)      ((LongHolder) has).value = x;    else      has = new LongHolder(x);    xKind = TCKind._tk_ulonglong;  }  /** {@inheritDoc} */  public void insert_ushort(short x)  {    resetTypes();    if (has instanceof ShortHolder)      ((ShortHolder) has).value = x;    else      has = new ShortHolder(x);    xKind = TCKind._tk_ushort;  }  /** {@inheritDoc} */  public void insert_wchar(char x)  {    resetTypes();    if (has instanceof WCharHolder)      ((WCharHolder) has).value = x;    else      has = new WCharHolder(x);  }  /** {@inheritDoc} */  public void insert_wstring(String x)  {    resetTypes();    if (has instanceof WStringHolder)      ((WStringHolder) has).value = x;    else      has = new WStringHolder(x);  }  /**   * Return the associated orb.   */  public ORB orb()  {    return orb;  }  /**   * Read the value of the given type from the given stream.   *   * @param input a stream to read from.   * @param a_type a typecode of the value to read.   */  public void read_value(org.omg.CORBA.portable.InputStream input,                         TypeCode a_type                        )                  throws MARSHAL  {    try      {        int kind = a_type.kind().value();        // Fixed needs special handling.        if (kind == TCKind._tk_fixed)          {            BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale());            has = new FixedHolder(dec);          }        else          {            has = HolderLocator.createHolder(a_type);            if (has == null)              {                // Use the Universal Holder that reads till the end of stream.                // This works with the extract/insert pair of the typical                // Helper.                BufferedCdrOutput buffer = new BufferedCdrOutput();                buffer.setOrb(orb);                has = new GeneralHolder(buffer);              }          }        type(a_type);        if (!(has instanceof GeneralHolder) &&            (kind == TCKind._tk_value_box))          {            // The streamable only contains operations for            // reading the value, not the value header.            Field vField = has.getClass().getField("value");            Object content = Vio.read(input, a_type.id());            vField.set(has, content);          }        else          has._read(input);      }    catch (Exception ex)      {        MARSHAL m = new MARSHAL();        m.minor = Minor.Any;        m.initCause(ex);        throw m;      }  }  /** {@inheritDoc} */  public TypeCode type()  {    if (typecode != null)      return typecode;    else if (xKind >= 0)      {        typecode = new PrimitiveTypeCode(TCKind.from_int(xKind));        return typecode;      }    else      return has != null ? has._type() : nullType;  }  /**   * Explicitly set the typecode of the value to the given type.   *   * @param valueTypeCode the typecode of the value.   */  public void type(TypeCode valueTypeCode)  {    xKind = valueTypeCode.kind().value();    typecode = valueTypeCode;  }  /** {@inheritDoc} */  public void write_value(org.omg.CORBA.portable.OutputStream output)  {    if (has != null)      has._write(output);    else    // These kinds support null.    if (xKind == TCKind._tk_null || xKind == TCKind._tk_objref ||        xKind == TCKind._tk_value || xKind == TCKind._tk_value_box       )      output.write_long(0);  }  /**   * Check if the current value if the value of the given kind.   *    * @param kind a kind to check.   * @throws BAD_OPERATION if the value is not set of is different kind.   */  protected void check(int kind)    throws BAD_OPERATION  {    if (has == null)      {        BAD_OPERATION bad = new BAD_OPERATION("value not set");        bad.minor = Minor.Any;        throw bad;      }    if (xKind >= 0)      {        if (xKind != kind)          if (!(xKind == TCKind._tk_alias && has._type().kind().value() == kind))            {              BAD_OPERATION bad = new BAD_OPERATION("Extracting "                + TypeKindNamer.nameIt(kind) + " when stored "                + TypeKindNamer.nameIt(xKind));              bad.minor = Minor.Any;              throw bad;            }      }    else      {        if (type().kind().value() != kind)          if (!(type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind))            {              BAD_OPERATION bad = new BAD_OPERATION("Extracting "                + TypeKindNamer.nameIt(kind) + " stored "                + TypeKindNamer.nameIt(type()));              bad.minor = Minor.Any;              throw bad;            }      }  }  /**   * Clear the additional type information before reusing this instance.   */  private final void resetTypes()  {    typecode = null;    xKind = -1;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -